@isentinel/eslint-config 0.7.3 → 0.7.5
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/dist/{chunk-NKAA53II.js → chunk-6J6ZEY37.js} +2 -2
- package/dist/cli.cjs +41 -41
- package/dist/cli.js +42 -42
- package/dist/index.cjs +46 -27
- package/dist/index.d.cts +283 -1609
- package/dist/index.d.ts +283 -1609
- package/dist/index.js +56 -37
- package/package.json +15 -15
|
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
mod
|
|
28
28
|
));
|
|
29
29
|
|
|
30
|
-
// node_modules/.pnpm/tsup@8.2.3_jiti@1.21.6_postcss@8.4.38_tsx@4.15.4_typescript@5.5.4_yaml@2.
|
|
30
|
+
// node_modules/.pnpm/tsup@8.2.3_jiti@1.21.6_postcss@8.4.38_tsx@4.15.4_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/esm_shims.js
|
|
31
31
|
var init_esm_shims = __esm({
|
|
32
|
-
"node_modules/.pnpm/tsup@8.2.3_jiti@1.21.6_postcss@8.4.38_tsx@4.15.4_typescript@5.5.4_yaml@2.
|
|
32
|
+
"node_modules/.pnpm/tsup@8.2.3_jiti@1.21.6_postcss@8.4.38_tsx@4.15.4_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/esm_shims.js"() {
|
|
33
33
|
"use strict";
|
|
34
34
|
}
|
|
35
35
|
});
|
package/dist/cli.cjs
CHANGED
|
@@ -28,7 +28,7 @@ var cli_exports = {};
|
|
|
28
28
|
module.exports = __toCommonJS(cli_exports);
|
|
29
29
|
|
|
30
30
|
// src/cli/index.ts
|
|
31
|
-
var
|
|
31
|
+
var import_prompts6 = require("@clack/prompts");
|
|
32
32
|
var import_node_process5 = __toESM(require("process"), 1);
|
|
33
33
|
var import_picocolors6 = __toESM(require("picocolors"), 1);
|
|
34
34
|
var import_yargs = __toESM(require("yargs"), 1);
|
|
@@ -37,7 +37,7 @@ var import_helpers = require("yargs/helpers");
|
|
|
37
37
|
// package.json
|
|
38
38
|
var package_default = {
|
|
39
39
|
name: "@isentinel/eslint-config",
|
|
40
|
-
version: "0.7.
|
|
40
|
+
version: "0.7.5",
|
|
41
41
|
description: "iSentinel's ESLint config",
|
|
42
42
|
keywords: [
|
|
43
43
|
"eslint-config",
|
|
@@ -87,18 +87,18 @@ var package_default = {
|
|
|
87
87
|
dependencies: {
|
|
88
88
|
"@antfu/install-pkg": "0.3.3",
|
|
89
89
|
"@clack/prompts": "0.7.0",
|
|
90
|
-
"@cspell/eslint-plugin": "8.
|
|
90
|
+
"@cspell/eslint-plugin": "8.13.1",
|
|
91
91
|
"@eslint/compat": "1.1.1",
|
|
92
92
|
"@isentinel/dict-rbxts": "1.0.1",
|
|
93
93
|
"@isentinel/dict-roblox": "1.0.3",
|
|
94
94
|
"@isentinel/eslint-plugin-comment-length": "1.7.3",
|
|
95
95
|
"@shopify/eslint-plugin": "46.0.0",
|
|
96
|
-
"@stylistic/eslint-plugin": "2.
|
|
97
|
-
"@typescript-eslint/eslint-plugin": "
|
|
98
|
-
"@typescript-eslint/parser": "
|
|
96
|
+
"@stylistic/eslint-plugin": "2.6.1",
|
|
97
|
+
"@typescript-eslint/eslint-plugin": "8.0.0",
|
|
98
|
+
"@typescript-eslint/parser": "8.0.0",
|
|
99
99
|
"eslint-config-flat-gitignore": "0.1.8",
|
|
100
100
|
"eslint-config-prettier": "9.1.0",
|
|
101
|
-
"eslint-flat-config-utils": "0.
|
|
101
|
+
"eslint-flat-config-utils": "0.3.0",
|
|
102
102
|
"eslint-merge-processors": "0.1.0",
|
|
103
103
|
"eslint-plugin-antfu": "2.3.4",
|
|
104
104
|
"eslint-plugin-arrow-return-style": "1.3.1",
|
|
@@ -106,12 +106,12 @@ var package_default = {
|
|
|
106
106
|
"eslint-plugin-format": "0.1.2",
|
|
107
107
|
"eslint-plugin-format-lua": "0.1.0",
|
|
108
108
|
"eslint-plugin-import-x": "3.1.0",
|
|
109
|
-
"eslint-plugin-jsdoc": "48.
|
|
109
|
+
"eslint-plugin-jsdoc": "48.11.0",
|
|
110
110
|
"eslint-plugin-jsonc": "2.16.0",
|
|
111
111
|
"eslint-plugin-markdown": "5.1.0",
|
|
112
112
|
"eslint-plugin-no-autofix": "2.0.0",
|
|
113
113
|
"eslint-plugin-package-json": "0.15.2",
|
|
114
|
-
"eslint-plugin-perfectionist": "3.
|
|
114
|
+
"eslint-plugin-perfectionist": "3.1.0",
|
|
115
115
|
"eslint-plugin-promise": "7.0.0",
|
|
116
116
|
"eslint-plugin-sonarjs": "1.0.4",
|
|
117
117
|
"eslint-plugin-toml": "0.11.1",
|
|
@@ -131,13 +131,13 @@ var package_default = {
|
|
|
131
131
|
},
|
|
132
132
|
devDependencies: {
|
|
133
133
|
"@antfu/ni": "0.22.0",
|
|
134
|
-
"@eslint-react/eslint-plugin": "1.
|
|
134
|
+
"@eslint-react/eslint-plugin": "1.8.2",
|
|
135
135
|
"@eslint/config-inspector": "0.5.2",
|
|
136
136
|
"@isentinel/eslint-config": "workspace:*",
|
|
137
|
-
"@stylistic/eslint-plugin-migrate": "2.
|
|
138
|
-
"@types/eslint": "
|
|
137
|
+
"@stylistic/eslint-plugin-migrate": "2.6.1",
|
|
138
|
+
"@types/eslint": "9.6.0",
|
|
139
139
|
"@types/fs-extra": "11.0.4",
|
|
140
|
-
"@types/node": "20.14.
|
|
140
|
+
"@types/node": "20.14.13",
|
|
141
141
|
"@types/prompts": "2.4.9",
|
|
142
142
|
"@types/yargs": "17.0.32",
|
|
143
143
|
bumpp: "9.4.1",
|
|
@@ -145,7 +145,7 @@ var package_default = {
|
|
|
145
145
|
eslint: "9.8.0",
|
|
146
146
|
"eslint-plugin-react-hooks": "4.6.2",
|
|
147
147
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
148
|
-
"eslint-typegen": "0.
|
|
148
|
+
"eslint-typegen": "0.3.0",
|
|
149
149
|
esno: "4.7.0",
|
|
150
150
|
execa: "9.3.0",
|
|
151
151
|
"fast-glob": "3.3.2",
|
|
@@ -157,7 +157,7 @@ var package_default = {
|
|
|
157
157
|
typescript: "5.5.4"
|
|
158
158
|
},
|
|
159
159
|
peerDependencies: {
|
|
160
|
-
"@eslint-react/eslint-plugin": "^1.
|
|
160
|
+
"@eslint-react/eslint-plugin": "^1.8.0",
|
|
161
161
|
eslint: ">=8.40.0",
|
|
162
162
|
"eslint-plugin-react-hooks": "^4.6.0"
|
|
163
163
|
},
|
|
@@ -221,14 +221,14 @@ var dependenciesMap = {
|
|
|
221
221
|
};
|
|
222
222
|
|
|
223
223
|
// src/cli/run.ts
|
|
224
|
-
var
|
|
224
|
+
var import_prompts5 = require("@clack/prompts");
|
|
225
225
|
var import_node_fs4 = __toESM(require("fs"), 1);
|
|
226
226
|
var import_node_path4 = __toESM(require("path"), 1);
|
|
227
227
|
var import_node_process4 = __toESM(require("process"), 1);
|
|
228
228
|
var import_picocolors5 = __toESM(require("picocolors"), 1);
|
|
229
229
|
|
|
230
230
|
// src/cli/stages/add-tsconfig.build.json.ts
|
|
231
|
-
var
|
|
231
|
+
var import_prompts = require("@clack/prompts");
|
|
232
232
|
var import_node_fs = __toESM(require("fs"), 1);
|
|
233
233
|
var import_promises = __toESM(require("fs/promises"), 1);
|
|
234
234
|
var import_path = __toESM(require("path"), 1);
|
|
@@ -237,7 +237,7 @@ async function addTsconfigBuild() {
|
|
|
237
237
|
const cwd = process.cwd();
|
|
238
238
|
const pathTsconfigBuild = import_path.default.join(cwd, "tsconfig.build.json");
|
|
239
239
|
if (import_node_fs.default.existsSync(pathTsconfigBuild)) {
|
|
240
|
-
|
|
240
|
+
import_prompts.log.info(import_picocolors.default.yellow("tsconfig.build.json already exists"));
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
243
|
const tsconfigBuildContent = `{
|
|
@@ -247,8 +247,8 @@ async function addTsconfigBuild() {
|
|
|
247
247
|
}
|
|
248
248
|
`;
|
|
249
249
|
await import_promises.default.writeFile(pathTsconfigBuild, tsconfigBuildContent, "utf-8");
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
import_prompts.log.success(import_picocolors.default.green(`Created tsconfig.build.json`));
|
|
251
|
+
import_prompts.log.info(
|
|
252
252
|
import_picocolors.default.yellow(
|
|
253
253
|
`You must add '"exclude": ["./eslint.config.ts"]' to your tsconfig.json. In the future, this will be done automatically.`
|
|
254
254
|
)
|
|
@@ -256,7 +256,7 @@ async function addTsconfigBuild() {
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
// src/cli/stages/update-eslint-files.ts
|
|
259
|
-
var
|
|
259
|
+
var import_prompts2 = require("@clack/prompts");
|
|
260
260
|
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
261
261
|
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
262
262
|
var import_node_path = __toESM(require("path"), 1);
|
|
@@ -297,7 +297,7 @@ async function updateEslintFiles() {
|
|
|
297
297
|
const pathFlatConfig = import_node_path.default.join(cwd, configFileName);
|
|
298
298
|
const eslintIgnores = [];
|
|
299
299
|
if (import_node_fs2.default.existsSync(pathESLintIgnore)) {
|
|
300
|
-
|
|
300
|
+
import_prompts2.log.step(import_picocolors2.default.cyan(`Migrating existing .eslintignore`));
|
|
301
301
|
const content = await import_promises2.default.readFile(pathESLintIgnore, "utf-8");
|
|
302
302
|
const parsed = (0, import_parse_gitignore.default)(content);
|
|
303
303
|
const globs = parsed.globs();
|
|
@@ -325,7 +325,7 @@ async function updateEslintFiles() {
|
|
|
325
325
|
const additionalConfig = [];
|
|
326
326
|
const eslintConfigContent = getEslintConfigContent(mainConfig, additionalConfig);
|
|
327
327
|
await import_promises2.default.writeFile(pathFlatConfig, eslintConfigContent);
|
|
328
|
-
|
|
328
|
+
import_prompts2.log.success(import_picocolors2.default.green(`Created ${configFileName}`));
|
|
329
329
|
const files = import_node_fs2.default.readdirSync(cwd);
|
|
330
330
|
const legacyConfig = [];
|
|
331
331
|
for (const file of files) {
|
|
@@ -334,12 +334,12 @@ async function updateEslintFiles() {
|
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
if (legacyConfig.length) {
|
|
337
|
-
|
|
337
|
+
(0, import_prompts2.note)(`${import_picocolors2.default.dim(legacyConfig.join(", "))}`, "You can now remove those files manually");
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
|
|
341
341
|
// src/cli/stages/update-package-json.ts
|
|
342
|
-
var
|
|
342
|
+
var import_prompts3 = require("@clack/prompts");
|
|
343
343
|
var import_promises3 = __toESM(require("fs/promises"), 1);
|
|
344
344
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
345
345
|
var import_node_process2 = __toESM(require("process"), 1);
|
|
@@ -347,7 +347,7 @@ var import_picocolors3 = __toESM(require("picocolors"), 1);
|
|
|
347
347
|
async function updatePackageJson() {
|
|
348
348
|
const cwd = import_node_process2.default.cwd();
|
|
349
349
|
const pathPackageJSON = import_node_path2.default.join(cwd, "package.json");
|
|
350
|
-
|
|
350
|
+
import_prompts3.log.step(import_picocolors3.default.cyan(`Bumping @isentinel/eslint-config to v${package_default.version}`));
|
|
351
351
|
const packageContent = await import_promises3.default.readFile(pathPackageJSON, "utf-8");
|
|
352
352
|
const package_ = JSON.parse(packageContent);
|
|
353
353
|
package_.devDependencies ??= {};
|
|
@@ -359,14 +359,14 @@ async function updatePackageJson() {
|
|
|
359
359
|
addedPackages.push(dep);
|
|
360
360
|
}
|
|
361
361
|
if (addedPackages.length) {
|
|
362
|
-
|
|
362
|
+
(0, import_prompts3.note)(`${import_picocolors3.default.dim(addedPackages.join(", "))}`, "Added packages");
|
|
363
363
|
}
|
|
364
364
|
await import_promises3.default.writeFile(pathPackageJSON, JSON.stringify(package_, null, 2));
|
|
365
|
-
|
|
365
|
+
import_prompts3.log.success(import_picocolors3.default.green(`Changes wrote to package.json`));
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
// src/cli/stages/update-vscode-settings.ts
|
|
369
|
-
var
|
|
369
|
+
var import_prompts4 = require("@clack/prompts");
|
|
370
370
|
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
371
371
|
var import_promises4 = __toESM(require("fs/promises"), 1);
|
|
372
372
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
@@ -385,7 +385,7 @@ async function updateVscodeSettings(result) {
|
|
|
385
385
|
if (!import_node_fs3.default.existsSync(settingsPath)) {
|
|
386
386
|
await import_promises4.default.writeFile(settingsPath, `{${vscodeSettingsString}}
|
|
387
387
|
`, "utf-8");
|
|
388
|
-
|
|
388
|
+
import_prompts4.log.success(import_picocolors4.default.green(`Created .vscode/settings.json`));
|
|
389
389
|
return;
|
|
390
390
|
}
|
|
391
391
|
let settingsContent = await import_promises4.default.readFile(settingsPath, "utf8");
|
|
@@ -394,7 +394,7 @@ async function updateVscodeSettings(result) {
|
|
|
394
394
|
settingsContent += `${vscodeSettingsString}}
|
|
395
395
|
`;
|
|
396
396
|
await import_promises4.default.writeFile(settingsPath, settingsContent, "utf-8");
|
|
397
|
-
|
|
397
|
+
import_prompts4.log.success(import_picocolors4.default.green(`Updated .vscode/settings.json`));
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
// src/cli/run.ts
|
|
@@ -402,7 +402,7 @@ async function run(options = {}) {
|
|
|
402
402
|
const argumentSkipPrompt = !!import_node_process4.default.env.SKIP_PROMPT || options.yes;
|
|
403
403
|
const argumentTemplate = ["react"];
|
|
404
404
|
if (import_node_fs4.default.existsSync(import_node_path4.default.join(import_node_process4.default.cwd(), "eslint.config.js"))) {
|
|
405
|
-
|
|
405
|
+
import_prompts5.log.warn(import_picocolors5.default.yellow(`eslint.config.js already exists, migration wizard exited.`));
|
|
406
406
|
return import_node_process4.default.exit(1);
|
|
407
407
|
}
|
|
408
408
|
let result = {
|
|
@@ -411,13 +411,13 @@ async function run(options = {}) {
|
|
|
411
411
|
updateVscodeSettings: true
|
|
412
412
|
};
|
|
413
413
|
if (!argumentSkipPrompt) {
|
|
414
|
-
result = await
|
|
414
|
+
result = await (0, import_prompts5.group)(
|
|
415
415
|
{
|
|
416
416
|
uncommittedConfirmed: () => {
|
|
417
417
|
if (argumentSkipPrompt || isGitClean()) {
|
|
418
418
|
return Promise.resolve(true);
|
|
419
419
|
}
|
|
420
|
-
return
|
|
420
|
+
return (0, import_prompts5.confirm)({
|
|
421
421
|
initialValue: false,
|
|
422
422
|
message: "There are uncommitted changes in the current repository, are you sure to continue?"
|
|
423
423
|
});
|
|
@@ -426,7 +426,7 @@ async function run(options = {}) {
|
|
|
426
426
|
if (!results.uncommittedConfirmed) {
|
|
427
427
|
return;
|
|
428
428
|
}
|
|
429
|
-
return
|
|
429
|
+
return (0, import_prompts5.confirm)({
|
|
430
430
|
initialValue: true,
|
|
431
431
|
message: "Update .vscode/settings.json for better VS Code experience?"
|
|
432
432
|
});
|
|
@@ -434,7 +434,7 @@ async function run(options = {}) {
|
|
|
434
434
|
},
|
|
435
435
|
{
|
|
436
436
|
onCancel: () => {
|
|
437
|
-
|
|
437
|
+
(0, import_prompts5.cancel)("Operation cancelled.");
|
|
438
438
|
import_node_process4.default.exit(0);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
@@ -447,8 +447,8 @@ async function run(options = {}) {
|
|
|
447
447
|
await updateEslintFiles();
|
|
448
448
|
await updateVscodeSettings(result);
|
|
449
449
|
await addTsconfigBuild();
|
|
450
|
-
|
|
451
|
-
|
|
450
|
+
import_prompts5.log.success(import_picocolors5.default.green(`Setup completed`));
|
|
451
|
+
(0, import_prompts5.outro)(`Now you can update the dependencies and run ${import_picocolors5.default.blue("eslint . --fix")}
|
|
452
452
|
`);
|
|
453
453
|
}
|
|
454
454
|
|
|
@@ -457,7 +457,7 @@ function header() {
|
|
|
457
457
|
console.log("\n");
|
|
458
458
|
const introText = `${import_picocolors6.default.green("@isentinel/eslint-config")}`;
|
|
459
459
|
const versionText = `v${package_default.version}`;
|
|
460
|
-
|
|
460
|
+
(0, import_prompts6.intro)(introText + import_picocolors6.default.dim(versionText));
|
|
461
461
|
}
|
|
462
462
|
var instance = (0, import_yargs.default)((0, import_helpers.hideBin)(import_node_process5.default.argv)).scriptName("@isentinel/eslint-config").usage("").command(
|
|
463
463
|
"*",
|
|
@@ -478,8 +478,8 @@ var instance = (0, import_yargs.default)((0, import_helpers.hideBin)(import_node
|
|
|
478
478
|
try {
|
|
479
479
|
await run(args);
|
|
480
480
|
} catch (err) {
|
|
481
|
-
|
|
482
|
-
|
|
481
|
+
import_prompts6.log.error(import_picocolors6.default.inverse(import_picocolors6.default.red(" Failed to migrate ")));
|
|
482
|
+
import_prompts6.log.error(import_picocolors6.default.red(`\u2718 ${String(err)}`));
|
|
483
483
|
import_node_process5.default.exit(1);
|
|
484
484
|
}
|
|
485
485
|
}
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_esm_shims
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6J6ZEY37.js";
|
|
4
4
|
|
|
5
5
|
// src/cli.ts
|
|
6
6
|
init_esm_shims();
|
|
7
7
|
|
|
8
8
|
// src/cli/index.ts
|
|
9
9
|
init_esm_shims();
|
|
10
|
-
import
|
|
10
|
+
import { intro, log as log6 } from "@clack/prompts";
|
|
11
11
|
import process6 from "node:process";
|
|
12
12
|
import pico6 from "picocolors";
|
|
13
13
|
import yargs from "yargs";
|
|
@@ -19,7 +19,7 @@ init_esm_shims();
|
|
|
19
19
|
// package.json
|
|
20
20
|
var package_default = {
|
|
21
21
|
name: "@isentinel/eslint-config",
|
|
22
|
-
version: "0.7.
|
|
22
|
+
version: "0.7.5",
|
|
23
23
|
description: "iSentinel's ESLint config",
|
|
24
24
|
keywords: [
|
|
25
25
|
"eslint-config",
|
|
@@ -69,18 +69,18 @@ var package_default = {
|
|
|
69
69
|
dependencies: {
|
|
70
70
|
"@antfu/install-pkg": "0.3.3",
|
|
71
71
|
"@clack/prompts": "0.7.0",
|
|
72
|
-
"@cspell/eslint-plugin": "8.
|
|
72
|
+
"@cspell/eslint-plugin": "8.13.1",
|
|
73
73
|
"@eslint/compat": "1.1.1",
|
|
74
74
|
"@isentinel/dict-rbxts": "1.0.1",
|
|
75
75
|
"@isentinel/dict-roblox": "1.0.3",
|
|
76
76
|
"@isentinel/eslint-plugin-comment-length": "1.7.3",
|
|
77
77
|
"@shopify/eslint-plugin": "46.0.0",
|
|
78
|
-
"@stylistic/eslint-plugin": "2.
|
|
79
|
-
"@typescript-eslint/eslint-plugin": "
|
|
80
|
-
"@typescript-eslint/parser": "
|
|
78
|
+
"@stylistic/eslint-plugin": "2.6.1",
|
|
79
|
+
"@typescript-eslint/eslint-plugin": "8.0.0",
|
|
80
|
+
"@typescript-eslint/parser": "8.0.0",
|
|
81
81
|
"eslint-config-flat-gitignore": "0.1.8",
|
|
82
82
|
"eslint-config-prettier": "9.1.0",
|
|
83
|
-
"eslint-flat-config-utils": "0.
|
|
83
|
+
"eslint-flat-config-utils": "0.3.0",
|
|
84
84
|
"eslint-merge-processors": "0.1.0",
|
|
85
85
|
"eslint-plugin-antfu": "2.3.4",
|
|
86
86
|
"eslint-plugin-arrow-return-style": "1.3.1",
|
|
@@ -88,12 +88,12 @@ var package_default = {
|
|
|
88
88
|
"eslint-plugin-format": "0.1.2",
|
|
89
89
|
"eslint-plugin-format-lua": "0.1.0",
|
|
90
90
|
"eslint-plugin-import-x": "3.1.0",
|
|
91
|
-
"eslint-plugin-jsdoc": "48.
|
|
91
|
+
"eslint-plugin-jsdoc": "48.11.0",
|
|
92
92
|
"eslint-plugin-jsonc": "2.16.0",
|
|
93
93
|
"eslint-plugin-markdown": "5.1.0",
|
|
94
94
|
"eslint-plugin-no-autofix": "2.0.0",
|
|
95
95
|
"eslint-plugin-package-json": "0.15.2",
|
|
96
|
-
"eslint-plugin-perfectionist": "3.
|
|
96
|
+
"eslint-plugin-perfectionist": "3.1.0",
|
|
97
97
|
"eslint-plugin-promise": "7.0.0",
|
|
98
98
|
"eslint-plugin-sonarjs": "1.0.4",
|
|
99
99
|
"eslint-plugin-toml": "0.11.1",
|
|
@@ -113,13 +113,13 @@ var package_default = {
|
|
|
113
113
|
},
|
|
114
114
|
devDependencies: {
|
|
115
115
|
"@antfu/ni": "0.22.0",
|
|
116
|
-
"@eslint-react/eslint-plugin": "1.
|
|
116
|
+
"@eslint-react/eslint-plugin": "1.8.2",
|
|
117
117
|
"@eslint/config-inspector": "0.5.2",
|
|
118
118
|
"@isentinel/eslint-config": "workspace:*",
|
|
119
|
-
"@stylistic/eslint-plugin-migrate": "2.
|
|
120
|
-
"@types/eslint": "
|
|
119
|
+
"@stylistic/eslint-plugin-migrate": "2.6.1",
|
|
120
|
+
"@types/eslint": "9.6.0",
|
|
121
121
|
"@types/fs-extra": "11.0.4",
|
|
122
|
-
"@types/node": "20.14.
|
|
122
|
+
"@types/node": "20.14.13",
|
|
123
123
|
"@types/prompts": "2.4.9",
|
|
124
124
|
"@types/yargs": "17.0.32",
|
|
125
125
|
bumpp: "9.4.1",
|
|
@@ -127,7 +127,7 @@ var package_default = {
|
|
|
127
127
|
eslint: "9.8.0",
|
|
128
128
|
"eslint-plugin-react-hooks": "4.6.2",
|
|
129
129
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
130
|
-
"eslint-typegen": "0.
|
|
130
|
+
"eslint-typegen": "0.3.0",
|
|
131
131
|
esno: "4.7.0",
|
|
132
132
|
execa: "9.3.0",
|
|
133
133
|
"fast-glob": "3.3.2",
|
|
@@ -139,7 +139,7 @@ var package_default = {
|
|
|
139
139
|
typescript: "5.5.4"
|
|
140
140
|
},
|
|
141
141
|
peerDependencies: {
|
|
142
|
-
"@eslint-react/eslint-plugin": "^1.
|
|
142
|
+
"@eslint-react/eslint-plugin": "^1.8.0",
|
|
143
143
|
eslint: ">=8.40.0",
|
|
144
144
|
"eslint-plugin-react-hooks": "^4.6.0"
|
|
145
145
|
},
|
|
@@ -204,7 +204,7 @@ var dependenciesMap = {
|
|
|
204
204
|
|
|
205
205
|
// src/cli/run.ts
|
|
206
206
|
init_esm_shims();
|
|
207
|
-
import
|
|
207
|
+
import { cancel, confirm, group, log as log5, outro } from "@clack/prompts";
|
|
208
208
|
import fs4 from "node:fs";
|
|
209
209
|
import path5 from "node:path";
|
|
210
210
|
import process5 from "node:process";
|
|
@@ -212,7 +212,7 @@ import pico5 from "picocolors";
|
|
|
212
212
|
|
|
213
213
|
// src/cli/stages/add-tsconfig.build.json.ts
|
|
214
214
|
init_esm_shims();
|
|
215
|
-
import
|
|
215
|
+
import { log } from "@clack/prompts";
|
|
216
216
|
import fs from "node:fs";
|
|
217
217
|
import fsp from "node:fs/promises";
|
|
218
218
|
import path from "path";
|
|
@@ -221,7 +221,7 @@ async function addTsconfigBuild() {
|
|
|
221
221
|
const cwd = process.cwd();
|
|
222
222
|
const pathTsconfigBuild = path.join(cwd, "tsconfig.build.json");
|
|
223
223
|
if (fs.existsSync(pathTsconfigBuild)) {
|
|
224
|
-
|
|
224
|
+
log.info(pico.yellow("tsconfig.build.json already exists"));
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
227
|
const tsconfigBuildContent = `{
|
|
@@ -231,8 +231,8 @@ async function addTsconfigBuild() {
|
|
|
231
231
|
}
|
|
232
232
|
`;
|
|
233
233
|
await fsp.writeFile(pathTsconfigBuild, tsconfigBuildContent, "utf-8");
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
log.success(pico.green(`Created tsconfig.build.json`));
|
|
235
|
+
log.info(
|
|
236
236
|
pico.yellow(
|
|
237
237
|
`You must add '"exclude": ["./eslint.config.ts"]' to your tsconfig.json. In the future, this will be done automatically.`
|
|
238
238
|
)
|
|
@@ -241,7 +241,7 @@ async function addTsconfigBuild() {
|
|
|
241
241
|
|
|
242
242
|
// src/cli/stages/update-eslint-files.ts
|
|
243
243
|
init_esm_shims();
|
|
244
|
-
import
|
|
244
|
+
import { log as log2, note } from "@clack/prompts";
|
|
245
245
|
import fs2 from "node:fs";
|
|
246
246
|
import fsp2 from "node:fs/promises";
|
|
247
247
|
import path2 from "node:path";
|
|
@@ -283,7 +283,7 @@ async function updateEslintFiles() {
|
|
|
283
283
|
const pathFlatConfig = path2.join(cwd, configFileName);
|
|
284
284
|
const eslintIgnores = [];
|
|
285
285
|
if (fs2.existsSync(pathESLintIgnore)) {
|
|
286
|
-
|
|
286
|
+
log2.step(pico2.cyan(`Migrating existing .eslintignore`));
|
|
287
287
|
const content = await fsp2.readFile(pathESLintIgnore, "utf-8");
|
|
288
288
|
const parsed = parse(content);
|
|
289
289
|
const globs = parsed.globs();
|
|
@@ -311,7 +311,7 @@ async function updateEslintFiles() {
|
|
|
311
311
|
const additionalConfig = [];
|
|
312
312
|
const eslintConfigContent = getEslintConfigContent(mainConfig, additionalConfig);
|
|
313
313
|
await fsp2.writeFile(pathFlatConfig, eslintConfigContent);
|
|
314
|
-
|
|
314
|
+
log2.success(pico2.green(`Created ${configFileName}`));
|
|
315
315
|
const files = fs2.readdirSync(cwd);
|
|
316
316
|
const legacyConfig = [];
|
|
317
317
|
for (const file of files) {
|
|
@@ -320,13 +320,13 @@ async function updateEslintFiles() {
|
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
if (legacyConfig.length) {
|
|
323
|
-
|
|
323
|
+
note(`${pico2.dim(legacyConfig.join(", "))}`, "You can now remove those files manually");
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
// src/cli/stages/update-package-json.ts
|
|
328
328
|
init_esm_shims();
|
|
329
|
-
import
|
|
329
|
+
import { log as log3, note as note2 } from "@clack/prompts";
|
|
330
330
|
import fsp3 from "node:fs/promises";
|
|
331
331
|
import path3 from "node:path";
|
|
332
332
|
import process3 from "node:process";
|
|
@@ -334,7 +334,7 @@ import pico3 from "picocolors";
|
|
|
334
334
|
async function updatePackageJson() {
|
|
335
335
|
const cwd = process3.cwd();
|
|
336
336
|
const pathPackageJSON = path3.join(cwd, "package.json");
|
|
337
|
-
|
|
337
|
+
log3.step(pico3.cyan(`Bumping @isentinel/eslint-config to v${package_default.version}`));
|
|
338
338
|
const packageContent = await fsp3.readFile(pathPackageJSON, "utf-8");
|
|
339
339
|
const package_ = JSON.parse(packageContent);
|
|
340
340
|
package_.devDependencies ??= {};
|
|
@@ -346,15 +346,15 @@ async function updatePackageJson() {
|
|
|
346
346
|
addedPackages.push(dep);
|
|
347
347
|
}
|
|
348
348
|
if (addedPackages.length) {
|
|
349
|
-
|
|
349
|
+
note2(`${pico3.dim(addedPackages.join(", "))}`, "Added packages");
|
|
350
350
|
}
|
|
351
351
|
await fsp3.writeFile(pathPackageJSON, JSON.stringify(package_, null, 2));
|
|
352
|
-
|
|
352
|
+
log3.success(pico3.green(`Changes wrote to package.json`));
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
// src/cli/stages/update-vscode-settings.ts
|
|
356
356
|
init_esm_shims();
|
|
357
|
-
import
|
|
357
|
+
import { log as log4 } from "@clack/prompts";
|
|
358
358
|
import fs3 from "node:fs";
|
|
359
359
|
import fsp4 from "node:fs/promises";
|
|
360
360
|
import path4 from "node:path";
|
|
@@ -373,7 +373,7 @@ async function updateVscodeSettings(result) {
|
|
|
373
373
|
if (!fs3.existsSync(settingsPath)) {
|
|
374
374
|
await fsp4.writeFile(settingsPath, `{${vscodeSettingsString}}
|
|
375
375
|
`, "utf-8");
|
|
376
|
-
|
|
376
|
+
log4.success(pico4.green(`Created .vscode/settings.json`));
|
|
377
377
|
return;
|
|
378
378
|
}
|
|
379
379
|
let settingsContent = await fsp4.readFile(settingsPath, "utf8");
|
|
@@ -382,7 +382,7 @@ async function updateVscodeSettings(result) {
|
|
|
382
382
|
settingsContent += `${vscodeSettingsString}}
|
|
383
383
|
`;
|
|
384
384
|
await fsp4.writeFile(settingsPath, settingsContent, "utf-8");
|
|
385
|
-
|
|
385
|
+
log4.success(pico4.green(`Updated .vscode/settings.json`));
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
// src/cli/run.ts
|
|
@@ -390,7 +390,7 @@ async function run(options = {}) {
|
|
|
390
390
|
const argumentSkipPrompt = !!process5.env.SKIP_PROMPT || options.yes;
|
|
391
391
|
const argumentTemplate = ["react"];
|
|
392
392
|
if (fs4.existsSync(path5.join(process5.cwd(), "eslint.config.js"))) {
|
|
393
|
-
|
|
393
|
+
log5.warn(pico5.yellow(`eslint.config.js already exists, migration wizard exited.`));
|
|
394
394
|
return process5.exit(1);
|
|
395
395
|
}
|
|
396
396
|
let result = {
|
|
@@ -399,13 +399,13 @@ async function run(options = {}) {
|
|
|
399
399
|
updateVscodeSettings: true
|
|
400
400
|
};
|
|
401
401
|
if (!argumentSkipPrompt) {
|
|
402
|
-
result = await
|
|
402
|
+
result = await group(
|
|
403
403
|
{
|
|
404
404
|
uncommittedConfirmed: () => {
|
|
405
405
|
if (argumentSkipPrompt || isGitClean()) {
|
|
406
406
|
return Promise.resolve(true);
|
|
407
407
|
}
|
|
408
|
-
return
|
|
408
|
+
return confirm({
|
|
409
409
|
initialValue: false,
|
|
410
410
|
message: "There are uncommitted changes in the current repository, are you sure to continue?"
|
|
411
411
|
});
|
|
@@ -414,7 +414,7 @@ async function run(options = {}) {
|
|
|
414
414
|
if (!results.uncommittedConfirmed) {
|
|
415
415
|
return;
|
|
416
416
|
}
|
|
417
|
-
return
|
|
417
|
+
return confirm({
|
|
418
418
|
initialValue: true,
|
|
419
419
|
message: "Update .vscode/settings.json for better VS Code experience?"
|
|
420
420
|
});
|
|
@@ -422,7 +422,7 @@ async function run(options = {}) {
|
|
|
422
422
|
},
|
|
423
423
|
{
|
|
424
424
|
onCancel: () => {
|
|
425
|
-
|
|
425
|
+
cancel("Operation cancelled.");
|
|
426
426
|
process5.exit(0);
|
|
427
427
|
}
|
|
428
428
|
}
|
|
@@ -435,8 +435,8 @@ async function run(options = {}) {
|
|
|
435
435
|
await updateEslintFiles();
|
|
436
436
|
await updateVscodeSettings(result);
|
|
437
437
|
await addTsconfigBuild();
|
|
438
|
-
|
|
439
|
-
|
|
438
|
+
log5.success(pico5.green(`Setup completed`));
|
|
439
|
+
outro(`Now you can update the dependencies and run ${pico5.blue("eslint . --fix")}
|
|
440
440
|
`);
|
|
441
441
|
}
|
|
442
442
|
|
|
@@ -445,7 +445,7 @@ function header() {
|
|
|
445
445
|
console.log("\n");
|
|
446
446
|
const introText = `${pico6.green("@isentinel/eslint-config")}`;
|
|
447
447
|
const versionText = `v${package_default.version}`;
|
|
448
|
-
|
|
448
|
+
intro(introText + pico6.dim(versionText));
|
|
449
449
|
}
|
|
450
450
|
var instance = yargs(hideBin(process6.argv)).scriptName("@isentinel/eslint-config").usage("").command(
|
|
451
451
|
"*",
|
|
@@ -466,8 +466,8 @@ var instance = yargs(hideBin(process6.argv)).scriptName("@isentinel/eslint-confi
|
|
|
466
466
|
try {
|
|
467
467
|
await run(args);
|
|
468
468
|
} catch (err) {
|
|
469
|
-
|
|
470
|
-
|
|
469
|
+
log6.error(pico6.inverse(pico6.red(" Failed to migrate ")));
|
|
470
|
+
log6.error(pico6.red(`\u2718 ${String(err)}`));
|
|
471
471
|
process6.exit(1);
|
|
472
472
|
}
|
|
473
473
|
}
|