@isentinel/eslint-config 1.2.3 → 1.2.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/README.md CHANGED
@@ -81,6 +81,8 @@ export default style(
81
81
  > Note that `.eslintignore` no longer works in Flat config, see
82
82
  > [customization](#customization) for more details.
83
83
 
84
+ </details>
85
+
84
86
  ### Add script for package.json
85
87
 
86
88
  For example:
@@ -10,10 +10,6 @@ var __esm = (fn, res) => function __init() {
10
10
  var __commonJS = (cb, mod) => function __require() {
11
11
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
12
  };
13
- var __export = (target, all) => {
14
- for (var name in all)
15
- __defProp(target, name, { get: all[name], enumerable: true });
16
- };
17
13
  var __copyProps = (to, from, except, desc) => {
18
14
  if (from && typeof from === "object" || typeof from === "function") {
19
15
  for (let key of __getOwnPropNames(from))
@@ -40,7 +36,6 @@ var init_esm_shims = __esm({
40
36
 
41
37
  export {
42
38
  __commonJS,
43
- __export,
44
39
  __toESM,
45
40
  init_esm_shims
46
41
  };
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-YSIDNL3J.js";
3
+ } from "./chunk-2HV5XKT7.js";
4
4
 
5
5
  // src/cli.ts
6
6
  init_esm_shims();
@@ -18,7 +18,7 @@ init_esm_shims();
18
18
  import ansis from "ansis";
19
19
 
20
20
  // package.json
21
- var version = "1.2.3";
21
+ var version = "1.2.5";
22
22
  var package_default = {
23
23
  name: "@isentinel/eslint-config",
24
24
  version,
@@ -54,7 +54,7 @@ var package_default = {
54
54
  build: "nr gen && tsup --clean --dts",
55
55
  "build:inspector": "pnpm build && npx @eslint/config-inspector build",
56
56
  dev: "npx @eslint/config-inspector --config eslint.config.ts",
57
- gen: "NODE_OPTIONS='--import ./scripts/register-stylua-loader.mjs' tsx scripts/typegen.ts && NODE_OPTIONS='--import ./scripts/register-stylua-loader.mjs' tsx scripts/versiongen.ts",
57
+ gen: "tsx scripts/typegen.ts && tsx scripts/versiongen.ts",
58
58
  postgen: "echo 'Generation complete!'",
59
59
  lint: "eslint",
60
60
  prepack: "nr build",
@@ -329,7 +329,7 @@ var versionsMap = {
329
329
  };
330
330
 
331
331
  // src/cli/stages/update-package-json.ts
332
- async function updatePackageJson() {
332
+ async function updatePackageJson(result) {
333
333
  const cwd = process2.cwd();
334
334
  const pathPackageJSON = path2.join(cwd, "package.json");
335
335
  log2.step(ansis3.cyan(`Bumping @isentinel/eslint-config to v${version}`));
@@ -339,9 +339,13 @@ async function updatePackageJson() {
339
339
  parsedPackage.devDependencies["@isentinel/eslint-config"] = `^${version}`;
340
340
  parsedPackage.devDependencies.eslint ??= versionsMap.eslint;
341
341
  const addedPackages = [];
342
- for (const dep of dependenciesMap["react"]) {
343
- parsedPackage.devDependencies[dep] = versionsMap[dep];
344
- addedPackages.push(dep);
342
+ for (const framework of result.frameworks) {
343
+ if (framework in dependenciesMap) {
344
+ for (const dep of dependenciesMap[framework]) {
345
+ parsedPackage.devDependencies[dep] = versionsMap[dep];
346
+ addedPackages.push(dep);
347
+ }
348
+ }
345
349
  }
346
350
  if (addedPackages.length) {
347
351
  note2(`${ansis3.dim(addedPackages.join(", "))}`, "Added packages");
@@ -386,41 +390,42 @@ async function updateVscodeSettings(result) {
386
390
  // src/cli/run.ts
387
391
  async function run(options = {}) {
388
392
  const argumentSkipPrompt = !!process4.env.SKIP_PROMPT || options.yes;
389
- const argumentTemplate = options.frameworks?.map((framework) => framework?.trim()).filter(Boolean);
393
+ const argumentTemplate = options.frameworks?.map((framework) => framework.trim());
390
394
  const eslintConfigFiles = fs3.readdirSync(process4.cwd()).filter((file) => file.startsWith("eslint.config."));
391
395
  if (eslintConfigFiles.length > 0) {
392
396
  log4.warn(ansis5.yellow(`${eslintConfigFiles[0]} already exists, migration wizard exited.`));
393
397
  return process4.exit(1);
394
398
  }
395
399
  let result = {
396
- frameworks: argumentTemplate,
400
+ frameworks: argumentTemplate ?? [],
397
401
  uncommittedConfirmed: false,
398
402
  updateVscodeSettings: true
399
403
  };
400
404
  if (!argumentSkipPrompt) {
401
405
  result = await group(
402
406
  {
407
+ uncommittedConfirmed: () => {
408
+ if (argumentSkipPrompt || isGitClean()) {
409
+ return Promise.resolve(true);
410
+ }
411
+ return confirm({
412
+ initialValue: false,
413
+ message: "There are uncommitted changes in the current repository, are you sure to continue?"
414
+ });
415
+ },
416
+ // eslint-disable-next-line perfectionist/sort-objects -- keep the order of prompts
403
417
  frameworks: ({ results }) => {
404
- const isArgumentTemplateValid = typeof argumentTemplate === "string" && !!frameworks.includes(argumentTemplate);
418
+ const isArgumentTemplateValid = argumentTemplate && argumentTemplate.length > 0 && argumentTemplate.every((template) => frameworks.includes(template));
405
419
  if (!results.uncommittedConfirmed || isArgumentTemplateValid) {
406
420
  return;
407
421
  }
408
- const message = !isArgumentTemplateValid && argumentTemplate ? `"${argumentTemplate}" isn't a valid template. Please choose from below: ` : "Select a framework:";
422
+ const message = argumentTemplate && argumentTemplate.length > 0 && !isArgumentTemplateValid ? `"${argumentTemplate.join(", ")}" isn't a valid template. Please choose from below: ` : "Select a framework:";
409
423
  return multiselect({
410
424
  message: ansis5.reset(message),
411
425
  options: frameworkOptions,
412
426
  required: false
413
427
  });
414
428
  },
415
- uncommittedConfirmed: () => {
416
- if (argumentSkipPrompt || isGitClean()) {
417
- return Promise.resolve(true);
418
- }
419
- return confirm({
420
- initialValue: false,
421
- message: "There are uncommitted changes in the current repository, are you sure to continue?"
422
- });
423
- },
424
429
  updateVscodeSettings: ({ results }) => {
425
430
  if (!results.uncommittedConfirmed) {
426
431
  return;
@@ -442,7 +447,7 @@ async function run(options = {}) {
442
447
  return process4.exit(1);
443
448
  }
444
449
  }
445
- await updatePackageJson();
450
+ await updatePackageJson(result);
446
451
  await updateEslintFiles(result);
447
452
  await updateVscodeSettings(result);
448
453
  log4.success(ansis5.green("Setup completed"));
@@ -469,14 +474,17 @@ var instance = yargs(hideBin(process5.argv)).scriptName("@isentinel/eslint-confi
469
474
  type: "boolean"
470
475
  }).option("template", {
471
476
  alias: "t",
472
- description: "Use the framework template for optimal customization: react",
477
+ description: "Use the framework template for optimal customization: react, jest",
473
478
  type: "string"
474
479
  }).help();
475
480
  },
476
481
  async (args) => {
477
482
  header();
478
483
  try {
479
- await run(args);
484
+ await run({
485
+ ...args,
486
+ frameworks: args.template ? [args.template] : void 0
487
+ });
480
488
  } catch (err) {
481
489
  log5.error(ansis6.inverse(ansis6.red(" Failed to migrate ")));
482
490
  log5.error(ansis6.red(`\u2718 ${String(err)}`));
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __commonJS,
3
3
  init_esm_shims
4
- } from "./chunk-YSIDNL3J.js";
4
+ } from "./chunk-2HV5XKT7.js";
5
5
 
6
6
  // node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-simple-import-sort/shared.js
7
7
  var require_shared = __commonJS({
package/dist/index.d.ts CHANGED
@@ -14989,7 +14989,7 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
14989
14989
  onlyEquality?: boolean
14990
14990
  }]
14991
14991
  // Names of all the configs
14992
- type ConfigNames = 'style/eslint/comments' | 'style/formatters/setup' | 'style/ignores' | 'style/imports' | 'style/import-sort' | 'style/imports/game' | 'style/javascript/setup' | 'style/javascript/rules' | 'style/jsdoc' | 'style/jsonc/setup' | 'style/jsonc/rules' | 'style/markdown/setup' | 'style/markdown/processor' | 'style/markdown/parser' | 'style/markdown/disables' | 'style/package-json' | 'style/perfectionist' | 'style/pnpm/package-json' | 'style/pnpm/pnpm-workspace-yaml' | 'style/prettier' | 'style/promise' | 'style/react/setup' | 'style/react/rules' | 'style/react/type-aware-rules' | 'style/roblox' | 'style/shopify' | 'style/sonarjs' | 'style/sort-tsconfig' | 'style/spelling' | 'style/stylistic' | 'style/test/setup' | 'style/test/rules' | 'style/typescript/setup' | 'style/typescript/parser' | 'style/typescript/type-aware-parser' | 'style/typescript/rules' | 'style/unicorn' | 'style/yaml:setup' | 'style/yaml/rules'
14992
+ type ConfigNames = 'style/eslint/comments' | 'style/formatters/setup' | 'style/ignores' | 'style/imports' | 'style/import-sort' | 'style/imports/game' | 'style/javascript/setup' | 'style/javascript/rules' | 'style/jsdoc' | 'style/jsonc/setup' | 'style/jsonc/rules' | 'style/markdown/setup' | 'style/markdown/processor' | 'style/markdown/parser' | 'style/markdown/disables' | 'style/package-json' | 'style/perfectionist' | 'style/pnpm/package-json' | 'style/pnpm/pnpm-workspace-yaml' | 'style/prettier' | 'style/promise' | 'style/react/setup' | 'style/react/rules' | 'style/react/type-aware-rules' | 'style/roblox' | 'style/shopify' | 'style/sonarjs' | 'style/sort-tsconfig' | 'style/spelling' | 'style/stylistic' | 'style/test/setup' | 'style/test/rules' | 'style/typescript/setup' | 'style/typescript/parser' | 'style/typescript/type-aware-parser' | 'style/typescript/rules' | 'style/typescript/rules-type-aware' | 'style/unicorn' | 'style/yaml:setup' | 'style/yaml/rules'
14993
14993
 
14994
14994
  type Awaitable<T> = Promise<T> | T;
14995
14995
  interface JsDocOptions {
@@ -15223,6 +15223,8 @@ interface OptionsTypeScriptParserOptions {
15223
15223
  parserOptions?: Partial<ParserOptions>;
15224
15224
  }
15225
15225
  interface OptionsTypeScriptWithTypes {
15226
+ /** Override type aware rules. */
15227
+ overridesTypeAware?: TypedFlatConfigItem["rules"];
15226
15228
  /**
15227
15229
  * Provide a path to the TypeScript configuration file to use a different
15228
15230
  * default to 'tsconfig.json'.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  __commonJS,
3
3
  __toESM,
4
4
  init_esm_shims
5
- } from "./chunk-YSIDNL3J.js";
5
+ } from "./chunk-2HV5XKT7.js";
6
6
 
7
7
  // node_modules/.pnpm/globals@15.15.0/node_modules/globals/globals.json
8
8
  var require_globals = __commonJS({
@@ -3632,7 +3632,7 @@ async function imports(options = {}) {
3632
3632
  const { stylistic: stylistic2 = true, type = "game" } = options;
3633
3633
  const [pluginImport, pluginSimpleImportSort, pluginAntfu] = await Promise.all([
3634
3634
  interopDefault(import("eslint-plugin-import-x")),
3635
- interopDefault(import("./eslint-plugin-simple-import-sort-DVWQC4YV.js")),
3635
+ interopDefault(import("./eslint-plugin-simple-import-sort-FWMVSWU4.js")),
3636
3636
  interopDefault(import("eslint-plugin-antfu"))
3637
3637
  ]);
3638
3638
  return [
@@ -4362,7 +4362,7 @@ async function prettier(options) {
4362
4362
  interopDefault(import("eslint-plugin-format"))
4363
4363
  ]);
4364
4364
  const defaultPrettierOptions = {
4365
- arrowParens: "avoid",
4365
+ arrowParens: "always",
4366
4366
  jsdocPreferCodeFences: true,
4367
4367
  jsdocPrintWidth: 80,
4368
4368
  plugins: [require2.resolve("prettier-plugin-jsdoc")],
@@ -4702,7 +4702,7 @@ async function roblox(options = {}, formatLua = true) {
4702
4702
  });
4703
4703
  if (formatLua) {
4704
4704
  const [pluginFormatLua] = await Promise.all([
4705
- interopDefault(import("./dist-3XXODFPQ.js"))
4705
+ interopDefault(import("eslint-plugin-format-lua"))
4706
4706
  ]);
4707
4707
  configs.push({
4708
4708
  files: [GLOB_LUA],
@@ -5064,6 +5064,7 @@ async function typescript(options = {}) {
5064
5064
  componentExts: componentExtensions = [],
5065
5065
  isInEditor = false,
5066
5066
  overrides = {},
5067
+ overridesTypeAware = {},
5067
5068
  parserOptions = {},
5068
5069
  stylistic: stylistic2 = true,
5069
5070
  typeAware = true
@@ -5361,10 +5362,20 @@ async function typescript(options = {}) {
5361
5362
  ],
5362
5363
  "yoda": ["error", "never"]
5363
5364
  } : {},
5364
- ...tsconfigPath ? typeAwareRules : {},
5365
5365
  ...overrides
5366
5366
  }
5367
- }
5367
+ },
5368
+ ...isTypeAware ? [
5369
+ {
5370
+ files: filesTypeAware,
5371
+ ignores: ignoresTypeAware,
5372
+ name: "style/typescript/rules-type-aware",
5373
+ rules: {
5374
+ ...typeAwareRules,
5375
+ ...overridesTypeAware
5376
+ }
5377
+ }
5378
+ ] : []
5368
5379
  ];
5369
5380
  }
5370
5381
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isentinel/eslint-config",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "iSentinel's ESLint config",
5
5
  "keywords": [
6
6
  "eslint-config",
@@ -59,7 +59,7 @@
59
59
  "eslint-plugin-comment-length": "2.2.1",
60
60
  "eslint-plugin-de-morgan": "1.2.1",
61
61
  "eslint-plugin-format": "1.0.1",
62
- "eslint-plugin-format-lua": "1.0.0",
62
+ "eslint-plugin-format-lua": "1.0.1-beta.2",
63
63
  "eslint-plugin-import-x": "4.10.6",
64
64
  "eslint-plugin-jsdoc": "50.6.9",
65
65
  "eslint-plugin-jsonc": "2.20.0",
@@ -93,7 +93,7 @@
93
93
  "@types/node": "22.14.1",
94
94
  "@types/prompts": "2.4.9",
95
95
  "@types/yargs": "17.0.33",
96
- "bumpp": "10.1.0",
96
+ "bumpp": "10.2.0",
97
97
  "eslint": "9.25.1",
98
98
  "eslint-plugin-jest": "28.11.0",
99
99
  "eslint-plugin-react-roblox-hooks": "5.1.0-rbx.1",
@@ -110,7 +110,7 @@
110
110
  "simple-git-hooks": "2.12.1",
111
111
  "tsup": "8.4.0",
112
112
  "typescript": "5.8.3",
113
- "@isentinel/eslint-config": "1.2.3"
113
+ "@isentinel/eslint-config": "1.2.5"
114
114
  },
115
115
  "peerDependencies": {
116
116
  "@eslint-react/eslint-plugin": "^1.45.0",
@@ -136,7 +136,7 @@
136
136
  "build": "nr gen && tsup --clean --dts",
137
137
  "build:inspector": "pnpm build && npx @eslint/config-inspector build",
138
138
  "dev": "npx @eslint/config-inspector --config eslint.config.ts",
139
- "gen": "NODE_OPTIONS='--import ./scripts/register-stylua-loader.mjs' tsx scripts/typegen.ts && NODE_OPTIONS='--import ./scripts/register-stylua-loader.mjs' tsx scripts/versiongen.ts",
139
+ "gen": "tsx scripts/typegen.ts && tsx scripts/versiongen.ts",
140
140
  "postgen": "echo 'Generation complete!'",
141
141
  "lint": "eslint",
142
142
  "release": "bumpp",