@vp-tw/eslint-config 0.0.14 → 0.0.16
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/configs/mdx.d.ts +3 -2
- package/dist/configs/mdx.js +22 -60
- package/dist/configs/prettier.d.ts +2 -1
- package/dist/configs/prettier.js +8 -24
- package/dist/configs/storybook.d.ts +6 -6
- package/dist/configs/storybook.js +20 -42
- package/dist/esm/configs/mdx.d.ts +3 -2
- package/dist/esm/configs/mdx.mjs +34 -76
- package/dist/esm/configs/prettier.d.ts +2 -1
- package/dist/esm/configs/prettier.mjs +13 -24
- package/dist/esm/configs/storybook.d.ts +6 -6
- package/dist/esm/configs/storybook.mjs +30 -45
- package/dist/esm/extends/_utils.d.ts +1 -1
- package/dist/esm/extends/_utils.mjs +1 -1
- package/dist/esm/extends/imports.d.ts +3 -3
- package/dist/esm/extends/imports.mjs +55 -66
- package/dist/esm/extends/javascript.d.ts +4 -3
- package/dist/esm/extends/javascript.mjs +30 -41
- package/dist/esm/extends/jsonc.d.ts +6 -6
- package/dist/esm/extends/jsonc.mjs +50 -118
- package/dist/esm/extends/react.d.ts +10 -3
- package/dist/esm/extends/react.mjs +39 -45
- package/dist/esm/extends/typescript.d.ts +4 -3
- package/dist/esm/extends/typescript.mjs +37 -48
- package/dist/esm/extends/yaml.d.ts +4 -4
- package/dist/esm/extends/yaml.mjs +23 -47
- package/dist/extends/_utils.d.ts +1 -1
- package/dist/extends/_utils.js +1 -1
- package/dist/extends/imports.d.ts +3 -3
- package/dist/extends/imports.js +38 -52
- package/dist/extends/javascript.d.ts +4 -3
- package/dist/extends/javascript.js +26 -37
- package/dist/extends/jsonc.d.ts +6 -6
- package/dist/extends/jsonc.js +29 -101
- package/dist/extends/react.d.ts +10 -3
- package/dist/extends/react.js +28 -43
- package/dist/extends/typescript.d.ts +4 -3
- package/dist/extends/typescript.js +35 -46
- package/dist/extends/yaml.d.ts +4 -4
- package/dist/extends/yaml.js +28 -52
- package/package.json +22 -4
package/dist/extends/react.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import type { ConfigNames, TypedFlatConfigItem } from "@antfu/eslint-config";
|
|
|
2
2
|
import type { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
3
3
|
import type { ConfigOverrides, ResolveConfigNamesMap } from "../types";
|
|
4
4
|
declare const configNamesMapSource: {
|
|
5
|
-
readonly
|
|
5
|
+
readonly react: "vdustr/react/rules";
|
|
6
|
+
readonly reactCompilerSetup: "vdustr/react/react-compiler/setup";
|
|
7
|
+
readonly reactCompilerRules: "vdustr/react/react-compiler/rules";
|
|
6
8
|
};
|
|
7
9
|
declare module "../types" {
|
|
8
10
|
interface ConfigNamesMap extends ResolveConfigNamesMap<react.ConfigNamesMapSource> {
|
|
@@ -10,12 +12,17 @@ declare module "../types" {
|
|
|
10
12
|
}
|
|
11
13
|
declare namespace react {
|
|
12
14
|
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
13
|
-
interface Options
|
|
15
|
+
interface Options {
|
|
16
|
+
react?: ConfigOverrides;
|
|
17
|
+
reactCompilerSetup?: ConfigOverrides;
|
|
18
|
+
reactCompilerRules?: ConfigOverrides;
|
|
14
19
|
}
|
|
15
20
|
}
|
|
16
21
|
declare const react: ((composer: FlatConfigComposer<TypedFlatConfigItem, ConfigNames>, options?: react.Options) => void) & {
|
|
17
22
|
configNamesMapSource: {
|
|
18
|
-
readonly
|
|
23
|
+
readonly react: "vdustr/react/rules";
|
|
24
|
+
readonly reactCompilerSetup: "vdustr/react/react-compiler/setup";
|
|
25
|
+
readonly reactCompilerRules: "vdustr/react/react-compiler/rules";
|
|
19
26
|
};
|
|
20
27
|
};
|
|
21
28
|
export { react };
|
package/dist/extends/react.js
CHANGED
|
@@ -4,56 +4,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.react = void 0;
|
|
7
|
+
var _defu = _interopRequireDefault(require("defu"));
|
|
7
8
|
var _esToolkit = require("es-toolkit");
|
|
8
9
|
var _eslintPluginReactCompiler = require("../lib/eslint-plugin-react-compiler");
|
|
9
10
|
var _extendsConfig = require("../utils/extendsConfig");
|
|
10
11
|
var _utils = require("./_utils");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
13
|
const configNamesMapSource = {
|
|
12
|
-
|
|
14
|
+
react: "vdustr/react/rules",
|
|
15
|
+
reactCompilerSetup: "vdustr/react/react-compiler/setup",
|
|
16
|
+
reactCompilerRules: "vdustr/react/react-compiler/rules"
|
|
13
17
|
};
|
|
14
18
|
const reactInternal = (composer, options) => {
|
|
15
|
-
(0, _extendsConfig.extendsConfig)(composer, "antfu/react/rules", async config =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Overridable.
|
|
40
|
-
*/
|
|
41
|
-
...options,
|
|
42
|
-
rules: {
|
|
43
|
-
/**
|
|
44
|
-
* Default.
|
|
45
|
-
*/
|
|
46
|
-
"react-compiler/react-compiler": "error",
|
|
47
|
-
/**
|
|
48
|
-
* Not all destructuring assignments are more readable than their alternatives.
|
|
49
|
-
*/
|
|
50
|
-
"react/prefer-destructuring-assignment": "off",
|
|
51
|
-
/**
|
|
52
|
-
* Overridable.
|
|
53
|
-
*/
|
|
54
|
-
...options?.rules
|
|
55
|
-
}
|
|
56
|
-
}]);
|
|
19
|
+
(0, _extendsConfig.extendsConfig)(composer, "antfu/react/rules", async config => {
|
|
20
|
+
const modifiedConfig = (0, _defu.default)((0, _esToolkit.pick)(options?.react ?? {}, ["files", "ignores"]), config);
|
|
21
|
+
const omittedConfig = (0, _esToolkit.omit)(modifiedConfig, _utils.ignoreKeys);
|
|
22
|
+
const rulesConfig = (0, _defu.default)((0, _esToolkit.omit)(options?.react ?? {}, ["files", "ignores"]), {
|
|
23
|
+
name: configNamesMapSource.react,
|
|
24
|
+
rules: {
|
|
25
|
+
"react/prefer-destructuring-assignment": "off"
|
|
26
|
+
}
|
|
27
|
+
}, omittedConfig);
|
|
28
|
+
const reactCompilerSetupConfig = (0, _defu.default)(options?.reactCompilerSetup, {
|
|
29
|
+
name: configNamesMapSource.reactCompilerSetup,
|
|
30
|
+
plugins: {
|
|
31
|
+
"react-compiler": await (0, _eslintPluginReactCompiler.reactCompiler)()
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const reactCompilerRulesConfig = (0, _defu.default)(options?.reactCompilerRules, {
|
|
35
|
+
name: configNamesMapSource.reactCompilerRules,
|
|
36
|
+
rules: {
|
|
37
|
+
"react-compiler/react-compiler": "error"
|
|
38
|
+
}
|
|
39
|
+
}, omittedConfig);
|
|
40
|
+
return [modifiedConfig, rulesConfig, reactCompilerSetupConfig, reactCompilerRulesConfig];
|
|
41
|
+
});
|
|
57
42
|
};
|
|
58
43
|
const react = exports.react = Object.assign(reactInternal, {
|
|
59
44
|
configNamesMapSource
|
|
@@ -2,7 +2,7 @@ import type { ConfigNames, TypedFlatConfigItem } from "@antfu/eslint-config";
|
|
|
2
2
|
import type { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
3
3
|
import type { ConfigOverrides, ResolveConfigNamesMap } from "../types";
|
|
4
4
|
declare const configNamesMapSource: {
|
|
5
|
-
readonly
|
|
5
|
+
readonly typescript: "vdustr/typescript/rules";
|
|
6
6
|
};
|
|
7
7
|
declare module "../types" {
|
|
8
8
|
interface ConfigNamesMap extends ResolveConfigNamesMap<typescript.ConfigNamesMapSource> {
|
|
@@ -10,12 +10,13 @@ declare module "../types" {
|
|
|
10
10
|
}
|
|
11
11
|
declare namespace typescript {
|
|
12
12
|
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
13
|
-
interface Options
|
|
13
|
+
interface Options {
|
|
14
|
+
typescript?: ConfigOverrides;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
declare const typescript: ((composer: FlatConfigComposer<TypedFlatConfigItem, ConfigNames>, options?: typescript.Options) => void) & {
|
|
17
18
|
configNamesMapSource: {
|
|
18
|
-
readonly
|
|
19
|
+
readonly typescript: "vdustr/typescript/rules";
|
|
19
20
|
};
|
|
20
21
|
};
|
|
21
22
|
export { typescript };
|
|
@@ -4,58 +4,47 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.typescript = void 0;
|
|
7
|
+
var _defu = _interopRequireDefault(require("defu"));
|
|
7
8
|
var _esToolkit = require("es-toolkit");
|
|
8
9
|
var _extendsConfig = require("../utils/extendsConfig");
|
|
9
10
|
var _utils = require("./_utils");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
12
|
const configNamesMapSource = {
|
|
11
|
-
|
|
13
|
+
typescript: "vdustr/typescript/rules"
|
|
12
14
|
};
|
|
13
15
|
const typescriptInternal = (composer, options) => {
|
|
14
|
-
(0, _extendsConfig.extendsConfig)(composer, "antfu/typescript/rules", config =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
*/
|
|
47
|
-
"ts/no-namespace": "off",
|
|
48
|
-
"ts/no-redeclare": "off",
|
|
49
|
-
/**
|
|
50
|
-
* Check for unused variables in TypeScript.
|
|
51
|
-
*/
|
|
52
|
-
"ts/no-unused-vars": "off",
|
|
53
|
-
/**
|
|
54
|
-
* Overridable.
|
|
55
|
-
*/
|
|
56
|
-
...options?.rules
|
|
57
|
-
}
|
|
58
|
-
}]);
|
|
16
|
+
(0, _extendsConfig.extendsConfig)(composer, "antfu/typescript/rules", config => {
|
|
17
|
+
const modifiedConfig = (0, _defu.default)((0, _esToolkit.pick)(options?.typescript ?? {}, ["files", "ignores"]), config);
|
|
18
|
+
const omittedConfig = (0, _esToolkit.omit)(modifiedConfig, _utils.ignoreKeys);
|
|
19
|
+
const rulesConfig = (0, _defu.default)((0, _esToolkit.omit)(options?.typescript ?? {}, ["files", "ignores"]), {
|
|
20
|
+
name: configNamesMapSource.typescript,
|
|
21
|
+
rules: {
|
|
22
|
+
/**
|
|
23
|
+
* Use `Array<T>` instead of `T[]` for better DX.
|
|
24
|
+
*
|
|
25
|
+
* - [Array<T> vs T[]: Which is better?](https://www.totaltypescript.com/array-types-in-typescript)
|
|
26
|
+
* - [Array Types in TypeScript](https://tkdodo.eu/blog/array-types-in-type-script)
|
|
27
|
+
*/
|
|
28
|
+
"ts/array-type": ["error", {
|
|
29
|
+
default: "generic"
|
|
30
|
+
}],
|
|
31
|
+
/**
|
|
32
|
+
* Namespaces are useful for centralizing the management of types. Just avoid
|
|
33
|
+
* overusing them with runtime code.
|
|
34
|
+
*
|
|
35
|
+
* - References:
|
|
36
|
+
* - <https://x.com/mattpocockuk/status/1805606072167940167>
|
|
37
|
+
*/
|
|
38
|
+
"ts/no-namespace": "off",
|
|
39
|
+
"ts/no-redeclare": "off",
|
|
40
|
+
/**
|
|
41
|
+
* Check for unused variables in TypeScript.
|
|
42
|
+
*/
|
|
43
|
+
"ts/no-unused-vars": "off"
|
|
44
|
+
}
|
|
45
|
+
}, omittedConfig);
|
|
46
|
+
return [modifiedConfig, rulesConfig];
|
|
47
|
+
});
|
|
59
48
|
};
|
|
60
49
|
const typescript = exports.typescript = Object.assign(typescriptInternal, {
|
|
61
50
|
configNamesMapSource
|
package/dist/extends/yaml.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { ConfigNames, TypedFlatConfigItem } from "@antfu/eslint-config";
|
|
|
2
2
|
import type { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
3
3
|
import type { ConfigOverrides, ResolveConfigNamesMap } from "../types";
|
|
4
4
|
declare const configNamesMapSource: {
|
|
5
|
-
readonly
|
|
6
|
-
readonly sortKeys: "vdustr/yaml/
|
|
5
|
+
readonly yaml: "vdustr/yaml/rules";
|
|
6
|
+
readonly sortKeys: "vdustr/yaml/sort-keys/rules";
|
|
7
7
|
};
|
|
8
8
|
declare module "../types" {
|
|
9
9
|
interface ConfigNamesMap extends ResolveConfigNamesMap<yaml.ConfigNamesMapSource> {
|
|
@@ -18,8 +18,8 @@ declare namespace yaml {
|
|
|
18
18
|
}
|
|
19
19
|
declare const yaml: ((composer: FlatConfigComposer<TypedFlatConfigItem, ConfigNames>, options?: yaml.Options) => void) & {
|
|
20
20
|
configNamesMapSource: {
|
|
21
|
-
readonly
|
|
22
|
-
readonly sortKeys: "vdustr/yaml/
|
|
21
|
+
readonly yaml: "vdustr/yaml/rules";
|
|
22
|
+
readonly sortKeys: "vdustr/yaml/sort-keys/rules";
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
export { yaml };
|
package/dist/extends/yaml.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.yaml = void 0;
|
|
7
|
+
var _defu = _interopRequireDefault(require("defu"));
|
|
7
8
|
var _esToolkit = require("es-toolkit");
|
|
8
9
|
var _eslintPluginYml = _interopRequireDefault(require("eslint-plugin-yml"));
|
|
9
10
|
var _globs = require("../globs");
|
|
@@ -12,61 +13,36 @@ var _renameRules = require("../utils/renameRules");
|
|
|
12
13
|
var _utils = require("./_utils");
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
15
|
const configNamesMapSource = {
|
|
15
|
-
|
|
16
|
-
sortKeys: "vdustr/yaml/
|
|
16
|
+
yaml: "vdustr/yaml/rules",
|
|
17
|
+
sortKeys: "vdustr/yaml/sort-keys/rules"
|
|
17
18
|
};
|
|
18
19
|
const yamlInternal = (composer, options) => {
|
|
19
|
-
(0, _extendsConfig.extendsConfig)(composer, "antfu/yaml/rules", config =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* Default.
|
|
26
|
-
*/
|
|
27
|
-
name: configNamesMapSource.rules,
|
|
28
|
-
/**
|
|
29
|
-
* Overridable.
|
|
30
|
-
*/
|
|
31
|
-
...options,
|
|
32
|
-
rules: {
|
|
33
|
-
/**
|
|
34
|
-
* Inherited from `eslint-plugin-yml`.
|
|
35
|
-
*/
|
|
36
|
-
...(0, _renameRules.renameRules)({
|
|
20
|
+
(0, _extendsConfig.extendsConfig)(composer, "antfu/yaml/rules", config => {
|
|
21
|
+
const modifiedConfig = (0, _defu.default)((0, _esToolkit.pick)(options?.yaml ?? {}, ["files", "ignores"]), config);
|
|
22
|
+
const omittedConfig = (0, _esToolkit.omit)(modifiedConfig, _utils.ignoreKeys);
|
|
23
|
+
const rulesConfig = (0, _defu.default)((0, _esToolkit.omit)(options?.yaml ?? {}, ["files", "ignores"]), {
|
|
24
|
+
name: configNamesMapSource.yaml,
|
|
25
|
+
rules: (0, _renameRules.renameRules)({
|
|
37
26
|
...Object.fromEntries([..._eslintPluginYml.default.configs["flat/recommended"].flatMap(config2 => Object.entries(config2.rules ?? {})), ..._eslintPluginYml.default.configs["flat/prettier"].flatMap(config2 => Object.entries(config2.rules ?? {}))])
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
files: [_globs.GLOB_PNPM_WORKSPACE_YAML, ...(options?.sortKeys?.files ?? [])],
|
|
58
|
-
rules: {
|
|
59
|
-
"yaml/sort-keys": ["error", {
|
|
60
|
-
pathPattern: ".*",
|
|
61
|
-
order: {
|
|
62
|
-
type: "asc",
|
|
63
|
-
caseSensitive: false,
|
|
64
|
-
natural: true
|
|
65
|
-
}
|
|
66
|
-
}],
|
|
67
|
-
...options?.sortKeys?.rules
|
|
68
|
-
}
|
|
69
|
-
}]);
|
|
27
|
+
})
|
|
28
|
+
}, omittedConfig);
|
|
29
|
+
const sortKeysConfig = (0, _defu.default)(options?.sortKeys, {
|
|
30
|
+
...(0, _esToolkit.omit)(omittedConfig, ["files", "ignores"]),
|
|
31
|
+
name: configNamesMapSource.sortKeys,
|
|
32
|
+
files: [_globs.GLOB_PNPM_WORKSPACE_YAML],
|
|
33
|
+
rules: {
|
|
34
|
+
"yaml/sort-keys": ["error", {
|
|
35
|
+
pathPattern: ".*",
|
|
36
|
+
order: {
|
|
37
|
+
type: "asc",
|
|
38
|
+
caseSensitive: false,
|
|
39
|
+
natural: true
|
|
40
|
+
}
|
|
41
|
+
}]
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return [modifiedConfig, rulesConfig, sortKeysConfig];
|
|
45
|
+
});
|
|
70
46
|
};
|
|
71
47
|
const yaml = exports.yaml = Object.assign(yamlInternal, {
|
|
72
48
|
configNamesMapSource
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vp-tw/eslint-config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "ViPro's ESLint configuration",
|
|
5
5
|
"homepage": "https://github.com/vdustr/eslint-config",
|
|
6
6
|
"author": {
|
|
@@ -41,19 +41,37 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@mui/types": "^7.2.21",
|
|
43
43
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
44
|
+
"defu": "^6.1.4",
|
|
44
45
|
"es-toolkit": "^1.31.0",
|
|
45
46
|
"eslint-config-prettier": "^10.0.1",
|
|
46
47
|
"eslint-flat-config-utils": "^2.0.0",
|
|
47
|
-
"eslint-plugin-package-json": "^0.21.1",
|
|
48
48
|
"local-pkg": "^1.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@antfu/eslint-config": "^4.1.0",
|
|
52
51
|
"eslint-typegen": "^1.0.0",
|
|
53
52
|
"unbuild": "^3.3.1"
|
|
54
53
|
},
|
|
55
54
|
"peerDependencies": {
|
|
56
|
-
"@antfu/eslint-config": "^4.1.0"
|
|
55
|
+
"@antfu/eslint-config": "^4.1.0",
|
|
56
|
+
"eslint": "^9.19.0",
|
|
57
|
+
"eslint-plugin-mdx": "^3.1.5",
|
|
58
|
+
"eslint-plugin-package-json": "^0.21.1",
|
|
59
|
+
"eslint-plugin-react-compiler": "^19.0.0-beta-27714ef-20250124",
|
|
60
|
+
"eslint-plugin-storybook": "^0.11.2"
|
|
61
|
+
},
|
|
62
|
+
"peerDependenciesMeta": {
|
|
63
|
+
"eslint-mdx": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"eslint-plugin-package-json": {
|
|
67
|
+
"optional": true
|
|
68
|
+
},
|
|
69
|
+
"eslint-plugin-react-compiler": {
|
|
70
|
+
"optional": true
|
|
71
|
+
},
|
|
72
|
+
"eslint-plugin-storybook": {
|
|
73
|
+
"optional": true
|
|
74
|
+
}
|
|
57
75
|
},
|
|
58
76
|
"publishConfig": {
|
|
59
77
|
"access": "public"
|