Skip to content

Commit 5ad913c

Browse files
committed
feat: prefer inline type imports
1 parent 28a6e51 commit 5ad913c

File tree

4 files changed

+82
-2
lines changed

4 files changed

+82
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"@typescript-eslint/eslint-plugin": "^5.56.0",
4343
"@typescript-eslint/parser": "^5.56.0",
4444
"eslint-config-prettier": "^8.8.0",
45+
"eslint-plugin-antfu": "^0.38.2",
4546
"eslint-plugin-eslint-comments": "^3.2.0",
4647
"eslint-plugin-import": "^2.27.5",
4748
"eslint-plugin-jsonc": "^2.7.0",

pnpm-lock.yaml

Lines changed: 74 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import globals from 'globals'
22
import jsConfig from '@eslint/js'
33
import importPlugin from 'eslint-plugin-import'
44
import unicornPlugin from 'eslint-plugin-unicorn'
5+
import antfuPlugin from 'eslint-plugin-antfu'
56

6-
export { importPlugin, unicornPlugin }
7+
export { importPlugin, unicornPlugin, antfuPlugin }
78

89
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
910
export const js = [
@@ -115,6 +116,7 @@ export const imports = [
115116
{
116117
plugins: {
117118
import: importPlugin,
119+
antfu: antfuPlugin,
118120
},
119121
settings: {
120122
'import/resolver': {
@@ -142,6 +144,9 @@ export const imports = [
142144
pathGroupsExcludedImportTypes: ['type'],
143145
},
144146
],
147+
148+
'antfu/import-dedupe': 'error',
149+
'antfu/prefer-inline-type-import': 'error',
145150
},
146151
},
147152
]

src/typescript.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const typescript = [
2828
'@typescript-eslint/ban-types': 'off',
2929
'@typescript-eslint/consistent-type-imports': [
3030
'error',
31-
{ fixStyle: 'separate-type-imports', disallowTypeAnnotations: false },
31+
{ fixStyle: 'inline-type-imports', disallowTypeAnnotations: false },
3232
],
3333
'@typescript-eslint/explicit-module-boundary-types': 'off',
3434
'@typescript-eslint/no-explicit-any': 'off',

0 commit comments

Comments
 (0)