@wongxy/eslint-config 0.0.27 → 1.0.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/dist/index.cjs +64 -38
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +64 -38
- package/package.json +7 -6
package/dist/index.cjs
CHANGED
|
@@ -24,49 +24,75 @@ __export(src_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(src_exports);
|
|
26
26
|
var import_eslint_config = require("@antfu/eslint-config");
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
27
|
+
var import_local_pkg = require("local-pkg");
|
|
28
|
+
var VuePackages = [
|
|
29
|
+
"vue",
|
|
30
|
+
"nuxt",
|
|
31
|
+
"vitepress",
|
|
32
|
+
"@slidev/cli"
|
|
33
|
+
];
|
|
34
|
+
var ReactPackages = [
|
|
35
|
+
"react",
|
|
36
|
+
"react-native",
|
|
37
|
+
"react-dom",
|
|
38
|
+
"next"
|
|
39
|
+
];
|
|
40
|
+
function wongxy(options = {}, ...userConfigs) {
|
|
41
|
+
const finalOptions = {
|
|
42
|
+
...options,
|
|
43
|
+
vue: options.vue ?? VuePackages.some((i) => (0, import_local_pkg.isPackageExists)(i)),
|
|
44
|
+
typescript: options.typescript ?? (0, import_local_pkg.isPackageExists)("typescript"),
|
|
45
|
+
react: (options.react || options.reactnative) ?? ReactPackages.some((i) => (0, import_local_pkg.isPackageExists)(i)),
|
|
46
|
+
reactnative: options.reactnative ?? (0, import_local_pkg.isPackageExists)("react-native")
|
|
47
|
+
};
|
|
48
|
+
finalOptions.rules = {
|
|
49
|
+
"no-console": "off",
|
|
50
|
+
"no-alert": "off",
|
|
51
|
+
"no-multiple-empty-lines": "warn",
|
|
52
|
+
"antfu/top-level-function": "off",
|
|
53
|
+
"antfu/if-newline": "off",
|
|
54
|
+
"import/order": ["error", { "newlines-between": "always" }],
|
|
55
|
+
"style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
|
|
56
|
+
...finalOptions.rules
|
|
57
|
+
};
|
|
58
|
+
if (finalOptions.vue) {
|
|
59
|
+
const vue = typeof finalOptions.vue === "object" ? finalOptions.vue : {};
|
|
60
|
+
finalOptions.vue = {
|
|
61
|
+
...vue,
|
|
62
|
+
overrides: {
|
|
52
63
|
"vue/singleline-html-element-content-newline": "off",
|
|
53
64
|
"vue/valid-template-root": "off",
|
|
54
|
-
"vue/block-order": ["warn", {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
"vue/block-order": ["warn", { order: [["script", "template"], "style"] }],
|
|
66
|
+
"vue/custom-event-name-casing": "off",
|
|
67
|
+
...vue.overrides
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (finalOptions.react) {
|
|
72
|
+
const react = typeof finalOptions.react === "object" ? finalOptions.react : {};
|
|
73
|
+
finalOptions.react = {
|
|
74
|
+
...react,
|
|
75
|
+
overrides: {
|
|
76
|
+
"react/prefer-destructuring-assignment": "off",
|
|
77
|
+
...react.overrides
|
|
58
78
|
}
|
|
59
|
-
}
|
|
79
|
+
};
|
|
60
80
|
}
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"ts/
|
|
81
|
+
if (finalOptions.typescript) {
|
|
82
|
+
const typescript = typeof finalOptions.typescript === "object" ? finalOptions.typescript : {};
|
|
83
|
+
finalOptions.typescript = {
|
|
84
|
+
...typescript,
|
|
85
|
+
overrides: {
|
|
86
|
+
"ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, fixStyle: "inline-type-imports", prefer: "type-imports" }],
|
|
87
|
+
...finalOptions.reactnative ? {
|
|
88
|
+
"ts/no-require-imports": "off",
|
|
89
|
+
"ts/no-use-before-define": "off"
|
|
90
|
+
} : void 0,
|
|
91
|
+
...typescript.overrides
|
|
67
92
|
}
|
|
68
|
-
}
|
|
93
|
+
};
|
|
69
94
|
}
|
|
70
|
-
|
|
95
|
+
delete finalOptions.reactnative;
|
|
96
|
+
return (0, import_eslint_config.antfu)(finalOptions, ...userConfigs);
|
|
71
97
|
}
|
|
72
98
|
var src_default = wongxy;
|
package/dist/index.d.cts
CHANGED
|
@@ -4,6 +4,6 @@ import { FlatConfigComposer } from 'eslint-flat-config-utils';
|
|
|
4
4
|
|
|
5
5
|
declare function wongxy(options?: OptionsConfig & TypedFlatConfigItem & {
|
|
6
6
|
reactnative?: boolean;
|
|
7
|
-
}, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.
|
|
7
|
+
}, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
8
8
|
|
|
9
9
|
export { wongxy as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ import { FlatConfigComposer } from 'eslint-flat-config-utils';
|
|
|
4
4
|
|
|
5
5
|
declare function wongxy(options?: OptionsConfig & TypedFlatConfigItem & {
|
|
6
6
|
reactnative?: boolean;
|
|
7
|
-
}, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.
|
|
7
|
+
}, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
8
8
|
|
|
9
9
|
export { wongxy as default };
|
package/dist/index.js
CHANGED
|
@@ -1,49 +1,75 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { antfu } from "@antfu/eslint-config";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
3
|
+
import { isPackageExists } from "local-pkg";
|
|
4
|
+
var VuePackages = [
|
|
5
|
+
"vue",
|
|
6
|
+
"nuxt",
|
|
7
|
+
"vitepress",
|
|
8
|
+
"@slidev/cli"
|
|
9
|
+
];
|
|
10
|
+
var ReactPackages = [
|
|
11
|
+
"react",
|
|
12
|
+
"react-native",
|
|
13
|
+
"react-dom",
|
|
14
|
+
"next"
|
|
15
|
+
];
|
|
16
|
+
function wongxy(options = {}, ...userConfigs) {
|
|
17
|
+
const finalOptions = {
|
|
18
|
+
...options,
|
|
19
|
+
vue: options.vue ?? VuePackages.some((i) => isPackageExists(i)),
|
|
20
|
+
typescript: options.typescript ?? isPackageExists("typescript"),
|
|
21
|
+
react: (options.react || options.reactnative) ?? ReactPackages.some((i) => isPackageExists(i)),
|
|
22
|
+
reactnative: options.reactnative ?? isPackageExists("react-native")
|
|
23
|
+
};
|
|
24
|
+
finalOptions.rules = {
|
|
25
|
+
"no-console": "off",
|
|
26
|
+
"no-alert": "off",
|
|
27
|
+
"no-multiple-empty-lines": "warn",
|
|
28
|
+
"antfu/top-level-function": "off",
|
|
29
|
+
"antfu/if-newline": "off",
|
|
30
|
+
"import/order": ["error", { "newlines-between": "always" }],
|
|
31
|
+
"style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
|
|
32
|
+
...finalOptions.rules
|
|
33
|
+
};
|
|
34
|
+
if (finalOptions.vue) {
|
|
35
|
+
const vue = typeof finalOptions.vue === "object" ? finalOptions.vue : {};
|
|
36
|
+
finalOptions.vue = {
|
|
37
|
+
...vue,
|
|
38
|
+
overrides: {
|
|
28
39
|
"vue/singleline-html-element-content-newline": "off",
|
|
29
40
|
"vue/valid-template-root": "off",
|
|
30
|
-
"vue/block-order": ["warn", {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
"vue/block-order": ["warn", { order: [["script", "template"], "style"] }],
|
|
42
|
+
"vue/custom-event-name-casing": "off",
|
|
43
|
+
...vue.overrides
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (finalOptions.react) {
|
|
48
|
+
const react = typeof finalOptions.react === "object" ? finalOptions.react : {};
|
|
49
|
+
finalOptions.react = {
|
|
50
|
+
...react,
|
|
51
|
+
overrides: {
|
|
52
|
+
"react/prefer-destructuring-assignment": "off",
|
|
53
|
+
...react.overrides
|
|
34
54
|
}
|
|
35
|
-
}
|
|
55
|
+
};
|
|
36
56
|
}
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"ts/
|
|
57
|
+
if (finalOptions.typescript) {
|
|
58
|
+
const typescript = typeof finalOptions.typescript === "object" ? finalOptions.typescript : {};
|
|
59
|
+
finalOptions.typescript = {
|
|
60
|
+
...typescript,
|
|
61
|
+
overrides: {
|
|
62
|
+
"ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, fixStyle: "inline-type-imports", prefer: "type-imports" }],
|
|
63
|
+
...finalOptions.reactnative ? {
|
|
64
|
+
"ts/no-require-imports": "off",
|
|
65
|
+
"ts/no-use-before-define": "off"
|
|
66
|
+
} : void 0,
|
|
67
|
+
...typescript.overrides
|
|
43
68
|
}
|
|
44
|
-
}
|
|
69
|
+
};
|
|
45
70
|
}
|
|
46
|
-
|
|
71
|
+
delete finalOptions.reactnative;
|
|
72
|
+
return antfu(finalOptions, ...userConfigs);
|
|
47
73
|
}
|
|
48
74
|
var src_default = wongxy;
|
|
49
75
|
export {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wongxy/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"description": "xiyaowong's eslint config",
|
|
6
6
|
"author": "xiyaowong (https://github.com/xiyaowong)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -23,14 +23,15 @@
|
|
|
23
23
|
"eslint-plugin-react-refresh": "^0.4.4"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@antfu/eslint-config": "^2.
|
|
26
|
+
"@antfu/eslint-config": "^2.24.1",
|
|
27
|
+
"local-pkg": "^0.5.0"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"@types/eslint": "^
|
|
30
|
-
"bumpp": "^9.4.
|
|
31
|
-
"eslint": "^9.
|
|
30
|
+
"@types/eslint": "^9.6.0",
|
|
31
|
+
"bumpp": "^9.4.2",
|
|
32
|
+
"eslint": "^9.8.0",
|
|
32
33
|
"eslint-flat-config-viewer": "^0.1.20",
|
|
33
|
-
"tsup": "^8.2.
|
|
34
|
+
"tsup": "^8.2.4",
|
|
34
35
|
"typescript": "5.4.5"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|