@wongxy/eslint-config 0.0.28 → 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 +60 -35
- package/dist/index.js +60 -35
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -24,50 +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
|
+
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
|
+
];
|
|
27
40
|
function wongxy(options = {}, ...userConfigs) {
|
|
28
|
-
const finalOptions = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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: {
|
|
47
63
|
"vue/singleline-html-element-content-newline": "off",
|
|
48
64
|
"vue/valid-template-root": "off",
|
|
49
65
|
"vue/block-order": ["warn", { order: [["script", "template"], "style"] }],
|
|
50
|
-
"vue/custom-event-name-casing": "off"
|
|
66
|
+
"vue/custom-event-name-casing": "off",
|
|
67
|
+
...vue.overrides
|
|
51
68
|
}
|
|
52
|
-
}
|
|
69
|
+
};
|
|
53
70
|
}
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
|
59
78
|
}
|
|
60
|
-
}
|
|
79
|
+
};
|
|
61
80
|
}
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"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
|
|
68
92
|
}
|
|
69
|
-
}
|
|
93
|
+
};
|
|
70
94
|
}
|
|
71
|
-
|
|
95
|
+
delete finalOptions.reactnative;
|
|
96
|
+
return (0, import_eslint_config.antfu)(finalOptions, ...userConfigs);
|
|
72
97
|
}
|
|
73
98
|
var src_default = wongxy;
|
package/dist/index.js
CHANGED
|
@@ -1,50 +1,75 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { antfu } from "@antfu/eslint-config";
|
|
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
|
+
];
|
|
3
16
|
function wongxy(options = {}, ...userConfigs) {
|
|
4
|
-
const finalOptions = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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: {
|
|
23
39
|
"vue/singleline-html-element-content-newline": "off",
|
|
24
40
|
"vue/valid-template-root": "off",
|
|
25
41
|
"vue/block-order": ["warn", { order: [["script", "template"], "style"] }],
|
|
26
|
-
"vue/custom-event-name-casing": "off"
|
|
42
|
+
"vue/custom-event-name-casing": "off",
|
|
43
|
+
...vue.overrides
|
|
27
44
|
}
|
|
28
|
-
}
|
|
45
|
+
};
|
|
29
46
|
}
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
35
54
|
}
|
|
36
|
-
}
|
|
55
|
+
};
|
|
37
56
|
}
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"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
|
|
44
68
|
}
|
|
45
|
-
}
|
|
69
|
+
};
|
|
46
70
|
}
|
|
47
|
-
|
|
71
|
+
delete finalOptions.reactnative;
|
|
72
|
+
return antfu(finalOptions, ...userConfigs);
|
|
48
73
|
}
|
|
49
74
|
var src_default = wongxy;
|
|
50
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,7 +23,8 @@
|
|
|
23
23
|
"eslint-plugin-react-refresh": "^0.4.4"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@antfu/eslint-config": "^2.24.1"
|
|
26
|
+
"@antfu/eslint-config": "^2.24.1",
|
|
27
|
+
"local-pkg": "^0.5.0"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@types/eslint": "^9.6.0",
|