@lincy/eslint-config 4.6.1 → 4.6.3
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 +6 -1
- package/dist/index.cjs +10 -7
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +10 -7
- package/package.json +13 -12
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -758,7 +758,7 @@ var parserPlain2 = __toESM(require("eslint-parser-plain"), 1);
|
|
|
758
758
|
var StylisticConfigDefaults = {
|
|
759
759
|
indent: 4,
|
|
760
760
|
jsx: true,
|
|
761
|
-
lessOpinionated:
|
|
761
|
+
lessOpinionated: false,
|
|
762
762
|
quotes: "single",
|
|
763
763
|
semi: false
|
|
764
764
|
};
|
|
@@ -801,6 +801,7 @@ async function stylistic(options = {}) {
|
|
|
801
801
|
"antfu/top-level-function": "error"
|
|
802
802
|
},
|
|
803
803
|
// 覆盖`stylistic`默认规则
|
|
804
|
+
"style/brace-style": ["error", "stroustrup"],
|
|
804
805
|
"style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
805
806
|
"style/multiline-ternary": ["error", "never"],
|
|
806
807
|
...overrides
|
|
@@ -1006,11 +1007,10 @@ async function react(options = {}) {
|
|
|
1006
1007
|
files = [GLOB_JSX, GLOB_TSX],
|
|
1007
1008
|
jsx = true,
|
|
1008
1009
|
overrides = {},
|
|
1009
|
-
typescript: typescript2 = true,
|
|
1010
1010
|
version = "detect"
|
|
1011
1011
|
} = options;
|
|
1012
1012
|
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1013
|
-
const isTypeAware = !!tsconfigPath
|
|
1013
|
+
const isTypeAware = !!tsconfigPath;
|
|
1014
1014
|
await ensurePackages([
|
|
1015
1015
|
"@eslint-react/eslint-plugin",
|
|
1016
1016
|
"eslint-plugin-react-hooks",
|
|
@@ -1462,6 +1462,7 @@ async function typescript(options = {}) {
|
|
|
1462
1462
|
"ts/no-unsafe-return": "error",
|
|
1463
1463
|
"ts/restrict-plus-operands": "error",
|
|
1464
1464
|
"ts/restrict-template-expressions": "error",
|
|
1465
|
+
"ts/strict-boolean-expressions": "error",
|
|
1465
1466
|
"ts/unbound-method": "error"
|
|
1466
1467
|
};
|
|
1467
1468
|
const [
|
|
@@ -1814,7 +1815,7 @@ async function vue(options = {}) {
|
|
|
1814
1815
|
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1815
1816
|
"vue/block-spacing": ["error", "always"],
|
|
1816
1817
|
"vue/block-tag-newline": ["error", { multiline: "always", singleline: "always" }],
|
|
1817
|
-
"vue/brace-style": ["error", "stroustrup", { allowSingleLine:
|
|
1818
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: false }],
|
|
1818
1819
|
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1819
1820
|
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1820
1821
|
"vue/comma-style": ["error", "last"],
|
|
@@ -1998,6 +1999,7 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1998
1999
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
|
|
1999
2000
|
} = options;
|
|
2000
2001
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2002
|
+
const tsconfigPath = typeof enableTypeScript !== "boolean" && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : void 0;
|
|
2001
2003
|
if (stylisticOptions) {
|
|
2002
2004
|
if (!("jsx" in stylisticOptions)) {
|
|
2003
2005
|
stylisticOptions.jsx = options.jsx ?? true;
|
|
@@ -2040,7 +2042,8 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2040
2042
|
configs2.push(typescript({
|
|
2041
2043
|
...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
|
|
2042
2044
|
componentExts,
|
|
2043
|
-
overrides: overrides.typescript
|
|
2045
|
+
overrides: overrides.typescript,
|
|
2046
|
+
tsconfigPath
|
|
2044
2047
|
}));
|
|
2045
2048
|
}
|
|
2046
2049
|
if (stylisticOptions) {
|
|
@@ -2072,9 +2075,9 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2072
2075
|
}
|
|
2073
2076
|
if (enableReact) {
|
|
2074
2077
|
configs2.push(react({
|
|
2078
|
+
tsconfigPath,
|
|
2075
2079
|
...typeof enableReact !== "boolean" ? enableReact : {},
|
|
2076
|
-
overrides: overrides.react
|
|
2077
|
-
typescript: !!enableTypeScript
|
|
2080
|
+
overrides: overrides.react
|
|
2078
2081
|
}));
|
|
2079
2082
|
}
|
|
2080
2083
|
if (enableUnoCSS) {
|
package/dist/index.d.cts
CHANGED
|
@@ -398,7 +398,7 @@ interface RuleOptions {
|
|
|
398
398
|
*/
|
|
399
399
|
'func-names'?: Linter.RuleEntry<FuncNames>
|
|
400
400
|
/**
|
|
401
|
-
* Enforce the consistent use of either `function` declarations or expressions
|
|
401
|
+
* Enforce the consistent use of either `function` declarations or expressions assigned to variables
|
|
402
402
|
* @see https://eslint.org/docs/latest/rules/func-style
|
|
403
403
|
*/
|
|
404
404
|
'func-style'?: Linter.RuleEntry<FuncStyle>
|
|
@@ -2686,6 +2686,16 @@ interface RuleOptions {
|
|
|
2686
2686
|
*/
|
|
2687
2687
|
'react-naming-convention/use-state'?: Linter.RuleEntry<[]>
|
|
2688
2688
|
'react-refresh/only-export-components'?: Linter.RuleEntry<ReactRefreshOnlyExportComponents>
|
|
2689
|
+
/**
|
|
2690
|
+
* enforce boolean attributes notation in JSX
|
|
2691
|
+
* @see https://eslint-react.xyz/rules/avoid-shorthand-boolean
|
|
2692
|
+
*/
|
|
2693
|
+
'react/avoid-shorthand-boolean'?: Linter.RuleEntry<[]>
|
|
2694
|
+
/**
|
|
2695
|
+
* enforce using fragment component instead of shorthand fragment syntax
|
|
2696
|
+
* @see https://eslint-react.xyz/rules/avoid-shorthand-fragment
|
|
2697
|
+
*/
|
|
2698
|
+
'react/avoid-shorthand-fragment'?: Linter.RuleEntry<[]>
|
|
2689
2699
|
/**
|
|
2690
2700
|
* require all 'forwardRef' components include a 'ref' parameter
|
|
2691
2701
|
* @see https://eslint-react.xyz/rules/ensure-forward-ref-using-ref
|
|
@@ -4903,6 +4913,7 @@ interface RuleOptions {
|
|
|
4903
4913
|
/**
|
|
4904
4914
|
* Enforce using `@ts-expect-error` over `@ts-ignore`
|
|
4905
4915
|
* @see https://typescript-eslint.io/rules/prefer-ts-expect-error
|
|
4916
|
+
* @deprecated
|
|
4906
4917
|
*/
|
|
4907
4918
|
'ts/prefer-ts-expect-error'?: Linter.RuleEntry<[]>
|
|
4908
4919
|
/**
|
|
@@ -14472,6 +14483,7 @@ interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'qu
|
|
|
14472
14483
|
* Including:
|
|
14473
14484
|
* - `antfu/top-level-function`
|
|
14474
14485
|
* - `antfu/if-newline`
|
|
14486
|
+
* - `antfu/curly`
|
|
14475
14487
|
*
|
|
14476
14488
|
* @default false
|
|
14477
14489
|
*/
|
|
@@ -14493,8 +14505,7 @@ interface OptionsIsInEditor {
|
|
|
14493
14505
|
isInEditor?: boolean;
|
|
14494
14506
|
}
|
|
14495
14507
|
interface OptionsReact {
|
|
14496
|
-
tsconfigPath?: string;
|
|
14497
|
-
typescript?: boolean;
|
|
14508
|
+
tsconfigPath?: string | string[];
|
|
14498
14509
|
jsx?: boolean;
|
|
14499
14510
|
/** react 版本 */
|
|
14500
14511
|
version?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -398,7 +398,7 @@ interface RuleOptions {
|
|
|
398
398
|
*/
|
|
399
399
|
'func-names'?: Linter.RuleEntry<FuncNames>
|
|
400
400
|
/**
|
|
401
|
-
* Enforce the consistent use of either `function` declarations or expressions
|
|
401
|
+
* Enforce the consistent use of either `function` declarations or expressions assigned to variables
|
|
402
402
|
* @see https://eslint.org/docs/latest/rules/func-style
|
|
403
403
|
*/
|
|
404
404
|
'func-style'?: Linter.RuleEntry<FuncStyle>
|
|
@@ -2686,6 +2686,16 @@ interface RuleOptions {
|
|
|
2686
2686
|
*/
|
|
2687
2687
|
'react-naming-convention/use-state'?: Linter.RuleEntry<[]>
|
|
2688
2688
|
'react-refresh/only-export-components'?: Linter.RuleEntry<ReactRefreshOnlyExportComponents>
|
|
2689
|
+
/**
|
|
2690
|
+
* enforce boolean attributes notation in JSX
|
|
2691
|
+
* @see https://eslint-react.xyz/rules/avoid-shorthand-boolean
|
|
2692
|
+
*/
|
|
2693
|
+
'react/avoid-shorthand-boolean'?: Linter.RuleEntry<[]>
|
|
2694
|
+
/**
|
|
2695
|
+
* enforce using fragment component instead of shorthand fragment syntax
|
|
2696
|
+
* @see https://eslint-react.xyz/rules/avoid-shorthand-fragment
|
|
2697
|
+
*/
|
|
2698
|
+
'react/avoid-shorthand-fragment'?: Linter.RuleEntry<[]>
|
|
2689
2699
|
/**
|
|
2690
2700
|
* require all 'forwardRef' components include a 'ref' parameter
|
|
2691
2701
|
* @see https://eslint-react.xyz/rules/ensure-forward-ref-using-ref
|
|
@@ -4903,6 +4913,7 @@ interface RuleOptions {
|
|
|
4903
4913
|
/**
|
|
4904
4914
|
* Enforce using `@ts-expect-error` over `@ts-ignore`
|
|
4905
4915
|
* @see https://typescript-eslint.io/rules/prefer-ts-expect-error
|
|
4916
|
+
* @deprecated
|
|
4906
4917
|
*/
|
|
4907
4918
|
'ts/prefer-ts-expect-error'?: Linter.RuleEntry<[]>
|
|
4908
4919
|
/**
|
|
@@ -14472,6 +14483,7 @@ interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'qu
|
|
|
14472
14483
|
* Including:
|
|
14473
14484
|
* - `antfu/top-level-function`
|
|
14474
14485
|
* - `antfu/if-newline`
|
|
14486
|
+
* - `antfu/curly`
|
|
14475
14487
|
*
|
|
14476
14488
|
* @default false
|
|
14477
14489
|
*/
|
|
@@ -14493,8 +14505,7 @@ interface OptionsIsInEditor {
|
|
|
14493
14505
|
isInEditor?: boolean;
|
|
14494
14506
|
}
|
|
14495
14507
|
interface OptionsReact {
|
|
14496
|
-
tsconfigPath?: string;
|
|
14497
|
-
typescript?: boolean;
|
|
14508
|
+
tsconfigPath?: string | string[];
|
|
14498
14509
|
jsx?: boolean;
|
|
14499
14510
|
/** react 版本 */
|
|
14500
14511
|
version?: string;
|
package/dist/index.js
CHANGED
|
@@ -665,7 +665,7 @@ import * as parserPlain2 from "eslint-parser-plain";
|
|
|
665
665
|
var StylisticConfigDefaults = {
|
|
666
666
|
indent: 4,
|
|
667
667
|
jsx: true,
|
|
668
|
-
lessOpinionated:
|
|
668
|
+
lessOpinionated: false,
|
|
669
669
|
quotes: "single",
|
|
670
670
|
semi: false
|
|
671
671
|
};
|
|
@@ -708,6 +708,7 @@ async function stylistic(options = {}) {
|
|
|
708
708
|
"antfu/top-level-function": "error"
|
|
709
709
|
},
|
|
710
710
|
// 覆盖`stylistic`默认规则
|
|
711
|
+
"style/brace-style": ["error", "stroustrup"],
|
|
711
712
|
"style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
712
713
|
"style/multiline-ternary": ["error", "never"],
|
|
713
714
|
...overrides
|
|
@@ -913,11 +914,10 @@ async function react(options = {}) {
|
|
|
913
914
|
files = [GLOB_JSX, GLOB_TSX],
|
|
914
915
|
jsx = true,
|
|
915
916
|
overrides = {},
|
|
916
|
-
typescript: typescript2 = true,
|
|
917
917
|
version = "detect"
|
|
918
918
|
} = options;
|
|
919
919
|
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
920
|
-
const isTypeAware = !!tsconfigPath
|
|
920
|
+
const isTypeAware = !!tsconfigPath;
|
|
921
921
|
await ensurePackages([
|
|
922
922
|
"@eslint-react/eslint-plugin",
|
|
923
923
|
"eslint-plugin-react-hooks",
|
|
@@ -1369,6 +1369,7 @@ async function typescript(options = {}) {
|
|
|
1369
1369
|
"ts/no-unsafe-return": "error",
|
|
1370
1370
|
"ts/restrict-plus-operands": "error",
|
|
1371
1371
|
"ts/restrict-template-expressions": "error",
|
|
1372
|
+
"ts/strict-boolean-expressions": "error",
|
|
1372
1373
|
"ts/unbound-method": "error"
|
|
1373
1374
|
};
|
|
1374
1375
|
const [
|
|
@@ -1721,7 +1722,7 @@ async function vue(options = {}) {
|
|
|
1721
1722
|
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1722
1723
|
"vue/block-spacing": ["error", "always"],
|
|
1723
1724
|
"vue/block-tag-newline": ["error", { multiline: "always", singleline: "always" }],
|
|
1724
|
-
"vue/brace-style": ["error", "stroustrup", { allowSingleLine:
|
|
1725
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: false }],
|
|
1725
1726
|
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1726
1727
|
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1727
1728
|
"vue/comma-style": ["error", "last"],
|
|
@@ -1905,6 +1906,7 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1905
1906
|
vue: enableVue = VuePackages.some((i) => isPackageExists3(i))
|
|
1906
1907
|
} = options;
|
|
1907
1908
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
1909
|
+
const tsconfigPath = typeof enableTypeScript !== "boolean" && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : void 0;
|
|
1908
1910
|
if (stylisticOptions) {
|
|
1909
1911
|
if (!("jsx" in stylisticOptions)) {
|
|
1910
1912
|
stylisticOptions.jsx = options.jsx ?? true;
|
|
@@ -1947,7 +1949,8 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1947
1949
|
configs2.push(typescript({
|
|
1948
1950
|
...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
|
|
1949
1951
|
componentExts,
|
|
1950
|
-
overrides: overrides.typescript
|
|
1952
|
+
overrides: overrides.typescript,
|
|
1953
|
+
tsconfigPath
|
|
1951
1954
|
}));
|
|
1952
1955
|
}
|
|
1953
1956
|
if (stylisticOptions) {
|
|
@@ -1979,9 +1982,9 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1979
1982
|
}
|
|
1980
1983
|
if (enableReact) {
|
|
1981
1984
|
configs2.push(react({
|
|
1985
|
+
tsconfigPath,
|
|
1982
1986
|
...typeof enableReact !== "boolean" ? enableReact : {},
|
|
1983
|
-
overrides: overrides.react
|
|
1984
|
-
typescript: !!enableTypeScript
|
|
1987
|
+
overrides: overrides.react
|
|
1985
1988
|
}));
|
|
1986
1989
|
}
|
|
1987
1990
|
if (enableUnoCSS) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lincy/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.6.
|
|
4
|
+
"version": "4.6.3",
|
|
5
5
|
"packageManager": "pnpm@9.1.0",
|
|
6
6
|
"description": "LinCenYing's ESLint config",
|
|
7
7
|
"author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
|
|
@@ -65,16 +65,16 @@
|
|
|
65
65
|
"@antfu/eslint-define-config": "1.23.0-2",
|
|
66
66
|
"@antfu/install-pkg": "^0.3.3",
|
|
67
67
|
"@stylistic/eslint-plugin": "2.1.0",
|
|
68
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
69
|
-
"@typescript-eslint/parser": "^7.
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^7.11.0",
|
|
69
|
+
"@typescript-eslint/parser": "^7.11.0",
|
|
70
70
|
"eslint-config-flat-gitignore": "^0.1.5",
|
|
71
71
|
"eslint-flat-config-utils": "^0.2.5",
|
|
72
72
|
"eslint-merge-processors": "^0.1.0",
|
|
73
73
|
"eslint-parser-plain": "^0.1.0",
|
|
74
|
-
"eslint-plugin-antfu": "^2.3.
|
|
74
|
+
"eslint-plugin-antfu": "^2.3.3",
|
|
75
75
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
76
76
|
"eslint-plugin-import-x": "^0.5.1",
|
|
77
|
-
"eslint-plugin-jsdoc": "^48.2.
|
|
77
|
+
"eslint-plugin-jsdoc": "^48.2.7",
|
|
78
78
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
79
79
|
"eslint-plugin-markdown": "^5.0.0",
|
|
80
80
|
"eslint-plugin-n": "^17.7.0",
|
|
@@ -93,31 +93,32 @@
|
|
|
93
93
|
"local-pkg": "^0.5.0",
|
|
94
94
|
"prompts": "^2.4.2",
|
|
95
95
|
"toml-eslint-parser": "^0.9.3",
|
|
96
|
-
"vue-eslint-parser": "^9.4.
|
|
96
|
+
"vue-eslint-parser": "^9.4.3",
|
|
97
97
|
"yaml-eslint-parser": "^1.2.3"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"@antfu/ni": "^0.21.12",
|
|
101
|
-
"@eslint-react/eslint-plugin": "^1.5.
|
|
101
|
+
"@eslint-react/eslint-plugin": "^1.5.14",
|
|
102
102
|
"@eslint-types/jsdoc": "48.2.2",
|
|
103
103
|
"@eslint-types/typescript-eslint": "^7.5.0",
|
|
104
104
|
"@eslint-types/unicorn": "^52.0.0",
|
|
105
|
-
"@eslint/config-inspector": "^0.4.
|
|
105
|
+
"@eslint/config-inspector": "^0.4.10",
|
|
106
106
|
"@lincy/eslint-config": "workspace:*",
|
|
107
107
|
"@stylistic/eslint-plugin-migrate": "^2.1.0",
|
|
108
108
|
"@types/eslint": "^8.56.10",
|
|
109
|
-
"@types/node": "^20.
|
|
109
|
+
"@types/node": "^20.14.0",
|
|
110
110
|
"@types/prompts": "^2.4.9",
|
|
111
|
-
"@unocss/eslint-plugin": "^0.60.
|
|
111
|
+
"@unocss/eslint-plugin": "^0.60.4",
|
|
112
112
|
"bumpp": "^9.4.1",
|
|
113
|
-
"eslint": "
|
|
113
|
+
"eslint": "npm:eslint-ts-patch@9.2.0-6",
|
|
114
114
|
"eslint-plugin-format": "^0.1.1",
|
|
115
115
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
116
116
|
"eslint-plugin-react-refresh": "^0.4.7",
|
|
117
|
+
"eslint-ts-patch": "9.2.0-6",
|
|
117
118
|
"eslint-typegen": "^0.2.4",
|
|
118
119
|
"esno": "^4.7.0",
|
|
119
120
|
"lint-staged": "^15.2.5",
|
|
120
|
-
"prettier": "^3.
|
|
121
|
+
"prettier": "^3.3.0",
|
|
121
122
|
"react": "^18.3.1",
|
|
122
123
|
"rimraf": "^5.0.7",
|
|
123
124
|
"simple-git-hooks": "^2.11.1",
|