chore: add consistent type imports

This commit is contained in:
Christian Andolf
2024-12-09 14:36:56 +01:00
parent 9867a56cc8
commit e08e960209
172 changed files with 587 additions and 333 deletions

View File

@@ -1,6 +1,13 @@
{
"extends": ["next/core-web-vitals", "plugin:import/recommended"],
"plugins": ["simple-import-sort"],
"extends": [
"next/core-web-vitals",
"plugin:import/recommended"
],
"plugins": [
"simple-import-sort",
"@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"rules": {
"react/function-component-definition": "error",
"simple-import-sort/imports": [
@@ -8,13 +15,21 @@
{
"groups": [
// Side effect imports.
["^\\u0000"],
[
"^\\u0000"
],
// Node.js builtins.
["^node:"],
[
"^node:"
],
// NPM packages.
["^@?\\w"],
[
"^@?\\w"
],
// Internal packages.
["^@scandic-hotels/(?!.*\u0000$).*$"],
[
"^@scandic-hotels/(?!.*\u0000$).*$"
],
// Local imports (lib, constants, etc.), excl. types.
[
"^@/constants/?(?!.*\u0000$).*$",
@@ -24,7 +39,9 @@
"^@/stores/?(?!.*\u0000$).*$"
],
// Local imports (the rest), excl. types.
["^@/(?!(types|.*\u0000$)).*$"],
[
"^@/(?!(types|.*\u0000$)).*$"
],
// Parent imports. Put `..` last.
// Other relative imports. Put same-folder imports and `.` last.
[
@@ -35,9 +52,14 @@
"^\\./?$"
],
// Style imports.
["^(?!\\u0000).+\\.s?css$"],
[
"^(?!\\u0000).+\\.s?css$"
],
// Node.js builtins and NPM packages type imports.
["^node:.*\\u0000$", "^@?\\w.*\\u0000$"],
[
"^node:.*\\u0000$",
"^@?\\w.*\\u0000$"
],
// Local type imports.
[
"^@scandichotels/.*\\u0000$",
@@ -52,6 +74,12 @@
"simple-import-sort/exports": "error",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error"
"import/no-duplicates": [
"error",
{
"prefer-inline": true
}
],
"@typescript-eslint/consistent-type-imports": "error"
}
}