@lincy/eslint-config 3.4.1 → 3.5.1
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 +12 -6
- package/dist/index.cjs +226 -7153
- package/dist/index.d.cts +60 -33
- package/dist/index.d.ts +60 -33
- package/dist/index.js +140 -6988
- package/package.json +18 -16
- package/dist/chunk-YG22WGT3.js +0 -40
- package/dist/main-4FJS3AFB.js +0 -1563
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://npmjs.com/package/@lincy/eslint-config)
|
|
4
4
|
|
|
5
|
+
> Thanks to [sxzz/eslint-config](https://github.com/sxzz/eslint-config) and [antfu/eslint-config](https://github.com/antfu/eslint-config) for the inspiration and reference.
|
|
6
|
+
|
|
5
7
|
- 单引号,无结尾分号
|
|
6
8
|
- 自动格式化
|
|
7
9
|
- 专为与 TypeScript、Vue(2/3) 一起使用而设计,开箱即用
|
|
@@ -67,7 +69,7 @@ For example:
|
|
|
67
69
|
|
|
68
70
|
// 在 IDE 中静默样式规则,但仍会自动修复它们
|
|
69
71
|
"eslint.rules.customizations": [
|
|
70
|
-
{ "rule": "
|
|
72
|
+
{ "rule": "style/*", "severity": "off" },
|
|
71
73
|
{ "rule": "*-indent", "severity": "off" },
|
|
72
74
|
{ "rule": "*-spacing", "severity": "off" },
|
|
73
75
|
{ "rule": "*-spaces", "severity": "off" },
|
|
@@ -129,11 +131,13 @@ import lincy from '@lincy/eslint-config'
|
|
|
129
131
|
|
|
130
132
|
export default lincy({
|
|
131
133
|
// 是否启用 stylistic 格式化规则
|
|
132
|
-
stylistic: true, // 默认值: true, 可选: false | { indent: number | 'tab', quotes: 'single' | 'double'}
|
|
134
|
+
stylistic: true, // 默认值: true, 可选: false | { indent: number | 'tab', quotes: 'single' | 'double', jsx: boolean}
|
|
133
135
|
// 是否启用 typescript 规则
|
|
134
136
|
typescript: true, // 默认值: 检测是否安装typescript依赖, 可选: false
|
|
135
137
|
// 是否启用 vue 规则
|
|
136
138
|
vue: true, // 默认值: 检测是否安装vue依赖, 可选: false
|
|
139
|
+
// 是否启用 jsx 规则
|
|
140
|
+
jsx: true, // 默认值: true, 可选: false
|
|
137
141
|
// 是否启用 jsonc 规则
|
|
138
142
|
jsonc: false, // 默认值: true, 可选: false
|
|
139
143
|
// 是否启用 yaml 规则
|
|
@@ -245,9 +249,8 @@ export default [
|
|
|
245
249
|
|
|
246
250
|
查看 [configs](https://github.com/lincenying/eslint-config/blob/main/src/configs) 和 [factory](https://github.com/lincenying/eslint-config/blob/main/src/factory.ts)了解更多详细信息。
|
|
247
251
|
|
|
248
|
-
> Thanks to [sxzz/eslint-config](https://github.com/sxzz/eslint-config) and [antfu/eslint-config](https://github.com/antfu/eslint-config) for the inspiration and reference.
|
|
249
252
|
|
|
250
|
-
|
|
253
|
+
### 插件重命名
|
|
251
254
|
|
|
252
255
|
由于扁平化配置支持显式提供了插件名称,因此我们重命名了一些插件以使它们更加一致并隐藏实现细节。
|
|
253
256
|
|
|
@@ -267,7 +270,7 @@ export default [
|
|
|
267
270
|
type foo = { bar: 2 }
|
|
268
271
|
```
|
|
269
272
|
|
|
270
|
-
###
|
|
273
|
+
### 规则覆盖
|
|
271
274
|
|
|
272
275
|
某些规则仅在特定文件中启用,例如,“ts/*”规则仅在“.ts”文件中启用,“vue/*”规则仅在“.vue”文件中启用。 如果要覆盖规则,则需要指定文件扩展名:
|
|
273
276
|
|
|
@@ -279,6 +282,7 @@ export default lincy(
|
|
|
279
282
|
{
|
|
280
283
|
isInEditor: true,
|
|
281
284
|
vue: true,
|
|
285
|
+
jsx: true,
|
|
282
286
|
typescript: true,
|
|
283
287
|
stylistic: true,
|
|
284
288
|
gitignore: true,
|
|
@@ -343,7 +347,7 @@ export default lincy({
|
|
|
343
347
|
})
|
|
344
348
|
```
|
|
345
349
|
|
|
346
|
-
###
|
|
350
|
+
### 类型感知规则
|
|
347
351
|
|
|
348
352
|
您可以选择通过将选项对象传递给“typescript”配置来启用[类型感知规则](https://typescript-eslint.io/linting/typed-linting/):
|
|
349
353
|
|
|
@@ -376,6 +380,8 @@ import pluginReactHooks from 'eslint-plugin-react-hooks'
|
|
|
376
380
|
export default lincy(
|
|
377
381
|
{
|
|
378
382
|
vue: false,
|
|
383
|
+
// 关闭stylistic提供的jsx规则, 直接使用eslint-plugin-react
|
|
384
|
+
jsx: false,
|
|
379
385
|
},
|
|
380
386
|
// react 相关规则
|
|
381
387
|
{
|