Sort imports

So using the create-t3-app im using the https://www.npmjs.com/package/eslint-plugin-simple-import-sort lib to sort my exports because it freaks me out to have these imports unsorted. And i extended my eslint config as follows:
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "simple-import-sort"],
"extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"],
"rules": {
"@typescript-eslint/consistent-type-imports": "error",
"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"
}
}
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "simple-import-sort"],
"extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"],
"rules": {
"@typescript-eslint/consistent-type-imports": "error",
"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"
}
}
Yet the sort isnt working. Anyone ?
npm
eslint-plugin-simple-import-sort
Easy autofixable import sorting. Latest version: 8.0.0, last published: 3 months ago. Start using eslint-plugin-simple-import-sort in your project by running npm i eslint-plugin-simple-import-sort. There are 762 other projects in the npm registry using eslint-plugin-simple-import-sort.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server