Skip to content

Commit

Permalink
feat!: remove read-tsconfig option in sort-imports rule
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-io committed Jul 20, 2023
1 parent 528b9ab commit 3d65cca
Show file tree
Hide file tree
Showing 6 changed files with 267 additions and 362 deletions.
16 changes: 3 additions & 13 deletions docs/rules/sort-imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ If you use the [`sort-imports`](https://eslint.org/docs/latest/rules/sort-import
Rule `perfectionist/sort-imports` works in a similar way to rule `import/order`, but with some differences:

1. Supporting for new import types: `'side-effect'`, `'style'`, `'builtin-type'`, `'internal-type'`, `'parent-type'`, `'sibling-type'`, `'index-type'`
2. Parsing `tsconfig.json` with the `read-tsconfig` option enabled to recognize internal imports
3. Supporting for adding custom import groups
4. Sorting not only alphabetically, but also naturally and by line length
2. Supporting for adding custom import groups
3. Sorting not only alphabetically, but also naturally and by line length

## 💡 Examples

Expand Down Expand Up @@ -126,7 +125,6 @@ interface Options {
}
'internal-pattern'?: string[]
'newlines-between'?: 'always' | 'ignore' | 'never'
'read-tsconfig'?: boolean
```
### type
Expand Down Expand Up @@ -244,12 +242,6 @@ The [minimatch](https://github.com/isaacs/minimatch) library is used for pattern
- `always` - one new line between each group will be enforced, and new lines inside a group will be forbidden.
- `never` - no new lines are allowed in the entire import section.
### read-tsconfig
<sub>(default: `false`)</sub>
If your project is written in TypeScript, you can read `tsconfig.json` and use `paths` as internal imports.
## ⚙️ Usage
::: code-group
Expand Down Expand Up @@ -293,8 +285,7 @@ If your project is written in TypeScript, you can read `tsconfig.json` and use `
"@/stores/**",
"@/pages/**",
"@/lib/**"
],
"read-tsconfig": false
]
}
]
}
Expand Down Expand Up @@ -346,7 +337,6 @@ export default [
'@/pages/**',
'@/lib/**',
],
'read-tsconfig': false,
},
],
},
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"@typescript-eslint/types": "^5.62.0",
"@typescript-eslint/utils": "^5.62.0",
"is-core-module": "^2.12.1",
"json5": "^2.2.3",
"minimatch": "^9.0.3",
"natural-compare-lite": "^1.4.0"
},
Expand All @@ -79,7 +78,7 @@
"eslint-plugin-eslint-plugin": "^5.1.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^16.0.1",
"eslint-plugin-perfectionist": "workspace:^",
"eslint-plugin-perfectionist": "^1.5.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-prefer-let": "^3.0.1",
"eslint-plugin-promise": "^6.1.1",
Expand All @@ -96,4 +95,4 @@
"vitest": "^0.33.0",
"vue": "^3.3.4"
}
}
}
Loading

0 comments on commit 3d65cca

Please sign in to comment.