@keeex/eslint-config 2.4.2 → 2.5.1
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/LICENSE +1 -1
- package/README.md +2 -2
- package/package.json +4 -4
- package/src/bin/kxeslint-setup.js +35 -6
- package/src/dependencies.js +1 -5
- package/src/pathutils.js +2 -2
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 KeeeX SAS
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
6
6
|
associated documentation files (the "Software"), to deal in the Software without restriction,
|
package/README.md
CHANGED
|
@@ -124,8 +124,8 @@ following options:
|
|
|
124
124
|
// "environments": "webservice"
|
|
125
125
|
{
|
|
126
126
|
"environments": {
|
|
127
|
-
"node": ["", "src/bin/**", "src/server/**"],
|
|
128
|
-
"webapp": ["src/webapp/**", "webres/*/js/**"],
|
|
127
|
+
"node": ["", "src/bin/**", "src/server/**", "src/tests/server/**"],
|
|
128
|
+
"webapp": ["src/webapp/**", "webres/*/js/**", "src/tests/webapp/**"],
|
|
129
129
|
"mocha": ["src/**/*.test.*", "src/tests/**/*"]
|
|
130
130
|
}
|
|
131
131
|
}
|
package/package.json
CHANGED
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"@eslint/compat": "^1.2.7",
|
|
20
20
|
"@eslint/js": "^9.12.0",
|
|
21
21
|
"eslint": "^9.22.0",
|
|
22
|
-
"eslint-import-resolver-typescript": "^4.
|
|
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",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"eslint-plugin-tsdoc": "^0.4.0",
|
|
30
30
|
"globals": "^16.0.0",
|
|
31
31
|
"prettier": "^3.5.3",
|
|
32
|
-
"typescript-eslint": "^8.
|
|
32
|
+
"typescript-eslint": "^8.27.0"
|
|
33
33
|
},
|
|
34
34
|
"exports": {
|
|
35
35
|
".": "./src/index.js",
|
|
@@ -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.1"
|
|
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
|
@@ -88,13 +88,9 @@ export const addDependency = (depName, version) => {
|
|
|
88
88
|
* Returns false if the process ended with another status than 0.
|
|
89
89
|
*/
|
|
90
90
|
const runProcess = (cmd, ...args) => {
|
|
91
|
-
const res = cp.spawnSync(cmd, args, {encoding: "utf8"});
|
|
91
|
+
const res = cp.spawnSync(cmd, args, {encoding: "utf8", stdio: "inherit"});
|
|
92
92
|
if (res.status !== 0) {
|
|
93
93
|
console.log(`Command ${cmd} failed with exit code ${res.status}`);
|
|
94
|
-
console.log("stdout:");
|
|
95
|
-
console.log(res.stdout);
|
|
96
|
-
console.log("stderr:");
|
|
97
|
-
console.log(res.stderr);
|
|
98
94
|
return false;
|
|
99
95
|
}
|
|
100
96
|
return true;
|
package/src/pathutils.js
CHANGED
|
@@ -11,8 +11,8 @@ const envShorthands = {
|
|
|
11
11
|
weblibrary: {webapp: "src/**", mocha: ["src/**/*.test.*", "src/tests/**/*"]},
|
|
12
12
|
webservice: {
|
|
13
13
|
mocha: ["src/**/*.test.*", "src/tests/**/*"],
|
|
14
|
-
node: ["", "bin/**", "src/bin/**", "src/server/**"],
|
|
15
|
-
webapp: ["src/webapp/**", "webres/*/js/**"],
|
|
14
|
+
node: ["", "bin/**", "src/bin/**", "src/server/**", "src/tests/server/**"],
|
|
15
|
+
webapp: ["src/webapp/**", "webres/*/js/**", "src/tests/webapp/**"],
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
|