@ncontiero/eslint-config 8.0.1 → 8.1.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/dist/index.d.mts CHANGED
@@ -51,12 +51,12 @@ interface RuleOptions {
51
51
  */
52
52
  'accessor-pairs'?: Linter.RuleEntry<AccessorPairs>;
53
53
  /**
54
- * Having line breaks styles to object, array and named imports
54
+ * Enforce consistent line breaks for chaining member access
55
55
  * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/consistent-chaining.md
56
56
  */
57
57
  'antfu/consistent-chaining'?: Linter.RuleEntry<AntfuConsistentChaining>;
58
58
  /**
59
- * Having line breaks styles to object, array and named imports
59
+ * Enforce consistent line breaks inside braces and parentheses
60
60
  * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/consistent-list-newline.md
61
61
  */
62
62
  'antfu/consistent-list-newline'?: Linter.RuleEntry<AntfuConsistentListNewline>;
@@ -82,22 +82,22 @@ interface RuleOptions {
82
82
  'antfu/indent-unindent'?: Linter.RuleEntry<AntfuIndentUnindent>;
83
83
  /**
84
84
  * Prevent importing modules in `dist` folder
85
- * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-dist.test.ts
85
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-dist.md
86
86
  */
87
87
  'antfu/no-import-dist'?: Linter.RuleEntry<[]>;
88
88
  /**
89
89
  * Prevent importing modules in `node_modules` folder by relative or absolute path
90
- * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-node-modules-by-path.test.ts
90
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-node-modules-by-path.md
91
91
  */
92
92
  'antfu/no-import-node-modules-by-path'?: Linter.RuleEntry<[]>;
93
93
  /**
94
94
  * Prevent using top-level await
95
- * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-top-level-await.test.ts
95
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-top-level-await.md
96
96
  */
97
97
  'antfu/no-top-level-await'?: Linter.RuleEntry<[]>;
98
98
  /**
99
99
  * Do not use `exports =`
100
- * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-ts-export-equal.test.ts
100
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-ts-export-equal.md
101
101
  */
102
102
  'antfu/no-ts-export-equal'?: Linter.RuleEntry<[]>;
103
103
  /**
@@ -16486,7 +16486,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
16486
16486
  exceptRange?: boolean;
16487
16487
  onlyEquality?: boolean;
16488
16488
  }]; // Names of all the configs
16489
- type ConfigNames = 'ncontiero/gitignore' | 'ncontiero/ignores' | 'ncontiero/javascript/rules' | 'ncontiero/javascript/cli-rules' | 'ncontiero/javascript/test-rules' | 'ncontiero/comments/rules' | 'ncontiero/jsdoc/setup' | 'ncontiero/jsdoc/rules' | 'ncontiero/imports/rules' | 'ncontiero/imports/allow-default-export' | 'ncontiero/node/setup' | 'ncontiero/node/rules' | 'ncontiero/promise/setup' | 'ncontiero/promise/rules' | 'ncontiero/command/rules' | 'ncontiero/perfectionist/rules' | 'ncontiero/de-morgan' | 'ncontiero/e18e/rules' | 'ncontiero/unicorn/rules' | 'ncontiero/jsx/setup' | 'ncontiero/typescript/setup' | 'ncontiero/typescript/parser' | 'ncontiero/typescript/rules' | 'ncontiero/typescript/dts-rules' | 'ncontiero/typescript/cjs-rules' | 'ncontiero/tanstack-query/setup' | 'ncontiero/tanstack-query/rules' | 'ncontiero/jsonc/recommended' | 'ncontiero/jsonc/recommended' | 'ncontiero/jsonc/recommended' | 'ncontiero/jsonc/rules' | 'ncontiero/sort/package-json' | 'ncontiero/sort/tsconfig' | 'ncontiero/yml/setup' | 'ncontiero/yml/rules' | 'ncontiero/yml/pnpm-workspace' | 'ncontiero/toml/setup' | 'ncontiero/toml/rules' | 'ncontiero/markdown/setup' | 'ncontiero/markdown/processor' | 'ncontiero/markdown/parser' | 'ncontiero/markdown/rules' | 'ncontiero/regexp/rules' | 'ncontiero/react/setup' | 'ncontiero/react/rules' | 'ncontiero/react/typescript' | 'ncontiero/nextjs/setup' | 'ncontiero/nextjs/rules' | 'ncontiero/html/setup' | 'ncontiero/html/rules' | 'ncontiero/tailwindcss/setup' | 'ncontiero/tailwindcss/rules' | 'ncontiero/prettier/setup' | 'ncontiero/prettier/disables' | 'ncontiero/prettier/rules' | 'ncontiero/prettier/markdown' | 'ncontiero/prettier/css' | 'ncontiero/prettier/scss' | 'ncontiero/prettier/less';
16489
+ type ConfigNames = 'ncontiero/gitignore' | 'ncontiero/ignores' | 'ncontiero/javascript/rules' | 'ncontiero/javascript/cli-rules' | 'ncontiero/javascript/test-rules' | 'ncontiero/comments/rules' | 'ncontiero/command/rules' | 'ncontiero/perfectionist/rules' | 'ncontiero/node/setup' | 'ncontiero/node/rules' | 'ncontiero/promise/setup' | 'ncontiero/promise/rules' | 'ncontiero/jsdoc/setup' | 'ncontiero/jsdoc/rules' | 'ncontiero/imports/rules' | 'ncontiero/imports/allow-default-export' | 'ncontiero/de-morgan' | 'ncontiero/e18e/rules' | 'ncontiero/unicorn/rules' | 'ncontiero/jsx/setup' | 'ncontiero/typescript/setup' | 'ncontiero/typescript/parser' | 'ncontiero/typescript/rules' | 'ncontiero/typescript/dts-rules' | 'ncontiero/typescript/cjs-rules' | 'ncontiero/tanstack-query/setup' | 'ncontiero/tanstack-query/rules' | 'ncontiero/jsonc/recommended' | 'ncontiero/jsonc/recommended' | 'ncontiero/jsonc/recommended' | 'ncontiero/jsonc/rules' | 'ncontiero/sort/package-json' | 'ncontiero/sort/tsconfig' | 'ncontiero/yml/setup' | 'ncontiero/yml/rules' | 'ncontiero/yml/pnpm-workspace' | 'ncontiero/toml/setup' | 'ncontiero/toml/rules' | 'ncontiero/markdown/setup' | 'ncontiero/markdown/processor' | 'ncontiero/markdown/parser' | 'ncontiero/markdown/rules' | 'ncontiero/regexp/rules' | 'ncontiero/react/setup' | 'ncontiero/react/rules' | 'ncontiero/react/typescript' | 'ncontiero/nextjs/setup' | 'ncontiero/nextjs/rules' | 'ncontiero/html/setup' | 'ncontiero/html/rules' | 'ncontiero/tailwindcss/setup' | 'ncontiero/tailwindcss/rules' | 'ncontiero/prettier/setup' | 'ncontiero/prettier/disables' | 'ncontiero/prettier/rules' | 'ncontiero/prettier/markdown' | 'ncontiero/prettier/css' | 'ncontiero/prettier/scss' | 'ncontiero/prettier/less';
16490
16490
  //#endregion
16491
16491
  //#region src/types.d.ts
16492
16492
  type Awaitable<T> = T | Promise<T>;
@@ -16576,12 +16576,16 @@ interface OptionsTailwindCSS extends OptionsOverrides {
16576
16576
  /**
16577
16577
  * Path to the Tailwind CSS config file.
16578
16578
  *
16579
+ * For Tailwind CSS v4 and the css based config, use the `cssGlobalPath` option instead.
16580
+ *
16581
+ * @see [better-tailwindcss settings](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#tailwindconfig)
16579
16582
  * @default "tailwind.config.ts"
16580
16583
  */
16581
16584
  configPath?: string;
16582
16585
  /**
16583
16586
  * Path to the global CSS file.
16584
16587
  *
16588
+ * @see @see [better-tailwindcss settings](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#entrypoint)
16585
16589
  * @default "src/app/globals.css"
16586
16590
  */
16587
16591
  cssGlobalPath?: string;
@@ -16589,8 +16593,27 @@ interface OptionsTailwindCSS extends OptionsOverrides {
16589
16593
  * The working directory used to resolve `tailwindcss` and related config files.
16590
16594
  * This is useful for monorepos where linting runs from the repository root
16591
16595
  * but each project has its own `node_modules` and Tailwind setup.
16596
+ *
16597
+ * @see [better-tailwindcss settings](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#cwd)
16592
16598
  */
16593
16599
  cwd?: string;
16600
+ /**
16601
+ * The path to the tsconfig file. If not specified, the plugin will try to find it automatically.
16602
+ *
16603
+ * The tsconfig is used to resolve tsconfig [`path`](https://www.typescriptlang.org/tsconfig/#paths) aliases.
16604
+ *
16605
+ * @see [better-tailwindcss settings](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#tsconfig)
16606
+ */
16607
+ tsconfigPath?: string;
16608
+ /**
16609
+ * Tailwind CSS v4 allows you to define custom component classes like `card`, `btn`, `badge` etc.
16610
+ *
16611
+ * If you want to create such classes, you can set this option to true to allow the rule to detect those classes and not report them as unknown classes.
16612
+ *
16613
+ * @see [better-tailwindcss settings](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#detectcomponentclasses)
16614
+ * @default false
16615
+ */
16616
+ detectComponentClasses?: boolean;
16594
16617
  }
16595
16618
  interface OptionsE18e extends OptionsOverrides {
16596
16619
  /**
@@ -16637,6 +16660,31 @@ interface OptionsConfig {
16637
16660
  gitignore?: boolean | FlatGitignoreOptions;
16638
16661
  /** Core rules. Can't be disabled. */
16639
16662
  javascript?: OptionsOverrides;
16663
+ /**
16664
+ * Enable Node.js rules
16665
+ *
16666
+ * @default true
16667
+ */
16668
+ node?: boolean;
16669
+ /**
16670
+ * Enable JSDoc rules
16671
+ *
16672
+ * @default true
16673
+ */
16674
+ jsdoc?: boolean;
16675
+ /**
16676
+ * Enable De Morgan rules.
16677
+ *
16678
+ * @see [eslint-plugin-de-morgan](https://github.com/azat-io/eslint-plugin-de-morgan)
16679
+ * @default true
16680
+ */
16681
+ deMorgan?: boolean;
16682
+ /**
16683
+ * Options for eslint-plugin-promise.
16684
+ *
16685
+ * @default true
16686
+ */
16687
+ promise?: boolean | OptionsOverrides;
16640
16688
  /**
16641
16689
  * Enable TypeScript support.
16642
16690
  *
@@ -16665,6 +16713,12 @@ interface OptionsConfig {
16665
16713
  * @default true
16666
16714
  */
16667
16715
  e18e?: boolean | OptionsE18e;
16716
+ /**
16717
+ * Options for eslint-plugin-import-x.
16718
+ *
16719
+ * @default true
16720
+ */
16721
+ imports?: boolean | OptionsOverrides;
16668
16722
  /**
16669
16723
  * Enable JSONC support.
16670
16724
  *
@@ -16759,7 +16813,7 @@ declare function html(options: HTMLOptions): Promise<FlatConfigItem[]>;
16759
16813
  declare function ignores(userIgnores?: string[], ignoreTypeScript?: boolean): FlatConfigItem[];
16760
16814
  //#endregion
16761
16815
  //#region src/configs/imports.d.ts
16762
- declare function imports(options?: OptionsHasNextJs): FlatConfigItem[];
16816
+ declare function imports(options?: OptionsHasNextJs & OptionsOverrides): FlatConfigItem[];
16763
16817
  //#endregion
16764
16818
  //#region src/configs/javascript.d.ts
16765
16819
  declare const restrictedSyntaxJs: string[];
@@ -16795,7 +16849,7 @@ declare function perfectionist(): FlatConfigItem[];
16795
16849
  declare function prettier(options?: PrettierOptions): Promise<FlatConfigItem[]>;
16796
16850
  //#endregion
16797
16851
  //#region src/configs/promise.d.ts
16798
- declare function promise(): Promise<FlatConfigItem[]>;
16852
+ declare function promise(options?: OptionsOverrides): Promise<FlatConfigItem[]>;
16799
16853
  //#endregion
16800
16854
  //#region src/configs/react.d.ts
16801
16855
  declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import pluginNode from "eslint-plugin-n";
7
7
  import pluginPerfectionist from "eslint-plugin-perfectionist";
8
8
  import pluginUnicorn from "eslint-plugin-unicorn";
9
9
  import pluginUnusedImports from "eslint-plugin-unused-imports";
10
- import { isPackageExists } from "local-pkg";
10
+ import { getPackageInfo, isPackageExists } from "local-pkg";
11
11
  import globals from "globals";
12
12
  import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
13
13
  import { configs } from "eslint-plugin-regexp";
@@ -322,7 +322,7 @@ function ignores(userIgnores = [], ignoreTypeScript = false) {
322
322
  //#endregion
323
323
  //#region src/configs/imports.ts
324
324
  function imports(options = {}) {
325
- const { nextJs = false } = options;
325
+ const { nextJs = false, overrides = {} } = options;
326
326
  return [{
327
327
  name: "ncontiero/imports/rules",
328
328
  plugins: {
@@ -338,7 +338,8 @@ function imports(options = {}) {
338
338
  "import/no-mutable-exports": "error",
339
339
  "import/no-named-default": "error",
340
340
  "import/no-self-import": "error",
341
- "import/no-webpack-loader-syntax": "error"
341
+ "import/no-webpack-loader-syntax": "error",
342
+ ...overrides
342
343
  }
343
344
  }, {
344
345
  files: [
@@ -443,6 +444,7 @@ function javascript(options = {}) {
443
444
  "no-shadow-restricted-names": "error",
444
445
  "no-sparse-arrays": "error",
445
446
  "no-this-before-super": "error",
447
+ "no-throw-literal": "error",
446
448
  "no-undef": "error",
447
449
  "no-unexpected-multiline": "error",
448
450
  "no-unreachable": "error",
@@ -482,6 +484,7 @@ function javascript(options = {}) {
482
484
  ignoreReadBeforeAssign: true
483
485
  }],
484
486
  "prefer-exponentiation-operator": "error",
487
+ "prefer-promise-reject-errors": "error",
485
488
  "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
486
489
  "prefer-rest-params": "error",
487
490
  "prefer-spread": "error",
@@ -892,7 +895,8 @@ async function prettier(options = {}) {
892
895
  }
893
896
  //#endregion
894
897
  //#region src/configs/promise.ts
895
- async function promise() {
898
+ async function promise(options = {}) {
899
+ const { overrides = {} } = options;
896
900
  return [{
897
901
  ...(await interopDefault(import("eslint-plugin-promise"))).configs["flat/recommended"],
898
902
  name: "ncontiero/promise/setup"
@@ -900,7 +904,8 @@ async function promise() {
900
904
  name: "ncontiero/promise/rules",
901
905
  rules: {
902
906
  "promise/always-return": ["error", { ignoreLastCallback: true }],
903
- "promise/no-multiple-resolved": "warn"
907
+ "promise/no-multiple-resolved": "warn",
908
+ ...overrides
904
909
  }
905
910
  }];
906
911
  }
@@ -1260,21 +1265,25 @@ const sortPnpmWorkspace = () => [{
1260
1265
  //#endregion
1261
1266
  //#region src/configs/tailwindcss.ts
1262
1267
  async function tailwindcss(options = {}) {
1263
- const { overrides = {} } = options;
1264
- const resolvePath = (p) => {
1265
- if (path.isAbsolute(p)) return p;
1266
- return path.resolve(process.cwd(), p);
1268
+ const { cwd, detectComponentClasses, overrides = {}, tsconfigPath } = options;
1269
+ const cssGlobalPath = options.cssGlobalPath ?? path.join("src", "app", "globals.css");
1270
+ const configPath = options.configPath ?? path.join("tailwind.config.ts");
1271
+ const tailwindV4Rules = {
1272
+ "tailwindcss/enforce-canonical-classes": "error",
1273
+ "tailwindcss/enforce-consistent-important-position": "off",
1274
+ "tailwindcss/enforce-consistent-variable-syntax": "off",
1275
+ "tailwindcss/enforce-shorthand-classes": "off"
1267
1276
  };
1268
- const cssGlobalPath = resolvePath(options.cssGlobalPath ?? path.join("src", "app", "globals.css"));
1269
- const configPath = resolvePath(options.configPath ?? path.join("tailwind.config.ts"));
1270
- const cwd = options.cwd ? resolvePath(options.cwd) : void 0;
1277
+ const isV4 = (await getPackageInfo("tailwindcss"))?.version?.startsWith("4");
1271
1278
  return [{
1272
1279
  name: "ncontiero/tailwindcss/setup",
1273
1280
  plugins: { tailwindcss: await interopDefault(import("eslint-plugin-better-tailwindcss")) },
1274
- settings: { tailwindcss: {
1281
+ settings: { "better-tailwindcss": {
1275
1282
  cwd,
1283
+ detectComponentClasses,
1276
1284
  entryPoint: cssGlobalPath,
1277
- tailwindConfig: configPath
1285
+ tailwindConfig: configPath,
1286
+ tsconfig: tsconfigPath
1278
1287
  } }
1279
1288
  }, {
1280
1289
  files: [GLOB_SRC, GLOB_HTML],
@@ -1288,13 +1297,15 @@ async function tailwindcss(options = {}) {
1288
1297
  printWidth: 120
1289
1298
  }],
1290
1299
  "tailwindcss/enforce-consistent-variable-syntax": "error",
1300
+ "tailwindcss/enforce-consistent-variant-order": "warn",
1291
1301
  "tailwindcss/enforce-shorthand-classes": "warn",
1292
1302
  "tailwindcss/no-conflicting-classes": "error",
1293
1303
  "tailwindcss/no-deprecated-classes": "error",
1294
1304
  "tailwindcss/no-duplicate-classes": "error",
1295
1305
  "tailwindcss/no-restricted-classes": "error",
1296
- "tailwindcss/no-unknown-classes": "off",
1306
+ "tailwindcss/no-unknown-classes": "warn",
1297
1307
  "tailwindcss/no-unnecessary-whitespace": "warn",
1308
+ ...isV4 ? tailwindV4Rules : {},
1298
1309
  ...overrides
1299
1310
  }
1300
1311
  }];
@@ -1368,27 +1379,31 @@ async function typescript(options = {}) {
1368
1379
  const typeAwareRules = {
1369
1380
  "dot-notation": "off",
1370
1381
  "no-implied-eval": "off",
1382
+ "no-throw-literal": "off",
1383
+ "prefer-promise-reject-errors": "off",
1384
+ "require-await": "off",
1371
1385
  "ts/await-thenable": "error",
1372
1386
  "ts/dot-notation": ["error", { allowKeywords: true }],
1373
1387
  "ts/no-floating-promises": "error",
1374
1388
  "ts/no-for-in-array": "error",
1375
1389
  "ts/no-implied-eval": "error",
1376
1390
  "ts/no-misused-promises": "error",
1391
+ "ts/no-unnecessary-type-arguments": "error",
1377
1392
  "ts/no-unnecessary-type-assertion": "error",
1378
1393
  "ts/no-unsafe-argument": "error",
1379
1394
  "ts/no-unsafe-assignment": "error",
1380
1395
  "ts/no-unsafe-call": "error",
1381
1396
  "ts/no-unsafe-member-access": "error",
1382
1397
  "ts/no-unsafe-return": "error",
1398
+ "ts/only-throw-error": "error",
1399
+ "ts/prefer-promise-reject-errors": "error",
1383
1400
  "ts/promise-function-async": "error",
1401
+ "ts/require-await": "error",
1384
1402
  "ts/restrict-plus-operands": "error",
1385
1403
  "ts/restrict-template-expressions": "error",
1386
- "ts/return-await": ["error", "in-try-catch"],
1387
- "ts/strict-boolean-expressions": ["error", {
1388
- allowNullableBoolean: true,
1389
- allowNullableObject: true
1390
- }],
1391
- "ts/switch-exhaustiveness-check": "error",
1404
+ "ts/return-await": ["error", "always"],
1405
+ "ts/strict-boolean-expressions": ["error", { allowNullableBoolean: true }],
1406
+ "ts/switch-exhaustiveness-check": ["error", { considerDefaultExhaustiveForUnions: true }],
1392
1407
  "ts/unbound-method": "error"
1393
1408
  };
1394
1409
  const [pluginTs, parserTs] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
@@ -1457,7 +1472,6 @@ async function typescript(options = {}) {
1457
1472
  "ts/no-invalid-void-type": "off",
1458
1473
  "ts/no-non-null-assertion": "off",
1459
1474
  "ts/no-redeclare": ["error", { builtinGlobals: false }],
1460
- "ts/no-require-imports": "error",
1461
1475
  "ts/no-unused-expressions": ["error", {
1462
1476
  allowShortCircuit: true,
1463
1477
  allowTaggedTemplates: false,
@@ -1466,7 +1480,6 @@ async function typescript(options = {}) {
1466
1480
  }],
1467
1481
  "ts/no-unused-vars": "off",
1468
1482
  "ts/no-useless-constructor": "off",
1469
- "ts/no-wrapper-object-types": "error",
1470
1483
  "ts/prefer-as-const": "warn",
1471
1484
  "ts/prefer-literal-enum-member": ["error", { allowBitwiseExpressions: true }],
1472
1485
  "ts/triple-slash-reference": "off",
@@ -1707,7 +1720,7 @@ function getStyleOptions(options) {
1707
1720
  * @returns Merged ESLint configurations based on provided options.
1708
1721
  */
1709
1722
  function ncontiero(options = {}, ...userConfigs) {
1710
- const { e18e: enableE18e = true, gitignore: enableGitignore = true, jsx: enableJsx = true, nextjs: enableNextJs = hasNextJs, react: enableReact = hasReact, regexp: enableRegexp = true, tailwindcss: enableTailwindCSS = hasTailwind, tanstackQuery: enableTanStackQuery = false, typescript: enableTypescript = hasTypeScript, unicorn: enableUnicorn = true } = options;
1723
+ const { deMorgan: enableDeMorgan = true, e18e: enableE18e = true, gitignore: enableGitignore = true, html: enableHtml = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsonc: enableJsonc = true, jsx: enableJsx = true, markdown: enableMarkdown = true, nextjs: enableNextJs = hasNextJs, node: enableNode = true, prettier: enablePrettier = true, promise: enablePromise = true, react: enableReact = hasReact, regexp: enableRegexp = true, tailwindcss: enableTailwindCSS = hasTailwind, tanstackQuery: enableTanStackQuery = false, typescript: enableTypescript = hasTypeScript, unicorn: enableUnicorn = true } = options;
1711
1724
  const prettierOptions = typeof options.prettier === "object" ? options.prettier : {};
1712
1725
  const styleOptions = getStyleOptions(prettierOptions);
1713
1726
  const configs = [];
@@ -1721,7 +1734,15 @@ function ncontiero(options = {}, ...userConfigs) {
1721
1734
  })]));
1722
1735
  const typescriptOptions = resolveSubOptions(options, "typescript");
1723
1736
  const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
1724
- configs.push(ignores(options.ignores, !enableTypescript), javascript({ overrides: getOverrides(options, "javascript") }), comments(), jsdoc(), imports({ nextJs: !!enableNextJs }), node(), promise(), command(), perfectionist(), deMorgan());
1737
+ configs.push(ignores(userIgnores, !enableTypescript), javascript({ overrides: getOverrides(options, "javascript") }), comments(), command(), perfectionist());
1738
+ if (enableNode) configs.push(node());
1739
+ if (enablePromise) configs.push(promise({ overrides: getOverrides(options, "promise") }));
1740
+ if (enableJsdoc) configs.push(jsdoc());
1741
+ if (enableImports) configs.push(imports({
1742
+ nextJs: !!enableNextJs,
1743
+ overrides: getOverrides(options, "imports")
1744
+ }));
1745
+ if (enableDeMorgan) configs.push(deMorgan());
1725
1746
  if (enableE18e) configs.push(e18e(enableE18e === true ? {} : enableE18e));
1726
1747
  if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? { regexp: !!enableRegexp } : enableUnicorn));
1727
1748
  if (enableJsx) configs.push(jsx(enableJsx === true ? {} : enableJsx));
@@ -1731,7 +1752,7 @@ function ncontiero(options = {}, ...userConfigs) {
1731
1752
  tsconfigPath
1732
1753
  }));
1733
1754
  if (enableTanStackQuery) configs.push(tanstackQuery({ overrides: getOverrides(options, "tanstackQuery") }));
1734
- if (options.jsonc ?? true) configs.push(jsonc({
1755
+ if (enableJsonc) configs.push(jsonc({
1735
1756
  overrides: getOverrides(options, "jsonc"),
1736
1757
  style: styleOptions
1737
1758
  }), sortPackageJson(), sortTsconfig());
@@ -1743,7 +1764,7 @@ function ncontiero(options = {}, ...userConfigs) {
1743
1764
  overrides: getOverrides(options, "toml"),
1744
1765
  style: styleOptions
1745
1766
  }));
1746
- if (options.markdown ?? true) configs.push(markdown({ overrides: getOverrides(options, "markdown") }));
1767
+ if (enableMarkdown) configs.push(markdown({ overrides: getOverrides(options, "markdown") }));
1747
1768
  if (enableRegexp) configs.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
1748
1769
  if (enableReact) configs.push(react({
1749
1770
  ...typescriptOptions,
@@ -1751,15 +1772,16 @@ function ncontiero(options = {}, ...userConfigs) {
1751
1772
  tsconfigPath
1752
1773
  }));
1753
1774
  if (enableNextJs) configs.push(nextJs({ overrides: getOverrides(options, "nextjs") }));
1754
- if (options.html ?? true) configs.push(html({
1775
+ if (enableHtml) configs.push(html({
1755
1776
  ...resolveSubOptions(options, "html"),
1756
1777
  overrides: getOverrides(options, "html")
1757
1778
  }));
1758
1779
  if (enableTailwindCSS) configs.push(tailwindcss({
1780
+ tsconfigPath,
1759
1781
  ...resolveSubOptions(options, "tailwindcss"),
1760
1782
  overrides: getOverrides(options, "tailwindcss")
1761
1783
  }));
1762
- if (options.prettier ?? true) configs.push(prettier(prettierOptions));
1784
+ if (enablePrettier) configs.push(prettier(prettierOptions));
1763
1785
  if ("files" in options) throw new Error("[@ncontiero/eslint-config] The first argument should not contain the \"files\" property as the options are supposed to be global. Place it in the second or later config instead.");
1764
1786
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
1765
1787
  if (key in options) acc[key] = options[key];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ncontiero/eslint-config",
3
3
  "type": "module",
4
- "version": "8.0.1",
4
+ "version": "8.1.0",
5
5
  "description": "Nicolas's ESLint config.",
6
6
  "author": {
7
7
  "name": "Nicolas Contiero",
@@ -39,16 +39,16 @@
39
39
  "dependencies": {
40
40
  "@e18e/eslint-plugin": "^0.4.1",
41
41
  "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
42
- "@eslint-react/eslint-plugin": "^5.7.4",
42
+ "@eslint-react/eslint-plugin": "^5.7.5",
43
43
  "@eslint/markdown": "^8.0.1",
44
44
  "@html-eslint/eslint-plugin": "^0.60.0",
45
45
  "@html-eslint/parser": "^0.60.0",
46
- "@next/eslint-plugin-next": "^16.2.5",
46
+ "@next/eslint-plugin-next": "^16.2.6",
47
47
  "@typescript-eslint/eslint-plugin": "^8.59.2",
48
48
  "@typescript-eslint/parser": "^8.59.2",
49
49
  "eslint-config-flat-gitignore": "^2.3.0",
50
50
  "eslint-merge-processors": "^2.0.0",
51
- "eslint-plugin-antfu": "^3.2.2",
51
+ "eslint-plugin-antfu": "^3.2.3",
52
52
  "eslint-plugin-better-tailwindcss": "4.5.0",
53
53
  "eslint-plugin-command": "^3.5.2",
54
54
  "eslint-plugin-de-morgan": "^2.1.2",
@@ -74,14 +74,14 @@
74
74
  },
75
75
  "devDependencies": {
76
76
  "@changesets/cli": "^2.31.0",
77
- "@commitlint/cli": "^20.5.3",
78
- "@commitlint/config-conventional": "^20.5.3",
77
+ "@commitlint/cli": "^21.0.0",
78
+ "@commitlint/config-conventional": "^21.0.0",
79
79
  "@eslint/config-inspector": "^2.0.1",
80
80
  "@ncontiero/changelog-github": "^2.1.3",
81
81
  "@ncontiero/prettier-config": "^1.0.0",
82
- "@tanstack/eslint-plugin-query": "^5.100.9",
82
+ "@tanstack/eslint-plugin-query": "^5.100.10",
83
83
  "@types/eslint-plugin-jsx-a11y": "^6.10.1",
84
- "@types/node": "^25.6.0",
84
+ "@types/node": "^25.6.2",
85
85
  "eslint": "^10.3.0",
86
86
  "eslint-typegen": "^2.3.1",
87
87
  "husky": "^9.1.7",
@@ -91,7 +91,7 @@
91
91
  "tsdown": "^0.22.0",
92
92
  "tsx": "^4.21.0",
93
93
  "typescript": "^6.0.3",
94
- "vitest": "^4.1.5"
94
+ "vitest": "^4.1.6"
95
95
  },
96
96
  "engines": {
97
97
  "node": ">=20.19.0"
@@ -102,9 +102,10 @@
102
102
  "prettier": "@ncontiero/prettier-config",
103
103
  "scripts": {
104
104
  "build": "pnpm typegen && tsdown",
105
- "dev": "eslint-config-inspector --config eslint-inspector.config.ts",
106
- "build:inspector": "pnpm build && eslint-config-inspector build --config eslint-inspector.config.ts",
105
+ "dev": "pnpm inspector",
106
+ "build:inspector": "pnpm build && pnpm inspector build --outDir .eslint-config-inspector",
107
107
  "typegen": "tsx scripts/typegen.ts",
108
+ "inspector": "eslint-config-inspector --config eslint-inspector.config.ts",
108
109
  "test": "vitest",
109
110
  "lint": "eslint .",
110
111
  "lint:fix": "pnpm lint --fix",