Skip to content

Commit

Permalink
feat: add import sort and order rules in eslint config
Browse files Browse the repository at this point in the history
affects: @medly/eslint-config-react
  • Loading branch information
gmukul01 committed Jan 2, 2023
1 parent c5f7683 commit 98d9d6b
Show file tree
Hide file tree
Showing 4 changed files with 419 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"prepare": "husky install",
"postinstall": "yarn link:packages && yarn init:commitizen",
"init:commitizen": "commitizen init cz-lerna-changelog --yarn --dev --exact --force",
"clean": "lerna clean && rimraf yarn.lock && rimraf node_modules",
"clean": "lerna clean --yes && rimraf node_modules",
"lint": "eslint 'packages/**/*.{js, ts}'",
"commit": "git-cz",
"link:packages": "lerna link && lerna exec -- yarn link",
Expand Down
24 changes: 22 additions & 2 deletions packages/eslint-config-react/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
"settings": {
"react": {
"version": "detect"
},
"import/resolver": {
"node": {
"paths": "src"
}
}
},
"parserOptions": {
Expand All @@ -20,9 +25,17 @@
},
"ignorePatterns": ["**/*.snap"],
"parser": "@typescript-eslint/parser",
"plugins": ["react", "react-hooks", "testing-library", "html"],
"extends": ["@medly", "plugin:react/recommended", "plugin:react-hooks/recommended"],
"plugins": ["react", "react-hooks", "testing-library", "html", "import"],
"extends": ["@medly", "plugin:react/recommended", "plugin:react-hooks/recommended", "plugin:import/typescript"],
"rules": {
"import/newline-after-import": 1,
"import/order": [
1,
{
"newlines-between": "always",
"groups": [["builtin", "external"], "internal", ["parent", "sibling", "index"]]
}
],
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"react/jsx-fragments": "warn",
Expand All @@ -35,6 +48,13 @@
{
"allowArrowFunctions": true
}
],
"sort-imports": [
1,
{
"ignoreCase": true,
"ignoreDeclarationSort": true
}
]
},
"overrides": [
Expand Down
4 changes: 3 additions & 1 deletion packages/eslint-config-react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@medly/eslint-config-react",
"description": "Basic eslint config for react app",
"version": "0.4.0",
"version": "1.0.0",
"sideEffects": false,
"main": "index.json",
"publishConfig": {
Expand All @@ -28,7 +28,9 @@
"dependencies": {
"@medly/eslint-config": "0.5.1",
"eslint": "^7.28.0",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-testing-library": "^5.0.1"
Expand Down
Loading

0 comments on commit 98d9d6b

Please sign in to comment.