@wongxy/eslint-config 0.0.13 → 0.0.15
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 +13 -0
- package/dist/cli.cjs +52 -7
- package/dist/cli.js +52 -7
- package/dist/index.cjs +3 -0
- package/dist/index.js +3 -0
- package/package.json +8 -8
package/README.md
ADDED
package/dist/cli.cjs
CHANGED
|
@@ -46,22 +46,20 @@ var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
|
|
|
46
46
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
47
47
|
|
|
48
48
|
// package.json
|
|
49
|
-
var version = "0.0.
|
|
49
|
+
var version = "0.0.15";
|
|
50
50
|
var devDependencies = {
|
|
51
51
|
"@antfu/eslint-config": "^2.6.4",
|
|
52
|
-
"@types/eslint": "^8.56.
|
|
52
|
+
"@types/eslint": "^8.56.5",
|
|
53
53
|
"@types/prompts": "^2.4.9",
|
|
54
54
|
"@types/yargs": "^17.0.32",
|
|
55
55
|
bumpp: "^9.3.0",
|
|
56
56
|
eslint: "^8.57.0",
|
|
57
|
-
"eslint-
|
|
58
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
59
|
-
"eslint-plugin-react-refresh": "^0.4.5",
|
|
57
|
+
"eslint-flat-config-viewer": "^0.1.11",
|
|
60
58
|
"parse-gitignore": "^2.0.0",
|
|
61
59
|
picocolors: "^1.0.0",
|
|
62
60
|
prompts: "^2.4.2",
|
|
63
61
|
tsup: "^8.0.2",
|
|
64
|
-
typescript: "5.
|
|
62
|
+
typescript: "5.3.3",
|
|
65
63
|
yargs: "^17.7.2"
|
|
66
64
|
};
|
|
67
65
|
|
|
@@ -170,8 +168,55 @@ async function run(options = {}) {
|
|
|
170
168
|
eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
|
|
171
169
|
}
|
|
172
170
|
}
|
|
171
|
+
const configs = [];
|
|
172
|
+
if (eslintIgnores.length)
|
|
173
|
+
configs.push(` ignores: ${JSON.stringify(eslintIgnores)},`);
|
|
174
|
+
if (!SKIP_PROMPT) {
|
|
175
|
+
let enableReactNativeRulesPrompt = {
|
|
176
|
+
enableReactNativeRules: false
|
|
177
|
+
};
|
|
178
|
+
try {
|
|
179
|
+
enableReactNativeRulesPrompt = await (0, import_prompts.default)({
|
|
180
|
+
initial: false,
|
|
181
|
+
message: "Enable React Native rules?",
|
|
182
|
+
name: "enableReactNativeRules",
|
|
183
|
+
type: "confirm"
|
|
184
|
+
}, {
|
|
185
|
+
onCancel: () => {
|
|
186
|
+
throw new Error(`Cancelled`);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
} catch (cancelled) {
|
|
190
|
+
console.log(cancelled.message);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (enableReactNativeRulesPrompt.enableReactNativeRules)
|
|
194
|
+
configs.push(` reactnative: true,`);
|
|
195
|
+
if (!enableReactNativeRulesPrompt.enableReactNativeRules) {
|
|
196
|
+
let enableReactRulesPrompt = {
|
|
197
|
+
enableReactRules: false
|
|
198
|
+
};
|
|
199
|
+
try {
|
|
200
|
+
enableReactRulesPrompt = await (0, import_prompts.default)({
|
|
201
|
+
initial: false,
|
|
202
|
+
message: "Enable React rules?",
|
|
203
|
+
name: "enableReactRules",
|
|
204
|
+
type: "confirm"
|
|
205
|
+
}, {
|
|
206
|
+
onCancel: () => {
|
|
207
|
+
throw new Error(`Cancelled`);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
} catch (cancelled) {
|
|
211
|
+
console.log(cancelled.message);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (enableReactRulesPrompt.enableReactRules)
|
|
215
|
+
configs.push(` react: true,`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
const wongxyConfig = configs.join("\n");
|
|
173
219
|
let eslintConfigContent = "";
|
|
174
|
-
const wongxyConfig = `${eslintIgnores.length ? `ignores: ${JSON.stringify(eslintIgnores)}` : ""}`;
|
|
175
220
|
if (pkg.type === "module") {
|
|
176
221
|
eslintConfigContent = `
|
|
177
222
|
import wongxy from '@wongxy/eslint-config'
|
package/dist/cli.js
CHANGED
|
@@ -17,22 +17,20 @@ import parse from "parse-gitignore";
|
|
|
17
17
|
import c from "picocolors";
|
|
18
18
|
|
|
19
19
|
// package.json
|
|
20
|
-
var version = "0.0.
|
|
20
|
+
var version = "0.0.15";
|
|
21
21
|
var devDependencies = {
|
|
22
22
|
"@antfu/eslint-config": "^2.6.4",
|
|
23
|
-
"@types/eslint": "^8.56.
|
|
23
|
+
"@types/eslint": "^8.56.5",
|
|
24
24
|
"@types/prompts": "^2.4.9",
|
|
25
25
|
"@types/yargs": "^17.0.32",
|
|
26
26
|
bumpp: "^9.3.0",
|
|
27
27
|
eslint: "^8.57.0",
|
|
28
|
-
"eslint-
|
|
29
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
30
|
-
"eslint-plugin-react-refresh": "^0.4.5",
|
|
28
|
+
"eslint-flat-config-viewer": "^0.1.11",
|
|
31
29
|
"parse-gitignore": "^2.0.0",
|
|
32
30
|
picocolors: "^1.0.0",
|
|
33
31
|
prompts: "^2.4.2",
|
|
34
32
|
tsup: "^8.0.2",
|
|
35
|
-
typescript: "5.
|
|
33
|
+
typescript: "5.3.3",
|
|
36
34
|
yargs: "^17.7.2"
|
|
37
35
|
};
|
|
38
36
|
|
|
@@ -141,8 +139,55 @@ async function run(options = {}) {
|
|
|
141
139
|
eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
|
|
142
140
|
}
|
|
143
141
|
}
|
|
142
|
+
const configs = [];
|
|
143
|
+
if (eslintIgnores.length)
|
|
144
|
+
configs.push(` ignores: ${JSON.stringify(eslintIgnores)},`);
|
|
145
|
+
if (!SKIP_PROMPT) {
|
|
146
|
+
let enableReactNativeRulesPrompt = {
|
|
147
|
+
enableReactNativeRules: false
|
|
148
|
+
};
|
|
149
|
+
try {
|
|
150
|
+
enableReactNativeRulesPrompt = await prompts({
|
|
151
|
+
initial: false,
|
|
152
|
+
message: "Enable React Native rules?",
|
|
153
|
+
name: "enableReactNativeRules",
|
|
154
|
+
type: "confirm"
|
|
155
|
+
}, {
|
|
156
|
+
onCancel: () => {
|
|
157
|
+
throw new Error(`Cancelled`);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
} catch (cancelled) {
|
|
161
|
+
console.log(cancelled.message);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (enableReactNativeRulesPrompt.enableReactNativeRules)
|
|
165
|
+
configs.push(` reactnative: true,`);
|
|
166
|
+
if (!enableReactNativeRulesPrompt.enableReactNativeRules) {
|
|
167
|
+
let enableReactRulesPrompt = {
|
|
168
|
+
enableReactRules: false
|
|
169
|
+
};
|
|
170
|
+
try {
|
|
171
|
+
enableReactRulesPrompt = await prompts({
|
|
172
|
+
initial: false,
|
|
173
|
+
message: "Enable React rules?",
|
|
174
|
+
name: "enableReactRules",
|
|
175
|
+
type: "confirm"
|
|
176
|
+
}, {
|
|
177
|
+
onCancel: () => {
|
|
178
|
+
throw new Error(`Cancelled`);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
} catch (cancelled) {
|
|
182
|
+
console.log(cancelled.message);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (enableReactRulesPrompt.enableReactRules)
|
|
186
|
+
configs.push(` react: true,`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
const wongxyConfig = configs.join("\n");
|
|
144
190
|
let eslintConfigContent = "";
|
|
145
|
-
const wongxyConfig = `${eslintIgnores.length ? `ignores: ${JSON.stringify(eslintIgnores)}` : ""}`;
|
|
146
191
|
if (pkg.type === "module") {
|
|
147
192
|
eslintConfigContent = `
|
|
148
193
|
import wongxy from '@wongxy/eslint-config'
|
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ function wongxy(options, ...userConfigs) {
|
|
|
30
30
|
const configs = [];
|
|
31
31
|
configs.push(
|
|
32
32
|
{
|
|
33
|
+
name: "wongxy:general",
|
|
33
34
|
rules: {
|
|
34
35
|
"no-console": "off",
|
|
35
36
|
"no-alert": "off",
|
|
@@ -40,6 +41,7 @@ function wongxy(options, ...userConfigs) {
|
|
|
40
41
|
);
|
|
41
42
|
if (options?.vue) {
|
|
42
43
|
configs.push({
|
|
44
|
+
name: "wongxy:vue",
|
|
43
45
|
files: ["**/*.vue"],
|
|
44
46
|
rules: {
|
|
45
47
|
"vue/singleline-html-element-content-newline": "off",
|
|
@@ -53,6 +55,7 @@ function wongxy(options, ...userConfigs) {
|
|
|
53
55
|
}
|
|
54
56
|
if (reactnative) {
|
|
55
57
|
configs.push({
|
|
58
|
+
name: "wongxy:reactnative",
|
|
56
59
|
rules: {
|
|
57
60
|
"ts/no-require-imports": "off",
|
|
58
61
|
"ts/no-use-before-define": "off"
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ function wongxy(options, ...userConfigs) {
|
|
|
6
6
|
const configs = [];
|
|
7
7
|
configs.push(
|
|
8
8
|
{
|
|
9
|
+
name: "wongxy:general",
|
|
9
10
|
rules: {
|
|
10
11
|
"no-console": "off",
|
|
11
12
|
"no-alert": "off",
|
|
@@ -16,6 +17,7 @@ function wongxy(options, ...userConfigs) {
|
|
|
16
17
|
);
|
|
17
18
|
if (options?.vue) {
|
|
18
19
|
configs.push({
|
|
20
|
+
name: "wongxy:vue",
|
|
19
21
|
files: ["**/*.vue"],
|
|
20
22
|
rules: {
|
|
21
23
|
"vue/singleline-html-element-content-newline": "off",
|
|
@@ -29,6 +31,7 @@ function wongxy(options, ...userConfigs) {
|
|
|
29
31
|
}
|
|
30
32
|
if (reactnative) {
|
|
31
33
|
configs.push({
|
|
34
|
+
name: "wongxy:reactnative",
|
|
32
35
|
rules: {
|
|
33
36
|
"ts/no-require-imports": "off",
|
|
34
37
|
"ts/no-use-before-define": "off"
|
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": "0.0.15",
|
|
5
5
|
"description": "xiyaowong's eslint config",
|
|
6
6
|
"author": "xiyaowong (https://github.com/xiyaowong)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
},
|
|
14
14
|
"main": "dist/index.js",
|
|
15
15
|
"bin": {
|
|
16
|
-
"@wongxy/eslint-config": "bin/index.js",
|
|
17
16
|
"eslint-config": "bin/index.js",
|
|
17
|
+
"eslint-config-wongxy": "bin/index.js",
|
|
18
|
+
"wongxy-eslint": "bin/index.js",
|
|
18
19
|
"wongxy-eslint-config": "bin/index.js"
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"eslint-plugin-react-refresh": "^0.4.5"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@antfu/eslint-config": "
|
|
31
|
+
"@antfu/eslint-config": "^2.7.0",
|
|
31
32
|
"parse-gitignore": "^2.0.0",
|
|
32
33
|
"picocolors": "^1.0.0",
|
|
33
34
|
"prompts": "^2.4.2",
|
|
@@ -35,19 +36,17 @@
|
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@antfu/eslint-config": "^2.6.4",
|
|
38
|
-
"@types/eslint": "^8.56.
|
|
39
|
+
"@types/eslint": "^8.56.5",
|
|
39
40
|
"@types/prompts": "^2.4.9",
|
|
40
41
|
"@types/yargs": "^17.0.32",
|
|
41
42
|
"bumpp": "^9.3.0",
|
|
42
43
|
"eslint": "^8.57.0",
|
|
43
|
-
"eslint-
|
|
44
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
45
|
-
"eslint-plugin-react-refresh": "^0.4.5",
|
|
44
|
+
"eslint-flat-config-viewer": "^0.1.11",
|
|
46
45
|
"parse-gitignore": "^2.0.0",
|
|
47
46
|
"picocolors": "^1.0.0",
|
|
48
47
|
"prompts": "^2.4.2",
|
|
49
48
|
"tsup": "^8.0.2",
|
|
50
|
-
"typescript": "5.
|
|
49
|
+
"typescript": "5.3.3",
|
|
51
50
|
"yargs": "^17.7.2"
|
|
52
51
|
},
|
|
53
52
|
"scripts": {
|
|
@@ -57,6 +56,7 @@
|
|
|
57
56
|
"lint": "pnpm run stub && eslint .",
|
|
58
57
|
"lint:fix": "pnpm run stub && eslint . --fix",
|
|
59
58
|
"release": "bumpp && pnpm publish",
|
|
59
|
+
"preview": "eslint-flat-config-viewer",
|
|
60
60
|
"typecheck": "tsc --noEmit"
|
|
61
61
|
}
|
|
62
62
|
}
|