Refactor imports

* refactor: implement import lint
This commit is contained in:
Carlos Valente
2022-06-11 23:17:16 +02:00
committed by GitHub
parent c576b6308e
commit dda92ba3a8
111 changed files with 482 additions and 288 deletions
+55 -3
View File
@@ -7,7 +7,8 @@
"plugins": [
"react",
"testing-library",
"jest"
"jest",
"simple-import-sort"
],
"rules": {
"jest/no-mocks-import": "warn",
@@ -77,6 +78,57 @@
"customValidators": [],
"skipUndeclared": true
}
]
}
],
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
"import/no-duplicates": "error"
},
"overrides": [
// override "simple-import-sort" config
{
"files": [
"*.js",
"*.jsx",
"*.ts",
"*.tsx"
],
"rules": {
"simple-import-sort/imports": [
"error",
{
"groups": [
// Packages `react` related packages come first.
[
"^react",
"^@?\\w"
],
// Internal packages.
[
"^(@|components)(/.*|$)"
],
// Side effect imports.
[
"^\\u0000"
],
// Parent imports. Put `..` last.
[
"^\\.\\.(?!/?$)",
"^\\.\\./?$"
],
// Other relative imports. Put same-folder imports and `.` last.
[
"^\\./(?=.*/)(?!/?$)",
"^\\.(?!/?$)",
"^\\./?$"
],
// Style imports.
[
"^.+\\.?(css)$"
]
]
}
]
}
}
]
}