@ithinkdt/lint 4.0.0-5 → 4.0.0-9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  - 集成 `eslint-plugin-tsdoc` 规则;
11
11
  - 集成 `eslint-plugin-import-x` 规则;
12
12
  - 集成 `eslint-plugin-playwright`、`@vitest/eslint-plugin` 测试代码规则;
13
- - 支持 `StyleLint`、`Prettier` 配置。
13
+ - 支持 `StyleLint` 配置。
14
14
 
15
15
  > 由于启用了类型感知规则,原则上 typescript 会在整个项目上执行,推测 `lint-staged` 效果不佳。
16
16
 
@@ -51,22 +51,3 @@ export default {
51
51
  },
52
52
  }
53
53
  ```
54
-
55
-
56
- ## Prettier
57
-
58
- 安装 `npm i -D prettier`
59
-
60
- ```js
61
- // prettier.config.js
62
-
63
- import ithinkdt from '@ithinkdt/lint/prettier'
64
-
65
- /**
66
- * @type {import('prettier').Config}
67
- */
68
- export default {
69
- ...ithinkdt,
70
- // 覆盖配置
71
- }
72
- ```
package/package.json CHANGED
@@ -1,31 +1,26 @@
1
1
  {
2
2
  "name": "@ithinkdt/lint",
3
- "version": "4.0.0-5",
3
+ "version": "4.0.0-9",
4
4
  "type": "module",
5
- "description": "iThinkDT Cloud Lint",
5
+ "description": "iThinkDT 项目的 ESLint、StyleLint 配置",
6
6
  "keywords": [
7
- "vue",
8
7
  "ithinkdt",
8
+ "vue",
9
9
  "lint",
10
10
  "eslint",
11
- "eslint-config",
12
- "prettier",
13
11
  "stylelint"
14
12
  ],
15
13
  "files": [
16
- "*"
14
+ "src"
17
15
  ],
18
16
  "main": "./src/index.js",
19
17
  "module": "./src/index.js",
18
+ "types": "./src/index.d.ts",
20
19
  "exports": {
21
20
  ".": {
22
21
  "types": "./src/index.d.ts",
23
22
  "default": "./src/index.js"
24
23
  },
25
- "./prettier": {
26
- "types": "./src/prettier.d.ts",
27
- "default": "./src/prettier.js"
28
- },
29
24
  "./stylelint": {
30
25
  "types": "./src/stylelint.d.ts",
31
26
  "default": "./src/stylelint.js"
@@ -37,48 +32,48 @@
37
32
  },
38
33
  "sideEffects": false,
39
34
  "dependencies": {
40
- "@typescript-eslint/parser": "^8.4.0",
41
- "@vitest/eslint-plugin": "^1.1.0",
42
- "@vue/compiler-sfc": "^3.4.38",
43
- "@unocss/eslint-config": ">=0.62.3",
35
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
36
+ "@eslint/js": "^9.37.0",
37
+ "@eslint/json": ">=0.13.2",
38
+ "@eslint/markdown": "7.4.0",
39
+ "@stylistic/eslint-plugin": "^5.4.0",
40
+ "@typescript-eslint/parser": "^8.46.0",
41
+ "@unocss/eslint-config": "^66.5.2",
42
+ "@vitest/eslint-plugin": "^1.3.16",
43
+ "@vue/compiler-sfc": "^3.5.22",
44
+ "eslint-flat-config-utils": "^2.1.4",
44
45
  "eslint-import-resolver-custom-alias": "^1.3.2",
45
- "eslint-import-resolver-typescript": "^3.6.3",
46
- "eslint-plugin-import": "npm:eslint-plugin-import-x@^4.1.1",
47
- "eslint-plugin-playwright": "^1.6.2",
48
- "eslint-plugin-tsdoc": ">=0.3.0",
49
- "eslint-plugin-unicorn": "^55.0.0",
50
- "eslint-plugin-vue": "^9.27.0",
51
- "globby": "^14.0.2",
46
+ "eslint-import-resolver-typescript": "^4.4.4",
47
+ "eslint-merge-processors": "^2.0.0",
48
+ "eslint-plugin-format": "^1.0.2",
49
+ "eslint-plugin-import": "npm:eslint-plugin-import-x@^4.16.1",
50
+ "eslint-plugin-no-only-tests": "^3.3.0",
51
+ "eslint-plugin-playwright": "^2.2.2",
52
+ "eslint-plugin-tsdoc": ">=0.4.0",
53
+ "eslint-plugin-unicorn": "^61.0.2",
54
+ "eslint-plugin-vue": "^10.5.0",
55
+ "eslint-processor-vue-blocks": "^2.0.0",
56
+ "globby": "^15.0.0",
52
57
  "is-glob": "^4.0.3",
53
- "postcss": "^8.4.44",
54
- "postcss-html": "^1.7.0",
55
- "postcss-scss": "^4.0.9",
56
- "stylelint-config-recommended": "^14.0.1",
57
- "stylelint-config-standard": "^36.0.1",
58
- "stylelint-config-standard-scss": "^13.1.0",
58
+ "postcss-html": "^1.8.0",
59
+ "stylelint-config-standard": "^39.0.1",
59
60
  "stylelint-config-standard-vue": "^1.0.0",
60
- "stylelint-order": "^6.0.4",
61
- "stylelint-scss": "^6.5.1",
62
- "typescript-eslint": "^8.4.0",
63
- "vue-eslint-parser": "^9.4.3"
61
+ "stylelint-order": "^7.0.0",
62
+ "typescript-eslint": "^8.46.0",
63
+ "vue-eslint-parser": "^10.2.0"
64
64
  },
65
65
  "peerDependencies": {
66
- "eslint": ">=8",
66
+ "eslint": ">=9",
67
67
  "stylelint": ">=16",
68
- "prettier": ">=3",
69
- "dprint": ">=0.47",
70
- "typescript": ">=5"
68
+ "typescript": ">=5.8"
71
69
  },
72
70
  "devDependencies": {
73
- "dprint": ">=0.47.2",
74
- "eslint": "^9.9.1",
75
- "prettier": "^3.3.3",
76
- "stylelint": "~16.9.0",
77
- "typescript": "~5.5.4"
71
+ "eslint": "^9.37.0",
72
+ "stylelint": "~16.25.0",
73
+ "typescript": "~5.9.3"
78
74
  },
79
75
  "license": "MIT",
80
76
  "scripts": {
81
- "format": "prettier --write \"./{src}/**/*.{js,vue,ts,jsx,tsx}\"",
82
77
  "release": "pnpm publish --no-git-checks"
83
78
  }
84
79
  }
package/src/base.js CHANGED
@@ -1,193 +1,287 @@
1
- import { env } from 'node:process'
2
-
3
- import { config as tsconfig, configs as tsconfigs } from 'typescript-eslint'
4
-
5
1
  import js from '@eslint/js'
6
- import unicorn from 'eslint-plugin-unicorn'
7
- import tsdoc from 'eslint-plugin-tsdoc'
2
+ import json from '@eslint/json'
3
+ import markdown from '@eslint/markdown'
4
+ import comments from '@eslint-community/eslint-plugin-eslint-comments/configs'
5
+ import stylistic from '@stylistic/eslint-plugin'
6
+ import { composer } from 'eslint-flat-config-utils'
7
+ import format from 'eslint-plugin-format'
8
8
  import importx from 'eslint-plugin-import'
9
+ import noonlytests from 'eslint-plugin-no-only-tests'
10
+ import tsdoc from 'eslint-plugin-tsdoc'
11
+ import unicorn from 'eslint-plugin-unicorn'
12
+ import { configs as tsconfigs } from 'typescript-eslint'
9
13
 
10
14
  export { default as vitest } from '@vitest/eslint-plugin'
11
15
  export { default as playwright } from 'eslint-plugin-playwright'
12
16
  export { default as vue } from 'eslint-plugin-vue'
13
17
 
14
- export * as vueparser from 'vue-eslint-parser'
18
+ export * as vueParser from 'vue-eslint-parser'
19
+
20
+ export { default as tsParser } from './tsparser-for-extra-files/index.js'
15
21
 
16
- export { default as tsparser } from './tsparser-for-extra-files/index.js'
22
+ export { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
17
23
 
18
- export const disableJsTypeChecked = {
19
- files: ['**/*.js', '**/*.cjs'],
24
+ export const defaultJsFiles = ['**/*.cts', '**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs']
25
+ export const defaultTsFiles = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts']
26
+ export const defaultEsFiles = [...defaultTsFiles, ...defaultJsFiles, '**/*.vue']
27
+
28
+ export const disableTypeChecked = {
20
29
  ...tsconfigs.disableTypeChecked,
30
+ files: defaultJsFiles,
21
31
  }
22
32
 
23
- export const IS_CI = !!env.CI
24
-
25
- export default tsconfig(
26
- js.configs['recommended'],
27
- unicorn.configs['flat/recommended'],
28
- ...tsconfigs['recommendedTypeChecked'],
29
- importx.flatConfigs.recommended,
30
- importx.flatConfigs.typescript,
31
- {
32
- plugins: {
33
- tsdoc,
33
+ export function base({ stylistic: stylisticOptions, inCI }) {
34
+ return composer(
35
+ comments.recommended,
36
+ markdown.configs.recommended,
37
+ {
38
+ ...json.configs.recommended,
39
+ files: ['**/*.json'],
40
+ ignores: ['package-lock.json'],
41
+ language: 'json/json',
34
42
  },
35
- settings: {
36
- 'import-x/resolver': {
37
- typescript: {
38
- alwaysTryTypes: true,
39
- },
40
- },
41
- },
42
- rules: {
43
- // see https://typescript-eslint.io/troubleshooting/typed-linting/performance#eslint-plugin-import
44
- 'import-x/no-unresolved': 'off',
45
- 'import-x/namespace': 'off',
46
- 'import-x/default': 'off',
47
- 'import-x/no-unused-modules': 'off',
48
- 'import-x/extensions': 'off',
49
- 'import-x/no-deprecated': IS_CI ? 'error' : 'off',
50
- 'import-x/no-named-as-default': IS_CI ? 'warn' : 'off',
51
- 'import-x/no-named-as-default-member': 'off',
52
- 'import-x/no-cycle': ['error', { maxDepth: 2, ignoreExternal: true }],
53
-
54
- // ------ start copy from @vue/eslint-config-typescript
55
-
56
- // The core 'no-unused-vars' rules (in the eslint:recommeded ruleset)
57
- // does not work with type definitions
58
- 'no-unused-vars': 'off',
59
- // TS already checks for that, and Typescript-Eslint recommends to disable it
60
- // https://typescript-eslint.io/linting/troubleshooting#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
61
- 'no-undef': 'off',
62
-
63
- // The following rules are enabled in an `overrides` field in the
64
- // `@typescript-eslint/recommended` ruleset, only turned on for TypeScript source modules
65
- // <https://github.com/typescript-eslint/typescript-eslint/blob/cb2d44650d27d8b917e8ce19423245b834db29d2/packages/eslint-plugin/src/configs/eslint-recommended.ts#L27-L30>
66
-
67
- // But as ESLint cannot precisely target `<script lang="ts">` blocks and skip normal `<script>`,
68
- // no TypeScript code in `.vue` files would be checked against these rules.
69
-
70
- // So we now enable them globally.
71
- // That would also check plain JavaScript files, which diverges a little from
72
- // the original intention of the `@typescript-eslint/recommended` rulset.
73
- // But it should be mostly fine.
74
- 'no-var': 'error', // ts transpiles let/const to var, so no need for vars any more
75
- 'prefer-const': ['error', { destructuring: 'all' }], // ts provides better types with const
76
- 'prefer-rest-params': 'error', // ts provides better types with rest args over arguments
77
- 'prefer-spread': 'error', // ts transpiles spread to apply, so no need for manual apply
78
-
79
- // this rule, if on, would require explicit return type on the `render` function
80
- '@typescript-eslint/explicit-function-return-type': 'off',
81
-
82
- // ------ end
83
-
84
- // 忽略下划线开始的变量名
85
- '@typescript-eslint/no-unused-vars': [
86
- 'warn',
87
- {
43
+ [js.configs.recommended,
44
+ unicorn.configs.recommended,
45
+ ...tsconfigs.recommendedTypeChecked,
46
+ importx.flatConfigs.recommended,
47
+ importx.flatConfigs.typescript,
48
+ ].map((it) => {
49
+ return {
50
+ ...it,
51
+ files: defaultEsFiles,
52
+ }
53
+ }),
54
+ stylisticOptions
55
+ ? [
56
+ {
57
+ ...stylistic.configs.customize(stylisticOptions),
58
+ files: defaultEsFiles,
59
+ },
60
+ {
61
+ files: ['**/*.css', '**/*.scss', '**/*.less'],
62
+ languageOptions: {
63
+ parser: format.parserPlain,
64
+ },
65
+ plugins: {
66
+ format,
67
+ },
68
+ rules: {
69
+ 'format/prettier': ['warn', {
70
+ parser: 'css',
71
+ tabWidth: stylisticOptions.indent,
72
+ }],
73
+ },
74
+ },
75
+ ]
76
+ : [],
77
+ {
78
+ files: defaultEsFiles,
79
+ rules: {
80
+ 'comments/disable-enable-pair': ['error', {
81
+ allowWholeFile: true,
82
+ }],
83
+ // see https://typescript-eslint.io/troubleshooting/typed-linting/performance#eslint-plugin-import
84
+ 'import-x/no-unresolved': 'off',
85
+ 'import-x/namespace': 'off',
86
+ 'import-x/default': 'off',
87
+ 'import-x/no-duplicates': ['warn', {
88
+ considerQueryString: true,
89
+ }],
90
+ 'import-x/extensions': 'off',
91
+ 'import-x/no-unused-modules': 'off',
92
+ 'import-x/no-deprecated': inCI ? 'error' : 'off',
93
+ 'import-x/no-named-as-default': inCI ? 'warn' : 'off',
94
+ 'import-x/no-named-as-default-member': 'off',
95
+ 'import-x/no-cycle': ['error', {
96
+ maxDepth: 2,
97
+ ignoreExternal: true,
98
+ }],
99
+ 'import-x/no-useless-path-segments': 'error',
100
+ 'import-x/first': 'warn',
101
+ 'import-x/exports-last': 'off',
102
+ 'import-x/group-exports': 'off',
103
+ 'import-x/newline-after-import': 'error',
104
+ 'import-x/no-relative-packages': 'error',
105
+ 'import-x/no-absolute-path': 'error',
106
+
107
+ // ------ start copy from @vue/eslint-config-typescript
108
+
109
+ // The core 'no-unused-vars' rules (in the eslint:recommeded ruleset)
110
+ // does not work with type definitions
111
+ 'no-unused-vars': 'off',
112
+ // TS already checks for that, and Typescript-Eslint recommends to disable it
113
+ // https://typescript-eslint.io/linting/troubleshooting#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
114
+ 'no-undef': 'off',
115
+
116
+ // The following rules are enabled in an `overrides` field in the
117
+ // `@typescript-eslint/recommended` ruleset, only turned on for TypeScript source modules
118
+ // <https://github.com/typescript-eslint/typescript-eslint/blob/cb2d44650d27d8b917e8ce19423245b834db29d2/packages/eslint-plugin/src/configs/eslint-recommended.ts#L27-L30>
119
+
120
+ // But as ESLint cannot precisely target `<script lang="ts">` blocks and skip normal `<script>`,
121
+ // no TypeScript code in `.vue` files would be checked against these rules.
122
+
123
+ // So we now enable them globally.
124
+ // That would also check plain JavaScript files, which diverges a little from
125
+ // the original intention of the `@typescript-eslint/recommended` rulset.
126
+ // But it should be mostly fine.
127
+ 'no-var': 'error', // ts transpiles let/const to var, so no need for vars any more
128
+ 'prefer-const': ['error', {
129
+ destructuring: 'all',
130
+ }], // ts provides better types with const
131
+ 'prefer-rest-params': 'error', // ts provides better types with rest args over arguments
132
+ 'prefer-spread': 'error', // ts transpiles spread to apply, so no need for manual apply
133
+
134
+ // this rule, if on, would require explicit return type on the `render` function
135
+ // 'ts/explicit-function-return-type': 'off',
136
+
137
+ // ------ end
138
+
139
+ // 忽略下划线开始的变量名
140
+ 'ts/no-unused-vars': ['warn', {
141
+ args: 'after-used',
88
142
  argsIgnorePattern: '^_',
89
143
  varsIgnorePattern: '^_',
90
- },
91
- ],
92
- // 允许非空断言
93
- '@typescript-eslint/no-non-null-assertion': 'off',
94
- // 空合并提示
95
- '@typescript-eslint/prefer-nullish-coalescing': [
96
- 'warn',
97
- {
144
+ destructuredArrayIgnorePattern: '^_',
145
+ ignoreRestSiblings: true,
146
+ caughtErrors: 'none',
147
+ }],
148
+ // 允许非空断言
149
+ 'ts/no-non-null-assertion': 'off',
150
+ // 空合并提示
151
+ 'ts/prefer-nullish-coalescing': ['warn', {
98
152
  ignoreConditionalTests: true,
99
153
  ignoreTernaryTests: true,
100
154
  ignoreMixedLogicalExpressions: true,
101
155
  ignorePrimitives: true,
102
- },
103
- ],
104
- '@typescript-eslint/no-empty-object-type': [
105
- 'error',
106
- { allowInterfaces: 'with-single-extends', allowWithName: 'Props$' },
107
- ],
108
-
109
- '@typescript-eslint/no-explicit-any': ['error', { ignoreRestArgs: true }],
110
-
111
- // 允许未 catch 的 promise
112
- '@typescript-eslint/no-floating-promises': 'off',
113
- '@typescript-eslint/no-misused-promises': [
114
- 'warn',
115
- {
156
+ }],
157
+ 'ts/no-empty-object-type': ['error', {
158
+ allowInterfaces: 'with-single-extends',
159
+ allowWithName: 'Props$',
160
+ }],
161
+
162
+ 'ts/no-explicit-any': ['error', {
163
+ ignoreRestArgs: true,
164
+ }],
165
+
166
+ // 允许未 catch 的 promise
167
+ 'ts/no-floating-promises': 'off',
168
+ 'ts/no-misused-promises': ['warn', {
116
169
  checksVoidReturn: false,
117
- },
118
- ],
119
- // 允许模版表达式使用数字
120
- '@typescript-eslint/restrict-template-expressions': [
121
- 'warn',
122
- {
170
+ }],
171
+ // 允许模版表达式使用数字
172
+ 'ts/restrict-template-expressions': ['warn', {
123
173
  allowNumber: true,
124
- },
125
- ],
174
+ }],
126
175
 
127
- // 允许缩写
128
- 'unicorn/prevent-abbreviations': ['off'],
176
+ // 允许缩写
177
+ 'unicorn/prevent-abbreviations': 'off',
129
178
 
130
- // 不提升箭头函数
131
- 'unicorn/consistent-function-scoping': ['warn', { checkArrowFunctions: false }],
179
+ // 不提升箭头函数
180
+ 'unicorn/consistent-function-scoping': ['warn', {
181
+ checkArrowFunctions: false,
182
+ }],
132
183
 
133
- // 文件名拼写忽略组件
134
- 'unicorn/filename-case': [
135
- 'warn',
136
- {
184
+ // 文件名拼写忽略组件
185
+ 'unicorn/filename-case': ['warn', {
137
186
  case: 'kebabCase',
138
187
  ignore: [String.raw`\.(j|t)sx$`, String.raw`\.vue`],
139
- },
140
- ],
188
+ }],
141
189
 
142
- // Array.reduce 设为 警告
143
- 'unicorn/no-array-reduce': ['warn'],
190
+ // 忽略 Array.reduce
191
+ 'unicorn/no-array-reduce': 'off',
144
192
 
145
- // 重导出检查 忽略已用变量
146
- 'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }],
193
+ // 重导出检查 忽略已用变量
194
+ 'unicorn/prefer-export-from': ['error', {
195
+ ignoreUsedVariables: true,
196
+ }],
147
197
 
148
- // tla 设为 警告
149
- 'unicorn/prefer-top-level-await': ['warn'],
198
+ // tla 设为 警告
199
+ 'unicorn/prefer-top-level-await': 'warn',
150
200
 
151
- // 仅单行时优先三元表达式
152
- 'unicorn/prefer-ternary': ['warn', 'only-single-line'],
201
+ 'unicorn/no-useless-undefined': ['warn', {
202
+ checkArguments: false,
203
+ checkArrowFunctionBody: false,
204
+ }],
205
+ 'unicorn/no-null': 'off',
153
206
 
154
- // 关闭 优先 String#replaceAll(),使用全局标志进行正则表达式搜索
155
- 'unicorn/prefer-string-replace-all': ['off'],
207
+ // 仅单行时优先三元表达式
208
+ 'unicorn/prefer-ternary': ['warn',
209
+ 'only-single-line',
210
+ ],
156
211
 
157
- // 关闭 优先 structuredClone()
158
- 'unicorn/prefer-structured-clone': 'off',
212
+ // 关闭 优先 String#replaceAll(),使用全局标志进行正则表达式搜索
213
+ 'unicorn/prefer-string-replace-all': 'off',
159
214
 
160
- // @typescript-eslint/no-this-alias 重复
161
- 'unicorn/no-this-assignment': 'off',
215
+ // 关闭 优先 structuredClone()
216
+ 'unicorn/prefer-structured-clone': 'off',
162
217
 
163
- 'unicorn/template-indent': 'off',
164
- 'unicorn/empty-brace-spaces': 'off',
165
- 'unicorn/no-nested-ternary': 'off',
166
- 'unicorn/number-literal-case': 'off',
218
+ // 与 ts/no-this-alias 重复
219
+ 'unicorn/no-this-assignment': 'off',
220
+
221
+ 'unicorn/template-indent': 'off',
222
+ 'unicorn/empty-brace-spaces': 'off',
223
+ 'unicorn/no-nested-ternary': 'off',
224
+ 'unicorn/number-literal-case': 'off',
225
+ 'unicorn/prefer-top-level-await': 'off',
226
+ },
167
227
  },
168
- },
169
- {
170
- files: ['**/*.ts', '**/*.tsx'],
171
- rules: {
172
- // 启用 tsdoc 扫描
173
- 'tsdoc/syntax': 'warn',
174
-
175
- // 不允许使用标记为 @deprecated 的代码
176
- '@typescript-eslint/no-deprecated': ['warn'],
228
+ {
229
+ files: defaultTsFiles,
230
+ plugins: {
231
+ tsdoc,
232
+ },
233
+ rules: {
234
+ // 启用 tsdoc 扫描
235
+ 'tsdoc/syntax': 'warn',
236
+ // 不允许使用标记为 @deprecated 的代码
237
+ 'ts/no-deprecated': 'warn',
238
+ },
177
239
  },
178
- },
179
- {
180
- files: ['**/*.d.ts'],
181
- rules: {
182
- '@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }],
183
- 'unicorn/no-abusive-eslint-disable': 'off',
240
+ {
241
+ files: ['**/*.d.ts'],
242
+ rules: {
243
+ 'ts/no-explicit-any': ['warn', {
244
+ ignoreRestArgs: true,
245
+ }],
246
+ 'ts/no-empty-object-type': 'off',
247
+ 'unicorn/no-abusive-eslint-disable': 'off',
248
+ },
184
249
  },
185
- },
186
- {
187
- files: ['**/*.cjs'],
188
- rules: {
189
- // in plain CommonJS modules, you can't use `import foo = require('foo')` to pass this rule, so it has to be disabled
190
- '@typescript-eslint/no-require-imports': 'off',
250
+ {
251
+ files: ['**/shims-*.d.ts'],
252
+ rules: {
253
+ 'comments/no-unlimited-disable': 'off',
254
+ },
191
255
  },
192
- },
193
- )
256
+ {
257
+ files: ['**/*.cjs'],
258
+ rules: {
259
+ // in plain CommonJS modules, you can't use `import foo = require('foo')` to pass this rule, so it has to be disabled
260
+ 'ts/no-require-imports': 'off',
261
+ },
262
+ },
263
+ {
264
+ files: ['**/tests/**'],
265
+ plugins: {
266
+ 'no-only-tests': noonlytests,
267
+ },
268
+ rules: {
269
+ 'test/no-only-tests': ['error', {
270
+ fix: inCI ? true : false,
271
+ }],
272
+ },
273
+ },
274
+ {
275
+ files: ['**/locales/**'],
276
+ rules: {
277
+ // 文件名拼写忽略 locale
278
+ 'unicorn/filename-case': 'off',
279
+ },
280
+ },
281
+ ).renamePlugins({
282
+ 'no-only-tests': 'test',
283
+ '@typescript-eslint': 'ts',
284
+ '@stylistic': 'style',
285
+ '@eslint-community/eslint-comments': 'comments',
286
+ })
287
+ }
package/src/index.d.ts CHANGED
@@ -1,9 +1,17 @@
1
+ import { StylisticCustomizeOptions } from '@stylistic/eslint-plugin'
1
2
  import { Config } from 'typescript-eslint'
2
3
 
4
+ export { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
5
+
3
6
  /** Options for {@link lintConfig} */
4
7
  export interface LintOptions {
5
8
  /** 是否启用 \@unocss/eslint-config */
6
9
  unocss?: boolean
10
+ /** 是否启用 \@stylistic/eslint-plugin */
11
+ stylistic?: boolean | StylisticCustomizeOptions
12
+
13
+ /** 指定 TSConfig 根目录 */
14
+ tsconfigRootDir?: string
7
15
  }
8
16
 
9
17
  declare const lintConfig: (options?: LintOptions) => Config