@keeex/eslint-config 2.4.1 → 2.5.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/package.json +9 -9
- package/src/bin/kxeslint-setup.js +35 -6
- package/src/dependencies.js +2 -3
package/package.json
CHANGED
|
@@ -16,20 +16,20 @@
|
|
|
16
16
|
},
|
|
17
17
|
"description": "Common eslint configuration",
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@eslint/compat": "^1.2.
|
|
19
|
+
"@eslint/compat": "^1.2.7",
|
|
20
20
|
"@eslint/js": "^9.12.0",
|
|
21
|
-
"eslint": "^9.
|
|
22
|
-
"eslint-import-resolver-typescript": "^
|
|
21
|
+
"eslint": "^9.22.0",
|
|
22
|
+
"eslint-import-resolver-typescript": "^4.2.2",
|
|
23
23
|
"eslint-import-resolver-webpack": "^0.13.10",
|
|
24
|
-
"eslint-plugin-import-x": "^4.
|
|
24
|
+
"eslint-plugin-import-x": "^4.9.1",
|
|
25
25
|
"eslint-plugin-mocha": "^10.5.0",
|
|
26
26
|
"eslint-plugin-promise": "^7.2.1",
|
|
27
27
|
"eslint-plugin-react": "^7.37.4",
|
|
28
|
-
"eslint-plugin-react-hooks": "^5.
|
|
28
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
29
29
|
"eslint-plugin-tsdoc": "^0.4.0",
|
|
30
30
|
"globals": "^16.0.0",
|
|
31
|
-
"prettier": "^3.5.
|
|
32
|
-
"typescript-eslint": "^8.
|
|
31
|
+
"prettier": "^3.5.3",
|
|
32
|
+
"typescript-eslint": "^8.27.0"
|
|
33
33
|
},
|
|
34
34
|
"exports": {
|
|
35
35
|
".": "./src/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@eslint/compat": "^1.2.0",
|
|
46
46
|
"@eslint/js": "9.x",
|
|
47
47
|
"eslint": "9.x",
|
|
48
|
-
"eslint-import-resolver-typescript": "3.x",
|
|
48
|
+
"eslint-import-resolver-typescript": "3.X || 4.x",
|
|
49
49
|
"eslint-import-resolver-webpack": "0.x",
|
|
50
50
|
"eslint-plugin-import-x": "4.x",
|
|
51
51
|
"eslint-plugin-mocha": "10.x",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"test": "echo No test for this project"
|
|
117
117
|
},
|
|
118
118
|
"type": "module",
|
|
119
|
-
"version": "2.
|
|
119
|
+
"version": "2.5.0"
|
|
120
120
|
}
|
|
@@ -9,6 +9,22 @@ import prompts from "prompts";
|
|
|
9
9
|
import * as deps from "../dependencies.js";
|
|
10
10
|
import {setDepCheck} from "../environ.js";
|
|
11
11
|
|
|
12
|
+
let cliInit;
|
|
13
|
+
|
|
14
|
+
const getCliInit = () => {
|
|
15
|
+
if (cliInit) return cliInit;
|
|
16
|
+
for (const arg of process.argv) {
|
|
17
|
+
try {
|
|
18
|
+
const parsed = JSON.parse(arg);
|
|
19
|
+
if (parsed.type === "cliInit") {
|
|
20
|
+
cliInit = parsed;
|
|
21
|
+
return cliInit;
|
|
22
|
+
}
|
|
23
|
+
} catch {}
|
|
24
|
+
}
|
|
25
|
+
cliInit = {};
|
|
26
|
+
};
|
|
27
|
+
|
|
12
28
|
const getEslintConfig = () => path.resolve(process.cwd(), "eslint.config.js");
|
|
13
29
|
|
|
14
30
|
const depsCheck = async () => {
|
|
@@ -104,7 +120,14 @@ const getBooleanPrompt = async (message) => {
|
|
|
104
120
|
const getOptionsFromTarget = async (target) => {
|
|
105
121
|
let {haveMocha, haveReact} = await getOptionsFromTargetFilter(target);
|
|
106
122
|
if (haveReact === "maybe") haveReact = await getBooleanPrompt("Use React?");
|
|
107
|
-
if (haveMocha === "maybe")
|
|
123
|
+
if (haveMocha === "maybe") {
|
|
124
|
+
const cliHaveTest = getCliInit().haveTests;
|
|
125
|
+
if (cliHaveTest === undefined) {
|
|
126
|
+
haveMocha = await getBooleanPrompt("Use Mocha?");
|
|
127
|
+
} else {
|
|
128
|
+
haveMocha = cliHaveTest;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
108
131
|
return {haveReact, haveMocha};
|
|
109
132
|
};
|
|
110
133
|
|
|
@@ -177,13 +200,19 @@ ${configRows.map((c) => ` ${c},`).join("\n")}
|
|
|
177
200
|
|
|
178
201
|
/** Generate a new base config based on a few questions. */
|
|
179
202
|
const getNewConfig = async () => {
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
203
|
+
const choices = [
|
|
204
|
+
{title: "Generic JavaScript", value: "js"},
|
|
205
|
+
{title: "NodeJS", value: "node"},
|
|
206
|
+
];
|
|
207
|
+
const cliWeb = getCliInit().haveWeb;
|
|
208
|
+
if (cliWeb === undefined || cliWeb === true) {
|
|
209
|
+
choices.push(
|
|
184
210
|
{title: "Browser", value: "browser"},
|
|
185
211
|
{title: "React Native", value: "react-native"},
|
|
186
|
-
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
const generalTarget = await prompts({
|
|
215
|
+
choices,
|
|
187
216
|
message: "General target environment",
|
|
188
217
|
name: "value",
|
|
189
218
|
type: "select",
|
package/src/dependencies.js
CHANGED
|
@@ -166,10 +166,10 @@ export const installAndRemoveDeps = () => {
|
|
|
166
166
|
export const configToDependencies = (eslintConfig) => {
|
|
167
167
|
addDependency("eslint", "9.x");
|
|
168
168
|
addDependency("prettier", "3.x");
|
|
169
|
-
if (eslintConfig.globals) addDependency("globals", "
|
|
169
|
+
if (eslintConfig.globals) addDependency("globals", "16.x");
|
|
170
170
|
if (eslintConfig.import !== false) {
|
|
171
171
|
addDependency("eslint-plugin-import-x", "4.x");
|
|
172
|
-
if (eslintConfig.typescript) addDependency("eslint-import-resolver-typescript", "
|
|
172
|
+
if (eslintConfig.typescript) addDependency("eslint-import-resolver-typescript", "4.x");
|
|
173
173
|
}
|
|
174
174
|
if (eslintConfig.mocha) addDependency("eslint-plugin-mocha", "10.x");
|
|
175
175
|
if (!eslintConfig.noBase) {
|
|
@@ -182,7 +182,6 @@ export const configToDependencies = (eslintConfig) => {
|
|
|
182
182
|
if (eslintConfig.import) addDependency("eslint-import-resolver-webpack", "0.x");
|
|
183
183
|
if (react.reactHooks) addDependency("eslint-plugin-react-hooks", "5.x");
|
|
184
184
|
if (react.reactNative) {
|
|
185
|
-
addDependency("eslint-plugin-react-native", "4.x");
|
|
186
185
|
addDependency("@eslint/js", "9.x");
|
|
187
186
|
}
|
|
188
187
|
}
|