@infernodesign/eslint-config 1.23.0 → 1.25.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/README.md +2 -2
- package/dist/cli.js +31 -38
- package/dist/{constants-DjBrEP6N.js → constants-BBBpjSg4.js} +1 -2
- package/dist/index.d.ts +374 -160
- package/dist/index.js +78 -81
- package/package.json +54 -50
package/README.md
CHANGED
|
@@ -176,14 +176,14 @@ export default config( {
|
|
|
176
176
|
|
|
177
177
|
// Customize the stylistic rules
|
|
178
178
|
stylistic: {
|
|
179
|
-
indent: 2, // 4, or 'tab'
|
|
180
|
-
quotes: 'single', // or 'double'
|
|
181
179
|
blockSpacing: false,
|
|
182
180
|
braceStyle: '1tbs',
|
|
183
181
|
commaDangle: 'always-multiline',
|
|
184
182
|
experimental: false,
|
|
183
|
+
indent: 2, // 4, or 'tab'
|
|
185
184
|
jsx: true,
|
|
186
185
|
quoteProps: 'consistent',
|
|
186
|
+
quotes: 'single', // or 'double'
|
|
187
187
|
semi: false,
|
|
188
188
|
|
|
189
189
|
// Disable the opinionated spacing rules (space in parenthesis, objects, arrays, etc.)
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PACKAGE_NAME } from "./constants-
|
|
1
|
+
import { t as PACKAGE_NAME } from "./constants-BBBpjSg4.js";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import fs$1 from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
@@ -7,10 +7,8 @@ import c, { green } from "ansis";
|
|
|
7
7
|
import { cac } from "cac";
|
|
8
8
|
import parse from "parse-gitignore";
|
|
9
9
|
import { execSync } from "node:child_process";
|
|
10
|
-
|
|
11
10
|
//#region package.json
|
|
12
|
-
var version = "1.
|
|
13
|
-
|
|
11
|
+
var version = "1.25.0";
|
|
14
12
|
//#endregion
|
|
15
13
|
//#region src/cli/constants.ts
|
|
16
14
|
const vscodeSettingsString = `
|
|
@@ -137,7 +135,6 @@ const dependenciesMap = {
|
|
|
137
135
|
unocss: ["@unocss/eslint-plugin"],
|
|
138
136
|
vue: []
|
|
139
137
|
};
|
|
140
|
-
|
|
141
138
|
//#endregion
|
|
142
139
|
//#region src/cli/utils.ts
|
|
143
140
|
function getEslintConfigContent(mainConfig, additionalConfigs) {
|
|
@@ -157,9 +154,10 @@ function isGitClean() {
|
|
|
157
154
|
return false;
|
|
158
155
|
}
|
|
159
156
|
}
|
|
160
|
-
|
|
161
157
|
//#endregion
|
|
162
158
|
//#region src/cli/stages/update-eslint-files.ts
|
|
159
|
+
const ESLINT_OR_PRETTIER = /eslint|prettier/;
|
|
160
|
+
const ESLINT_CONFIG = /eslint\.config\./;
|
|
163
161
|
async function updateEslintFiles(result) {
|
|
164
162
|
const cwd = process.cwd();
|
|
165
163
|
const pathESLintIgnore = path.join(cwd, ".eslintignore");
|
|
@@ -185,32 +183,30 @@ async function updateEslintFiles(result) {
|
|
|
185
183
|
const files = fs$1.readdirSync(cwd);
|
|
186
184
|
const legacyConfig = [];
|
|
187
185
|
files.forEach((file) => {
|
|
188
|
-
if (
|
|
186
|
+
if (ESLINT_OR_PRETTIER.test(file) && !ESLINT_CONFIG.test(file)) legacyConfig.push(file);
|
|
189
187
|
});
|
|
190
188
|
if (legacyConfig.length) p.note(c.dim(legacyConfig.join(", ")), "You can now remove those files manually");
|
|
191
189
|
}
|
|
192
|
-
|
|
193
190
|
//#endregion
|
|
194
191
|
//#region src/cli/constants-generated.ts
|
|
195
192
|
const versionsMap = {
|
|
196
|
-
"@eslint-react/eslint-plugin": "^
|
|
197
|
-
"@next/eslint-plugin-next": "^16.
|
|
198
|
-
"@unocss/eslint-plugin": "^66.6.
|
|
193
|
+
"@eslint-react/eslint-plugin": "^3.0.0",
|
|
194
|
+
"@next/eslint-plugin-next": "^16.2.0",
|
|
195
|
+
"@unocss/eslint-plugin": "^66.6.7",
|
|
199
196
|
"astro-eslint-parser": "^1.3.0",
|
|
200
|
-
"eslint": "^10.0
|
|
197
|
+
"eslint": "^10.1.0",
|
|
201
198
|
"eslint-plugin-astro": "^1.6.0",
|
|
202
|
-
"eslint-plugin-better-tailwindcss": "^4.3.
|
|
203
|
-
"eslint-plugin-format": "^
|
|
199
|
+
"eslint-plugin-better-tailwindcss": "^4.3.2",
|
|
200
|
+
"eslint-plugin-format": "^2.0.1",
|
|
204
201
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
205
|
-
"eslint-plugin-react-refresh": "^0.5.
|
|
202
|
+
"eslint-plugin-react-refresh": "^0.5.2",
|
|
206
203
|
"eslint-plugin-solid": "^0.14.5",
|
|
207
|
-
"eslint-plugin-storybook": "^10.
|
|
208
|
-
"eslint-plugin-svelte": "^3.15.
|
|
204
|
+
"eslint-plugin-storybook": "^10.3.1",
|
|
205
|
+
"eslint-plugin-svelte": "^3.15.2",
|
|
209
206
|
"prettier-plugin-astro": "^0.14.1",
|
|
210
207
|
"prettier-plugin-slidev": "^1.0.5",
|
|
211
|
-
"svelte-eslint-parser": "^1.
|
|
208
|
+
"svelte-eslint-parser": "^1.6.0"
|
|
212
209
|
};
|
|
213
|
-
|
|
214
210
|
//#endregion
|
|
215
211
|
//#region src/cli/stages/update-package-json.ts
|
|
216
212
|
async function updatePackageJson(result) {
|
|
@@ -251,9 +247,9 @@ async function updatePackageJson(result) {
|
|
|
251
247
|
await fs.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
|
|
252
248
|
p.log.success(c.green`Changes wrote to package.json`);
|
|
253
249
|
}
|
|
254
|
-
|
|
255
250
|
//#endregion
|
|
256
251
|
//#region src/cli/stages/update-vscode-settings.ts
|
|
252
|
+
const LAST_LINE_PATTERN = /\s*\}$/;
|
|
257
253
|
async function updateVscodeSettings(result) {
|
|
258
254
|
const cwd = process.cwd();
|
|
259
255
|
if (!result.updateVscodeSettings) return;
|
|
@@ -265,14 +261,13 @@ async function updateVscodeSettings(result) {
|
|
|
265
261
|
p.log.success(green`Created .vscode/settings.json`);
|
|
266
262
|
} else {
|
|
267
263
|
let settingsContent = await fs.readFile(settingsPath, "utf8");
|
|
268
|
-
settingsContent = settingsContent.trim().replace(
|
|
264
|
+
settingsContent = settingsContent.trim().replace(LAST_LINE_PATTERN, "");
|
|
269
265
|
settingsContent += settingsContent.endsWith(",") || settingsContent.endsWith("{") ? "" : ",";
|
|
270
266
|
settingsContent += `${vscodeSettingsString}}\n`;
|
|
271
267
|
await fs.writeFile(settingsPath, settingsContent, "utf-8");
|
|
272
268
|
p.log.success(green`Updated .vscode/settings.json`);
|
|
273
269
|
}
|
|
274
270
|
}
|
|
275
|
-
|
|
276
271
|
//#endregion
|
|
277
272
|
//#region src/cli/run.ts
|
|
278
273
|
async function run(options = {}) {
|
|
@@ -291,11 +286,14 @@ async function run(options = {}) {
|
|
|
291
286
|
};
|
|
292
287
|
if (!argSkipPrompt) {
|
|
293
288
|
result = await p.group({
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
289
|
+
extra: async ({ results }) => {
|
|
290
|
+
const isArgExtraValid = !!argExtra?.length && !argExtra.some((element) => !extra.includes(element));
|
|
291
|
+
if (!results.uncommittedConfirmed || isArgExtraValid) return;
|
|
292
|
+
const message = !isArgExtraValid && argExtra?.length ? `"${argExtra.join(", ")}" isn't a valid extra util. Please choose from below: ` : "Select a extra utils:";
|
|
293
|
+
return p.multiselect({
|
|
294
|
+
message: c.reset(message),
|
|
295
|
+
options: extraOptions,
|
|
296
|
+
required: false
|
|
299
297
|
});
|
|
300
298
|
},
|
|
301
299
|
frameworks: async ({ results }) => {
|
|
@@ -308,14 +306,11 @@ async function run(options = {}) {
|
|
|
308
306
|
required: false
|
|
309
307
|
});
|
|
310
308
|
},
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
message: c.reset(message),
|
|
317
|
-
options: extraOptions,
|
|
318
|
-
required: false
|
|
309
|
+
uncommittedConfirmed: async () => {
|
|
310
|
+
if (argSkipPrompt || isGitClean()) return Promise.resolve(true);
|
|
311
|
+
return p.confirm({
|
|
312
|
+
initialValue: false,
|
|
313
|
+
message: "There are uncommitted changes in the current repository, are you sure to continue?"
|
|
319
314
|
});
|
|
320
315
|
},
|
|
321
316
|
updateVscodeSettings: async ({ results }) => {
|
|
@@ -337,7 +332,6 @@ async function run(options = {}) {
|
|
|
337
332
|
p.log.success(c.green`Setup completed`);
|
|
338
333
|
p.outro(`Now you can update the dependencies by running ${c.blue("npm install")} and run ${c.blue("eslint --fix")}\n`);
|
|
339
334
|
}
|
|
340
|
-
|
|
341
335
|
//#endregion
|
|
342
336
|
//#region src/cli/index.ts
|
|
343
337
|
function header() {
|
|
@@ -358,6 +352,5 @@ cli.command("", "Run the initialization or migration").option("--yes, -y", "Skip
|
|
|
358
352
|
cli.help();
|
|
359
353
|
cli.version(version);
|
|
360
354
|
cli.parse();
|
|
361
|
-
|
|
362
355
|
//#endregion
|
|
363
|
-
export {
|
|
356
|
+
export {};
|