Skip to content

Commit

Permalink
Change the way we sort imports
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-ismagilov committed Aug 22, 2024
1 parent 13e36b4 commit f44e45d
Show file tree
Hide file tree
Showing 17 changed files with 286 additions and 94 deletions.
24 changes: 2 additions & 22 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,8 @@
"ecmaVersion": 2022,
"sourceType": "module"
},
"plugins": ["react", "simple-import-sort"],
"plugins": ["react"],
"rules": {
"react/prop-types": ["off"],
"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)$"]
]
}
],
"simple-import-sort/exports": "error"
"react/prop-types": ["off"]
}
}
3 changes: 0 additions & 3 deletions .prettierrc.json

This file was deleted.

15 changes: 15 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
tabWidth: 2
importOrder:
# Packages `react` related packages come first.
- "^react"
- "^@?\\w"
# Relative imports one directory up, excluding styles
- "^(\\.\\./)(?!.*\\.css).*"
# Relative imports in the same directory, excluding styles
- "^(\\.\\/)(?!.*\\.css).*"
# Style imports.
- "^.*(.css)$"
importOrderSeparation: true
importOrderSortSpecifiers: true
plugins:
- "@trivago/prettier-plugin-sort-imports"
Loading

0 comments on commit f44e45d

Please sign in to comment.