@lincy/eslint-config 3.5.2 → 3.6.0
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 +1 -0
- package/dist/index.cjs +8 -3
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +7 -3
- package/package.json +4 -4
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -87,6 +87,7 @@ __export(src_exports, {
|
|
|
87
87
|
sortTsconfig: () => sortTsconfig,
|
|
88
88
|
stylistic: () => stylistic,
|
|
89
89
|
test: () => test,
|
|
90
|
+
toArray: () => toArray,
|
|
90
91
|
typescript: () => typescript,
|
|
91
92
|
unicorn: () => unicorn,
|
|
92
93
|
vue: () => vue,
|
|
@@ -1043,14 +1044,16 @@ function renameRules(rules, from, to) {
|
|
|
1043
1044
|
})
|
|
1044
1045
|
);
|
|
1045
1046
|
}
|
|
1047
|
+
function toArray(value) {
|
|
1048
|
+
return Array.isArray(value) ? value : [value];
|
|
1049
|
+
}
|
|
1046
1050
|
|
|
1047
1051
|
// src/configs/typescript.ts
|
|
1048
1052
|
function typescript(options) {
|
|
1049
1053
|
const {
|
|
1050
1054
|
componentExts = [],
|
|
1051
1055
|
overrides = {},
|
|
1052
|
-
parserOptions = {}
|
|
1053
|
-
tsconfigPath
|
|
1056
|
+
parserOptions = {}
|
|
1054
1057
|
} = options ?? {};
|
|
1055
1058
|
const typeAwareRules = {
|
|
1056
1059
|
"dot-notation": "off",
|
|
@@ -1073,6 +1076,7 @@ function typescript(options) {
|
|
|
1073
1076
|
"ts/restrict-template-expressions": "error",
|
|
1074
1077
|
"ts/unbound-method": "error"
|
|
1075
1078
|
};
|
|
1079
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1076
1080
|
return [
|
|
1077
1081
|
{
|
|
1078
1082
|
// Install the plugins without globs, so they can be configured separately.
|
|
@@ -1093,7 +1097,7 @@ function typescript(options) {
|
|
|
1093
1097
|
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
1094
1098
|
sourceType: "module",
|
|
1095
1099
|
...tsconfigPath ? {
|
|
1096
|
-
project:
|
|
1100
|
+
project: tsconfigPath,
|
|
1097
1101
|
tsconfigRootDir: import_node_process.default.cwd()
|
|
1098
1102
|
} : {},
|
|
1099
1103
|
...parserOptions
|
|
@@ -1609,6 +1613,7 @@ var src_default = lincy;
|
|
|
1609
1613
|
sortTsconfig,
|
|
1610
1614
|
stylistic,
|
|
1611
1615
|
test,
|
|
1616
|
+
toArray,
|
|
1612
1617
|
typescript,
|
|
1613
1618
|
unicorn,
|
|
1614
1619
|
vue,
|
package/dist/index.d.cts
CHANGED
|
@@ -64,7 +64,7 @@ interface OptionsTypeScriptWithTypes {
|
|
|
64
64
|
* When this options is provided, type aware rules will be enabled.
|
|
65
65
|
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
66
66
|
*/
|
|
67
|
-
tsconfigPath?: string;
|
|
67
|
+
tsconfigPath?: string | string[];
|
|
68
68
|
}
|
|
69
69
|
interface OptionsHasTypeScript {
|
|
70
70
|
typescript?: boolean;
|
|
@@ -238,6 +238,7 @@ declare function combine(...configs: (ConfigItem | ConfigItem[])[]): ConfigItem[
|
|
|
238
238
|
declare function renameRules(rules: Record<string, any>, from: string, to: string): {
|
|
239
239
|
[k: string]: any;
|
|
240
240
|
};
|
|
241
|
+
declare function toArray<T>(value: T | T[]): T[];
|
|
241
242
|
|
|
242
243
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
243
244
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -261,4 +262,4 @@ declare const GLOB_TESTS: string[];
|
|
|
261
262
|
declare const GLOB_ALL_SRC: string[];
|
|
262
263
|
declare const GLOB_EXCLUDE: string[];
|
|
263
264
|
|
|
264
|
-
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, StylisticOverridesConfig, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, renameRules, sortKeys, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, yaml };
|
|
265
|
+
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, StylisticOverridesConfig, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, renameRules, sortKeys, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, vue, yaml };
|
package/dist/index.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ interface OptionsTypeScriptWithTypes {
|
|
|
64
64
|
* When this options is provided, type aware rules will be enabled.
|
|
65
65
|
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
66
66
|
*/
|
|
67
|
-
tsconfigPath?: string;
|
|
67
|
+
tsconfigPath?: string | string[];
|
|
68
68
|
}
|
|
69
69
|
interface OptionsHasTypeScript {
|
|
70
70
|
typescript?: boolean;
|
|
@@ -238,6 +238,7 @@ declare function combine(...configs: (ConfigItem | ConfigItem[])[]): ConfigItem[
|
|
|
238
238
|
declare function renameRules(rules: Record<string, any>, from: string, to: string): {
|
|
239
239
|
[k: string]: any;
|
|
240
240
|
};
|
|
241
|
+
declare function toArray<T>(value: T | T[]): T[];
|
|
241
242
|
|
|
242
243
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
243
244
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -261,4 +262,4 @@ declare const GLOB_TESTS: string[];
|
|
|
261
262
|
declare const GLOB_ALL_SRC: string[];
|
|
262
263
|
declare const GLOB_EXCLUDE: string[];
|
|
263
264
|
|
|
264
|
-
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, StylisticOverridesConfig, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, renameRules, sortKeys, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, yaml };
|
|
265
|
+
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, StylisticOverridesConfig, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, renameRules, sortKeys, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, vue, yaml };
|
package/dist/index.js
CHANGED
|
@@ -947,14 +947,16 @@ function renameRules(rules, from, to) {
|
|
|
947
947
|
})
|
|
948
948
|
);
|
|
949
949
|
}
|
|
950
|
+
function toArray(value) {
|
|
951
|
+
return Array.isArray(value) ? value : [value];
|
|
952
|
+
}
|
|
950
953
|
|
|
951
954
|
// src/configs/typescript.ts
|
|
952
955
|
function typescript(options) {
|
|
953
956
|
const {
|
|
954
957
|
componentExts = [],
|
|
955
958
|
overrides = {},
|
|
956
|
-
parserOptions = {}
|
|
957
|
-
tsconfigPath
|
|
959
|
+
parserOptions = {}
|
|
958
960
|
} = options ?? {};
|
|
959
961
|
const typeAwareRules = {
|
|
960
962
|
"dot-notation": "off",
|
|
@@ -977,6 +979,7 @@ function typescript(options) {
|
|
|
977
979
|
"ts/restrict-template-expressions": "error",
|
|
978
980
|
"ts/unbound-method": "error"
|
|
979
981
|
};
|
|
982
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
980
983
|
return [
|
|
981
984
|
{
|
|
982
985
|
// Install the plugins without globs, so they can be configured separately.
|
|
@@ -997,7 +1000,7 @@ function typescript(options) {
|
|
|
997
1000
|
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
998
1001
|
sourceType: "module",
|
|
999
1002
|
...tsconfigPath ? {
|
|
1000
|
-
project:
|
|
1003
|
+
project: tsconfigPath,
|
|
1001
1004
|
tsconfigRootDir: process.cwd()
|
|
1002
1005
|
} : {},
|
|
1003
1006
|
...parserOptions
|
|
@@ -1513,6 +1516,7 @@ export {
|
|
|
1513
1516
|
sortTsconfig,
|
|
1514
1517
|
stylistic,
|
|
1515
1518
|
test,
|
|
1519
|
+
toArray,
|
|
1516
1520
|
typescript,
|
|
1517
1521
|
unicorn,
|
|
1518
1522
|
vue,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lincy/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.6.0",
|
|
5
5
|
"packageManager": "pnpm@8.7.6",
|
|
6
6
|
"description": "LinCenYing's ESLint config",
|
|
7
7
|
"author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@antfu/eslint-define-config": "1.23.0-2",
|
|
43
43
|
"@stylistic/eslint-plugin": "0.1.2",
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "^6.9.
|
|
45
|
-
"@typescript-eslint/parser": "^6.9.
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
|
45
|
+
"@typescript-eslint/parser": "^6.9.1",
|
|
46
46
|
"eslint-config-flat-gitignore": "^0.1.1",
|
|
47
47
|
"eslint-plugin-antfu": "^1.0.1",
|
|
48
48
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@lincy/eslint-config": "workspace:*",
|
|
70
70
|
"@stylistic/eslint-plugin-migrate": "^0.1.2",
|
|
71
71
|
"@types/eslint": "^8.44.6",
|
|
72
|
-
"@types/node": "^20.8.
|
|
72
|
+
"@types/node": "^20.8.10",
|
|
73
73
|
"bumpp": "^9.2.0",
|
|
74
74
|
"eslint": "^8.52.0",
|
|
75
75
|
"eslint-flat-config-viewer": "^0.1.0",
|