@keeex/eslint-config 2.4.2 → 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 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.0.0",
22
+ "eslint-import-resolver-typescript": "^4.2.2",
23
23
  "eslint-import-resolver-webpack": "^0.13.10",
24
- "eslint-plugin-import-x": "^4.8.0",
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.26.1"
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.4.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") haveMocha = await getBooleanPrompt("Use Mocha?");
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 generalTarget = await prompts({
181
- choices: [
182
- {title: "Generic JavaScript", value: "js"},
183
- {title: "NodeJS", value: "node"},
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",