Skip to content

Commit

Permalink
chore: Import sort plugin (#14)
Browse files Browse the repository at this point in the history
* chore: Import sort plugin

* chore: Replace import sorting pattern for external packages to include everything started optionally with @, but @Cloudscape

* chore: Remove redundant pattern from external config
  • Loading branch information
georgylobko authored Jul 22, 2024
1 parent 204688a commit f7142c7
Show file tree
Hide file tree
Showing 33 changed files with 302 additions and 27 deletions.
31 changes: 27 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"jsx": true
}
},
"plugins": ["unicorn", "react-hooks", "no-unsanitized", "header", "import"],
"plugins": ["unicorn", "react-hooks", "no-unsanitized", "header", "import", "simple-import-sort"],
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
Expand Down Expand Up @@ -73,14 +73,13 @@
]
}
],
"sort-imports": ["error", { "ignoreDeclarationSort": true }],
"import/order": ["error", { "alphabetize": { "order": "asc" } }],
"import/no-useless-path-segments": [
"warn",
{
"noUselessIndex": true
}
]
],
"simple-import-sort/imports": "warn"
},
"settings": {
"react": {
Expand All @@ -102,6 +101,30 @@
"env": {
"jest": true
}
},
{
"files": ["src/**", "pages/**", "test/**", "scripts/**"],
"rules": {
"simple-import-sort/imports": [
"warn",
{
"groups": [
// External packages come first.
["^react", "^(?!@cloudscape)@?\\w"],
// Cloudscape packages.
["^@cloudscape"],
// Things that start with a letter (or digit or underscore), or `~` followed by a letter.
["^~?\\w"],
// Anything not matched in another group.
["^"],
// Styles come last.
[
"^.+\\.?(css)$","^.+\\.?(css.js)$", "^.+\\.?(scss)$", "^.+\\.?(selectors.js)$"
]
]
}
]
}
}
]
}
213 changes: 213 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unicorn": "^45.0.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"execa": "^6.1.0",
"globby": "^13.1.3",
"husky": "^8.0.3",
Expand Down
Loading

0 comments on commit f7142c7

Please sign in to comment.