@ntnyq/eslint-config 3.12.0 → 3.12.2

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.cjs CHANGED
@@ -773,7 +773,7 @@ async function ensurePackages(packages) {
773
773
  if (import_node_process3.default.env.CI || !import_node_process3.default.stdout.isTTY || isInGitHooksOrRunByNanoStagedOrRunByTSX() || !isCwdInScope) {
774
774
  return;
775
775
  }
776
- const nonExistingPackages = packages.filter((pkg) => !!pkg && isPackageInScope(pkg));
776
+ const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
777
777
  if (nonExistingPackages.length === 0) {
778
778
  return;
779
779
  }
@@ -1264,12 +1264,19 @@ var vitest = (options = {}) => {
1264
1264
 
1265
1265
  // src/configs/svgo.ts
1266
1266
  var import_eslint_plugin_svgo2 = require("eslint-plugin-svgo");
1267
- var svgo = (options = {}) => [
1268
- {
1269
- ...(0, import_eslint_plugin_svgo2.config)(options),
1270
- name: "ntnyq/svgo"
1271
- }
1272
- ];
1267
+ var svgo = (options = {}) => {
1268
+ const { files = [GLOB_SVG], rules: overridesRules = {} } = options;
1269
+ return [
1270
+ (0, import_eslint_plugin_svgo2.createConfig)({
1271
+ name: "ntnyq/svgo",
1272
+ files,
1273
+ rules: {
1274
+ "svgo/svgo": "error",
1275
+ ...overridesRules
1276
+ }
1277
+ })
1278
+ ];
1279
+ };
1273
1280
 
1274
1281
  // src/configs/antfu.ts
1275
1282
  var antfu = (options = {}) => [
@@ -1292,6 +1299,13 @@ var antfu = (options = {}) => [
1292
1299
  ];
1293
1300
 
1294
1301
  // src/configs/jsdoc.ts
1302
+ var javscriptRules = {
1303
+ "jsdoc/no-types": "off",
1304
+ "jsdoc/no-undefined-types": "error",
1305
+ "jsdoc/require-param-type": "error",
1306
+ "jsdoc/require-property-type": "error",
1307
+ "jsdoc/require-returns-type": "error"
1308
+ };
1295
1309
  var typescriptRules = {
1296
1310
  "jsdoc/no-undefined-types": "off",
1297
1311
  "jsdoc/require-param-type": "off",
@@ -1532,7 +1546,7 @@ var jsdoc = (options = {}) => [
1532
1546
  "jsdoc/require-returns-description": "warn",
1533
1547
  "jsdoc/require-yields-check": "warn",
1534
1548
  // TypeScript rules overrides
1535
- ...options.typescript ? typescriptRules : {},
1549
+ ...options.typescript ? typescriptRules : javscriptRules,
1536
1550
  // Overrides rules
1537
1551
  ...options.overrides
1538
1552
  }
@@ -2180,9 +2194,13 @@ var markdown = (options = {}) => {
2180
2194
  /**
2181
2195
  * other extensions
2182
2196
  */
2183
- extensions = []
2197
+ extensions = [],
2198
+ /**
2199
+ * disbale type aware linting
2200
+ */
2201
+ disableTypeAwareLinting = false
2184
2202
  } = options;
2185
- return [
2203
+ const configs2 = [
2186
2204
  /**
2187
2205
  * extracting code blocks to be linted individually
2188
2206
  */
@@ -2250,6 +2268,14 @@ var markdown = (options = {}) => {
2250
2268
  }
2251
2269
  }
2252
2270
  ];
2271
+ if (disableTypeAwareLinting) {
2272
+ configs2.push({
2273
+ ...import_typescript_eslint3.configs.disableTypeChecked,
2274
+ name: "ntnyq/markdown/disable/type-aware",
2275
+ files: [GLOB_MARKDOWN_CODE]
2276
+ });
2277
+ }
2278
+ return configs2;
2253
2279
  };
2254
2280
 
2255
2281
  // src/configs/prettier.ts
@@ -2605,6 +2631,7 @@ var typeAwareRules = {
2605
2631
  "@typescript-eslint/no-implied-eval": "error",
2606
2632
  "@typescript-eslint/only-throw-error": "error",
2607
2633
  "@typescript-eslint/no-unsafe-return": "error",
2634
+ "@typescript-eslint/no-misused-spread": "error",
2608
2635
  "@typescript-eslint/no-unsafe-argument": "error",
2609
2636
  "@typescript-eslint/no-misused-promises": "error",
2610
2637
  "@typescript-eslint/no-unsafe-assignment": "error",
@@ -2829,23 +2856,21 @@ var githubAction = (options = {}) => {
2829
2856
  const {
2830
2857
  // Support common overrides rules
2831
2858
  overrides: overridesRules = {},
2832
- // Flat config options
2859
+ // Config options
2833
2860
  ...restOptions
2834
2861
  } = options;
2835
- const recommendedConfig = (0, import_eslint_plugin_github_action2.createRecommendedConfig)({
2836
- name: "ntnyq/github-action",
2837
- files: [GLOB_GITHUB_ACTION],
2838
- ...restOptions
2839
- });
2840
2862
  return [
2841
- {
2842
- ...recommendedConfig,
2863
+ (0, import_eslint_plugin_github_action2.createConfig)({
2864
+ name: "ntnyq/github-action",
2865
+ files: [GLOB_GITHUB_ACTION],
2843
2866
  rules: {
2844
- ...recommendedConfig.rules,
2845
- // Overrides rules
2867
+ "github-action/no-invalid-key": "error",
2868
+ "github-action/prefer-file-extension": "error",
2869
+ "github-action/require-action-name": "error",
2846
2870
  ...overridesRules
2847
- }
2848
- }
2871
+ },
2872
+ ...restOptions
2873
+ })
2849
2874
  ];
2850
2875
  };
2851
2876
 
@@ -3225,41 +3250,36 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3225
3250
  supportedExtensions.push("vue");
3226
3251
  }
3227
3252
  if (enableGitIgnore) {
3228
- configs2.push(
3229
- ...gitignore({
3230
- ...resolveSubOptions(options, "gitignore")
3231
- })
3232
- );
3253
+ configs2.push(gitignore(resolveSubOptions(options, "gitignore")));
3233
3254
  }
3234
3255
  configs2.push(
3235
- ...ignores(options.ignores),
3236
- ...jsx(),
3237
- ...node({
3256
+ ignores(options.ignores),
3257
+ jsx(),
3258
+ node({
3238
3259
  overrides: getOverrides(options, "node")
3239
3260
  }),
3240
- ...command({
3241
- ...resolveSubOptions(options, "command")
3242
- }),
3243
- ...importX({
3261
+ command(resolveSubOptions(options, "command")),
3262
+ importX({
3244
3263
  ...resolveSubOptions(options, "importX"),
3245
3264
  typescript: !!enableTypeScript,
3246
3265
  overrides: getOverrides(options, "importX")
3247
3266
  }),
3248
- ...jsdoc({
3267
+ jsdoc({
3249
3268
  typescript: !!enableTypeScript,
3250
- overrides: getOverrides(options, "jsdoc")
3269
+ overrides: getOverrides(options, "jsdoc"),
3270
+ ...resolveSubOptions(options, "jsdoc")
3251
3271
  }),
3252
- ...comments({
3272
+ comments({
3253
3273
  overrides: getOverrides(options, "comments")
3254
3274
  }),
3255
- ...javascript({
3275
+ javascript({
3256
3276
  ...resolveSubOptions(options, "javascript"),
3257
3277
  overrides: getOverrides(options, "javascript")
3258
3278
  })
3259
3279
  );
3260
3280
  if (enablePerfectionist) {
3261
3281
  configs2.push(
3262
- ...perfectionist({
3282
+ perfectionist({
3263
3283
  ...resolveSubOptions(options, "perfectionist"),
3264
3284
  overrides: getOverrides(options, "perfectionist")
3265
3285
  })
@@ -3267,14 +3287,14 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3267
3287
  }
3268
3288
  if (enableUnicorn) {
3269
3289
  configs2.push(
3270
- ...unicorn({
3290
+ unicorn({
3271
3291
  overrides: getOverrides(options, "unicorn")
3272
3292
  })
3273
3293
  );
3274
3294
  }
3275
3295
  if (enablePinia) {
3276
3296
  configs2.push(
3277
- ...pinia({
3297
+ pinia({
3278
3298
  ...resolveSubOptions(options, "pinia"),
3279
3299
  overrides: getOverrides(options, "pinia")
3280
3300
  })
@@ -3282,7 +3302,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3282
3302
  }
3283
3303
  if (enableRegexp) {
3284
3304
  configs2.push(
3285
- ...regexp({
3305
+ regexp({
3286
3306
  ...resolveSubOptions(options, "regexp"),
3287
3307
  overrides: getOverrides(options, "regexp")
3288
3308
  })
@@ -3290,7 +3310,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3290
3310
  }
3291
3311
  if (enableTypeScript) {
3292
3312
  configs2.push(
3293
- ...typescript({
3313
+ typescript({
3294
3314
  ...resolveSubOptions(options, "typescript"),
3295
3315
  extensions: supportedExtensions,
3296
3316
  overrides: getOverrides(options, "typescript")
@@ -3299,7 +3319,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3299
3319
  }
3300
3320
  if (enableVue) {
3301
3321
  configs2.push(
3302
- ...vue({
3322
+ vue({
3303
3323
  ...resolveSubOptions(options, "vue"),
3304
3324
  typescript: !!enableTypeScript,
3305
3325
  overrides: getOverrides(options, "vue")
@@ -3308,52 +3328,48 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3308
3328
  }
3309
3329
  if (enableYML) {
3310
3330
  configs2.push(
3311
- ...yml({
3331
+ yml({
3312
3332
  overrides: getOverrides(options, "yml")
3313
3333
  })
3314
3334
  );
3315
3335
  }
3316
3336
  if (enableTOML) {
3317
3337
  configs2.push(
3318
- ...toml({
3338
+ toml({
3319
3339
  overrides: getOverrides(options, "toml")
3320
3340
  })
3321
3341
  );
3322
3342
  }
3323
3343
  if (enableJSONC) {
3324
3344
  configs2.push(
3325
- ...jsonc({
3345
+ jsonc({
3326
3346
  overrides: getOverrides(options, "jsonc")
3327
3347
  })
3328
3348
  );
3329
3349
  }
3330
3350
  if (enableSort) {
3331
- configs2.push(
3332
- ...sort({
3333
- ...resolveSubOptions(options, "sort")
3334
- })
3335
- );
3351
+ configs2.push(sort(resolveSubOptions(options, "sort")));
3336
3352
  }
3337
3353
  if (enableTest) {
3338
3354
  configs2.push(
3339
- ...test({
3355
+ test({
3340
3356
  overrides: getOverrides(options, "test")
3341
3357
  }),
3342
- ...vitest({
3358
+ vitest({
3343
3359
  overrides: getOverrides(options, "test")
3344
3360
  })
3345
3361
  );
3346
3362
  }
3347
3363
  if (enableUnoCSS) {
3348
3364
  configs2.push(
3349
- ...unocss({
3365
+ unocss({
3350
3366
  overrides: getOverrides(options, "unocss")
3351
3367
  })
3352
3368
  );
3353
3369
  }
3354
3370
  if (enableMarkdown) {
3355
3371
  configs2.push(
3356
- ...markdown({
3372
+ markdown({
3357
3373
  extensions: supportedExtensions,
3358
3374
  overrides: getOverrides(options, "markdown")
3359
3375
  })
@@ -3361,14 +3377,14 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3361
3377
  }
3362
3378
  if (enableAntfu) {
3363
3379
  configs2.push(
3364
- ...antfu({
3380
+ antfu({
3365
3381
  overrides: getOverrides(options, "antfu")
3366
3382
  })
3367
3383
  );
3368
3384
  }
3369
3385
  if (enableDepend) {
3370
3386
  configs2.push(
3371
- ...depend({
3387
+ depend({
3372
3388
  ...resolveSubOptions(options, "depend"),
3373
3389
  overrides: getOverrides(options, "depend")
3374
3390
  })
@@ -3403,15 +3419,9 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3403
3419
  );
3404
3420
  }
3405
3421
  if (enableSVGO) {
3406
- configs2.push(
3407
- ...svgo({
3408
- ...resolveSubOptions(options, "svgo")
3409
- })
3410
- );
3422
+ configs2.push(svgo(resolveSubOptions(options, "svgo")));
3411
3423
  }
3412
- const configSpecials = specials({
3413
- ...resolveSubOptions(options, "specials")
3414
- });
3424
+ const configSpecials = specials(resolveSubOptions(options, "specials"));
3415
3425
  const configPrettier = enablePrettier ? prettier({
3416
3426
  ...resolveSubOptions(options, "prettier"),
3417
3427
  overrides: getOverrides(options, "prettier")
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { FlatConfigComposer } from 'eslint-flat-config-utils';
2
2
  import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
3
3
  import { ESLintPluginCommandOptions } from 'eslint-plugin-command/types';
4
- import { RecommendedOptions } from 'eslint-plugin-github-action';
4
+ import { CreateConfigOptions } from 'eslint-plugin-github-action';
5
5
  export { default as pluginGitHubAction } from 'eslint-plugin-github-action';
6
6
  import { RuleOptions as RuleOptions$1 } from 'eslint-plugin-svgo/rule-options';
7
7
  import { Options } from 'eslint-processor-vue-blocks';
@@ -743,7 +743,7 @@ interface RuleOptions {
743
743
  * Disallow using code marked as `@deprecated`
744
744
  * @see https://typescript-eslint.io/rules/no-deprecated
745
745
  */
746
- '@typescript-eslint/no-deprecated'?: Linter.RuleEntry<[]>;
746
+ '@typescript-eslint/no-deprecated'?: Linter.RuleEntry<TypescriptEslintNoDeprecated>;
747
747
  /**
748
748
  * Disallow duplicate class members
749
749
  * @see https://typescript-eslint.io/rules/no-dupe-class-members
@@ -861,6 +861,11 @@ interface RuleOptions {
861
861
  * @see https://typescript-eslint.io/rules/no-misused-promises
862
862
  */
863
863
  '@typescript-eslint/no-misused-promises'?: Linter.RuleEntry<TypescriptEslintNoMisusedPromises>;
864
+ /**
865
+ * Disallow using the spread operator when it might cause unexpected behavior
866
+ * @see https://typescript-eslint.io/rules/no-misused-spread
867
+ */
868
+ '@typescript-eslint/no-misused-spread'?: Linter.RuleEntry<TypescriptEslintNoMisusedSpread>;
864
869
  /**
865
870
  * Disallow enums from having both number and string members
866
871
  * @see https://typescript-eslint.io/rules/no-mixed-enums
@@ -1443,7 +1448,7 @@ interface RuleOptions {
1443
1448
  */
1444
1449
  'default-case'?: Linter.RuleEntry<DefaultCase>;
1445
1450
  /**
1446
- * Enforce `default` clauses in switch statements to be last
1451
+ * Enforce `default` clauses in `switch` statements to be last
1447
1452
  * @see https://eslint.org/docs/latest/rules/default-case-last
1448
1453
  */
1449
1454
  'default-case-last'?: Linter.RuleEntry<[]>;
@@ -6004,7 +6009,7 @@ interface RuleOptions {
6004
6009
  */
6005
6010
  'semi-style'?: Linter.RuleEntry<SemiStyle>;
6006
6011
  /**
6007
- * Enforce sorted import declarations within modules
6012
+ * Enforce sorted `import` declarations within modules
6008
6013
  * @see https://eslint.org/docs/latest/rules/sort-imports
6009
6014
  */
6010
6015
  'sort-imports'?: Linter.RuleEntry<SortImports>;
@@ -9961,6 +9966,7 @@ type TypescriptEslintConsistentTypeAssertions = [] | [
9961
9966
  ({
9962
9967
  assertionStyle: "never";
9963
9968
  } | {
9969
+ arrayLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never");
9964
9970
  assertionStyle?: ("as" | "angle-bracket");
9965
9971
  objectLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never");
9966
9972
  })
@@ -10394,6 +10400,22 @@ type TypescriptEslintNoConfusingVoidExpression = [] | [
10394
10400
  ignoreVoidReturningFunctions?: boolean;
10395
10401
  }
10396
10402
  ];
10403
+ type TypescriptEslintNoDeprecated = [] | [
10404
+ {
10405
+ allow?: (string | {
10406
+ from: "file";
10407
+ name: (string | [string, ...(string)[]]);
10408
+ path?: string;
10409
+ } | {
10410
+ from: "lib";
10411
+ name: (string | [string, ...(string)[]]);
10412
+ } | {
10413
+ from: "package";
10414
+ name: (string | [string, ...(string)[]]);
10415
+ package: string;
10416
+ })[];
10417
+ }
10418
+ ];
10397
10419
  type TypescriptEslintNoDuplicateTypeConstituents = [] | [
10398
10420
  {
10399
10421
  ignoreIntersections?: boolean;
@@ -10512,6 +10534,22 @@ type TypescriptEslintNoMisusedPromises = [] | [
10512
10534
  });
10513
10535
  }
10514
10536
  ];
10537
+ type TypescriptEslintNoMisusedSpread = [] | [
10538
+ {
10539
+ allow?: (string | {
10540
+ from: "file";
10541
+ name: (string | [string, ...(string)[]]);
10542
+ path?: string;
10543
+ } | {
10544
+ from: "lib";
10545
+ name: (string | [string, ...(string)[]]);
10546
+ } | {
10547
+ from: "package";
10548
+ name: (string | [string, ...(string)[]]);
10549
+ package: string;
10550
+ })[];
10551
+ }
10552
+ ];
10515
10553
  type TypescriptEslintNoNamespace = [] | [
10516
10554
  {
10517
10555
  allowDeclarations?: boolean;
@@ -10573,7 +10611,7 @@ type TypescriptEslintNoShadow = [] | [
10573
10611
  {
10574
10612
  allow?: string[];
10575
10613
  builtinGlobals?: boolean;
10576
- hoist?: ("all" | "functions" | "never");
10614
+ hoist?: ("all" | "functions" | "functions-and-types" | "never" | "types");
10577
10615
  ignoreFunctionTypeParameterNameValueShadow?: boolean;
10578
10616
  ignoreOnInitialization?: boolean;
10579
10617
  ignoreTypeValueShadow?: boolean;
@@ -18014,7 +18052,7 @@ interface ConfigFormatOptions {
18014
18052
  */
18015
18053
  dprintOptions?: boolean;
18016
18054
  }
18017
- interface ConfigGitHubActionOptions extends RecommendedOptions, OptionsOverrides {
18055
+ interface ConfigGitHubActionOptions extends CreateConfigOptions, OptionsOverrides {
18018
18056
  }
18019
18057
  type ConfigGitIgnoreOptions = Omit<FlatGitignoreOptions, 'strict'> & {
18020
18058
  /**
@@ -18046,6 +18084,12 @@ interface ConfigJsdocOptions extends OptionsFeatures, OptionsOverrides {
18046
18084
  interface ConfigJsoncOptions extends OptionsOverrides {
18047
18085
  }
18048
18086
  interface ConfigMarkdownOptions extends OptionsExtensions, OptionsFiles, OptionsOverrides {
18087
+ /**
18088
+ * Explicitly disable type aware linting for markdown files
18089
+ *
18090
+ * @default false
18091
+ */
18092
+ disableTypeAwareLinting?: boolean;
18049
18093
  }
18050
18094
  interface ConfigNodeOptions extends OptionsOverrides {
18051
18095
  }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { FlatConfigComposer } from 'eslint-flat-config-utils';
2
2
  import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
3
3
  import { ESLintPluginCommandOptions } from 'eslint-plugin-command/types';
4
- import { RecommendedOptions } from 'eslint-plugin-github-action';
4
+ import { CreateConfigOptions } from 'eslint-plugin-github-action';
5
5
  export { default as pluginGitHubAction } from 'eslint-plugin-github-action';
6
6
  import { RuleOptions as RuleOptions$1 } from 'eslint-plugin-svgo/rule-options';
7
7
  import { Options } from 'eslint-processor-vue-blocks';
@@ -743,7 +743,7 @@ interface RuleOptions {
743
743
  * Disallow using code marked as `@deprecated`
744
744
  * @see https://typescript-eslint.io/rules/no-deprecated
745
745
  */
746
- '@typescript-eslint/no-deprecated'?: Linter.RuleEntry<[]>;
746
+ '@typescript-eslint/no-deprecated'?: Linter.RuleEntry<TypescriptEslintNoDeprecated>;
747
747
  /**
748
748
  * Disallow duplicate class members
749
749
  * @see https://typescript-eslint.io/rules/no-dupe-class-members
@@ -861,6 +861,11 @@ interface RuleOptions {
861
861
  * @see https://typescript-eslint.io/rules/no-misused-promises
862
862
  */
863
863
  '@typescript-eslint/no-misused-promises'?: Linter.RuleEntry<TypescriptEslintNoMisusedPromises>;
864
+ /**
865
+ * Disallow using the spread operator when it might cause unexpected behavior
866
+ * @see https://typescript-eslint.io/rules/no-misused-spread
867
+ */
868
+ '@typescript-eslint/no-misused-spread'?: Linter.RuleEntry<TypescriptEslintNoMisusedSpread>;
864
869
  /**
865
870
  * Disallow enums from having both number and string members
866
871
  * @see https://typescript-eslint.io/rules/no-mixed-enums
@@ -1443,7 +1448,7 @@ interface RuleOptions {
1443
1448
  */
1444
1449
  'default-case'?: Linter.RuleEntry<DefaultCase>;
1445
1450
  /**
1446
- * Enforce `default` clauses in switch statements to be last
1451
+ * Enforce `default` clauses in `switch` statements to be last
1447
1452
  * @see https://eslint.org/docs/latest/rules/default-case-last
1448
1453
  */
1449
1454
  'default-case-last'?: Linter.RuleEntry<[]>;
@@ -6004,7 +6009,7 @@ interface RuleOptions {
6004
6009
  */
6005
6010
  'semi-style'?: Linter.RuleEntry<SemiStyle>;
6006
6011
  /**
6007
- * Enforce sorted import declarations within modules
6012
+ * Enforce sorted `import` declarations within modules
6008
6013
  * @see https://eslint.org/docs/latest/rules/sort-imports
6009
6014
  */
6010
6015
  'sort-imports'?: Linter.RuleEntry<SortImports>;
@@ -9961,6 +9966,7 @@ type TypescriptEslintConsistentTypeAssertions = [] | [
9961
9966
  ({
9962
9967
  assertionStyle: "never";
9963
9968
  } | {
9969
+ arrayLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never");
9964
9970
  assertionStyle?: ("as" | "angle-bracket");
9965
9971
  objectLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never");
9966
9972
  })
@@ -10394,6 +10400,22 @@ type TypescriptEslintNoConfusingVoidExpression = [] | [
10394
10400
  ignoreVoidReturningFunctions?: boolean;
10395
10401
  }
10396
10402
  ];
10403
+ type TypescriptEslintNoDeprecated = [] | [
10404
+ {
10405
+ allow?: (string | {
10406
+ from: "file";
10407
+ name: (string | [string, ...(string)[]]);
10408
+ path?: string;
10409
+ } | {
10410
+ from: "lib";
10411
+ name: (string | [string, ...(string)[]]);
10412
+ } | {
10413
+ from: "package";
10414
+ name: (string | [string, ...(string)[]]);
10415
+ package: string;
10416
+ })[];
10417
+ }
10418
+ ];
10397
10419
  type TypescriptEslintNoDuplicateTypeConstituents = [] | [
10398
10420
  {
10399
10421
  ignoreIntersections?: boolean;
@@ -10512,6 +10534,22 @@ type TypescriptEslintNoMisusedPromises = [] | [
10512
10534
  });
10513
10535
  }
10514
10536
  ];
10537
+ type TypescriptEslintNoMisusedSpread = [] | [
10538
+ {
10539
+ allow?: (string | {
10540
+ from: "file";
10541
+ name: (string | [string, ...(string)[]]);
10542
+ path?: string;
10543
+ } | {
10544
+ from: "lib";
10545
+ name: (string | [string, ...(string)[]]);
10546
+ } | {
10547
+ from: "package";
10548
+ name: (string | [string, ...(string)[]]);
10549
+ package: string;
10550
+ })[];
10551
+ }
10552
+ ];
10515
10553
  type TypescriptEslintNoNamespace = [] | [
10516
10554
  {
10517
10555
  allowDeclarations?: boolean;
@@ -10573,7 +10611,7 @@ type TypescriptEslintNoShadow = [] | [
10573
10611
  {
10574
10612
  allow?: string[];
10575
10613
  builtinGlobals?: boolean;
10576
- hoist?: ("all" | "functions" | "never");
10614
+ hoist?: ("all" | "functions" | "functions-and-types" | "never" | "types");
10577
10615
  ignoreFunctionTypeParameterNameValueShadow?: boolean;
10578
10616
  ignoreOnInitialization?: boolean;
10579
10617
  ignoreTypeValueShadow?: boolean;
@@ -18014,7 +18052,7 @@ interface ConfigFormatOptions {
18014
18052
  */
18015
18053
  dprintOptions?: boolean;
18016
18054
  }
18017
- interface ConfigGitHubActionOptions extends RecommendedOptions, OptionsOverrides {
18055
+ interface ConfigGitHubActionOptions extends CreateConfigOptions, OptionsOverrides {
18018
18056
  }
18019
18057
  type ConfigGitIgnoreOptions = Omit<FlatGitignoreOptions, 'strict'> & {
18020
18058
  /**
@@ -18046,6 +18084,12 @@ interface ConfigJsdocOptions extends OptionsFeatures, OptionsOverrides {
18046
18084
  interface ConfigJsoncOptions extends OptionsOverrides {
18047
18085
  }
18048
18086
  interface ConfigMarkdownOptions extends OptionsExtensions, OptionsFiles, OptionsOverrides {
18087
+ /**
18088
+ * Explicitly disable type aware linting for markdown files
18089
+ *
18090
+ * @default false
18091
+ */
18092
+ disableTypeAwareLinting?: boolean;
18049
18093
  }
18050
18094
  interface ConfigNodeOptions extends OptionsOverrides {
18051
18095
  }
package/dist/index.js CHANGED
@@ -612,7 +612,7 @@ async function ensurePackages(packages) {
612
612
  if (process3.env.CI || !process3.stdout.isTTY || isInGitHooksOrRunByNanoStagedOrRunByTSX() || !isCwdInScope) {
613
613
  return;
614
614
  }
615
- const nonExistingPackages = packages.filter((pkg) => !!pkg && isPackageInScope(pkg));
615
+ const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
616
616
  if (nonExistingPackages.length === 0) {
617
617
  return;
618
618
  }
@@ -1102,13 +1102,20 @@ var vitest = (options = {}) => {
1102
1102
  };
1103
1103
 
1104
1104
  // src/configs/svgo.ts
1105
- import { config as createSVGOConfig } from "eslint-plugin-svgo";
1106
- var svgo = (options = {}) => [
1107
- {
1108
- ...createSVGOConfig(options),
1109
- name: "ntnyq/svgo"
1110
- }
1111
- ];
1105
+ import { createConfig as createSVGOConfig } from "eslint-plugin-svgo";
1106
+ var svgo = (options = {}) => {
1107
+ const { files = [GLOB_SVG], rules: overridesRules = {} } = options;
1108
+ return [
1109
+ createSVGOConfig({
1110
+ name: "ntnyq/svgo",
1111
+ files,
1112
+ rules: {
1113
+ "svgo/svgo": "error",
1114
+ ...overridesRules
1115
+ }
1116
+ })
1117
+ ];
1118
+ };
1112
1119
 
1113
1120
  // src/configs/antfu.ts
1114
1121
  var antfu = (options = {}) => [
@@ -1131,6 +1138,13 @@ var antfu = (options = {}) => [
1131
1138
  ];
1132
1139
 
1133
1140
  // src/configs/jsdoc.ts
1141
+ var javscriptRules = {
1142
+ "jsdoc/no-types": "off",
1143
+ "jsdoc/no-undefined-types": "error",
1144
+ "jsdoc/require-param-type": "error",
1145
+ "jsdoc/require-property-type": "error",
1146
+ "jsdoc/require-returns-type": "error"
1147
+ };
1134
1148
  var typescriptRules = {
1135
1149
  "jsdoc/no-undefined-types": "off",
1136
1150
  "jsdoc/require-param-type": "off",
@@ -1371,7 +1385,7 @@ var jsdoc = (options = {}) => [
1371
1385
  "jsdoc/require-returns-description": "warn",
1372
1386
  "jsdoc/require-yields-check": "warn",
1373
1387
  // TypeScript rules overrides
1374
- ...options.typescript ? typescriptRules : {},
1388
+ ...options.typescript ? typescriptRules : javscriptRules,
1375
1389
  // Overrides rules
1376
1390
  ...options.overrides
1377
1391
  }
@@ -2019,9 +2033,13 @@ var markdown = (options = {}) => {
2019
2033
  /**
2020
2034
  * other extensions
2021
2035
  */
2022
- extensions = []
2036
+ extensions = [],
2037
+ /**
2038
+ * disbale type aware linting
2039
+ */
2040
+ disableTypeAwareLinting = false
2023
2041
  } = options;
2024
- return [
2042
+ const configs2 = [
2025
2043
  /**
2026
2044
  * extracting code blocks to be linted individually
2027
2045
  */
@@ -2089,6 +2107,14 @@ var markdown = (options = {}) => {
2089
2107
  }
2090
2108
  }
2091
2109
  ];
2110
+ if (disableTypeAwareLinting) {
2111
+ configs2.push({
2112
+ ...configs.disableTypeChecked,
2113
+ name: "ntnyq/markdown/disable/type-aware",
2114
+ files: [GLOB_MARKDOWN_CODE]
2115
+ });
2116
+ }
2117
+ return configs2;
2092
2118
  };
2093
2119
 
2094
2120
  // src/configs/prettier.ts
@@ -2444,6 +2470,7 @@ var typeAwareRules = {
2444
2470
  "@typescript-eslint/no-implied-eval": "error",
2445
2471
  "@typescript-eslint/only-throw-error": "error",
2446
2472
  "@typescript-eslint/no-unsafe-return": "error",
2473
+ "@typescript-eslint/no-misused-spread": "error",
2447
2474
  "@typescript-eslint/no-unsafe-argument": "error",
2448
2475
  "@typescript-eslint/no-misused-promises": "error",
2449
2476
  "@typescript-eslint/no-unsafe-assignment": "error",
@@ -2663,28 +2690,26 @@ var eslintPlugin = async (options = {}) => {
2663
2690
  };
2664
2691
 
2665
2692
  // src/configs/githubAction.ts
2666
- import { createRecommendedConfig } from "eslint-plugin-github-action";
2693
+ import { createConfig } from "eslint-plugin-github-action";
2667
2694
  var githubAction = (options = {}) => {
2668
2695
  const {
2669
2696
  // Support common overrides rules
2670
2697
  overrides: overridesRules = {},
2671
- // Flat config options
2698
+ // Config options
2672
2699
  ...restOptions
2673
2700
  } = options;
2674
- const recommendedConfig = createRecommendedConfig({
2675
- name: "ntnyq/github-action",
2676
- files: [GLOB_GITHUB_ACTION],
2677
- ...restOptions
2678
- });
2679
2701
  return [
2680
- {
2681
- ...recommendedConfig,
2702
+ createConfig({
2703
+ name: "ntnyq/github-action",
2704
+ files: [GLOB_GITHUB_ACTION],
2682
2705
  rules: {
2683
- ...recommendedConfig.rules,
2684
- // Overrides rules
2706
+ "github-action/no-invalid-key": "error",
2707
+ "github-action/prefer-file-extension": "error",
2708
+ "github-action/require-action-name": "error",
2685
2709
  ...overridesRules
2686
- }
2687
- }
2710
+ },
2711
+ ...restOptions
2712
+ })
2688
2713
  ];
2689
2714
  };
2690
2715
 
@@ -3064,41 +3089,36 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3064
3089
  supportedExtensions.push("vue");
3065
3090
  }
3066
3091
  if (enableGitIgnore) {
3067
- configs2.push(
3068
- ...gitignore({
3069
- ...resolveSubOptions(options, "gitignore")
3070
- })
3071
- );
3092
+ configs2.push(gitignore(resolveSubOptions(options, "gitignore")));
3072
3093
  }
3073
3094
  configs2.push(
3074
- ...ignores(options.ignores),
3075
- ...jsx(),
3076
- ...node({
3095
+ ignores(options.ignores),
3096
+ jsx(),
3097
+ node({
3077
3098
  overrides: getOverrides(options, "node")
3078
3099
  }),
3079
- ...command({
3080
- ...resolveSubOptions(options, "command")
3081
- }),
3082
- ...importX({
3100
+ command(resolveSubOptions(options, "command")),
3101
+ importX({
3083
3102
  ...resolveSubOptions(options, "importX"),
3084
3103
  typescript: !!enableTypeScript,
3085
3104
  overrides: getOverrides(options, "importX")
3086
3105
  }),
3087
- ...jsdoc({
3106
+ jsdoc({
3088
3107
  typescript: !!enableTypeScript,
3089
- overrides: getOverrides(options, "jsdoc")
3108
+ overrides: getOverrides(options, "jsdoc"),
3109
+ ...resolveSubOptions(options, "jsdoc")
3090
3110
  }),
3091
- ...comments({
3111
+ comments({
3092
3112
  overrides: getOverrides(options, "comments")
3093
3113
  }),
3094
- ...javascript({
3114
+ javascript({
3095
3115
  ...resolveSubOptions(options, "javascript"),
3096
3116
  overrides: getOverrides(options, "javascript")
3097
3117
  })
3098
3118
  );
3099
3119
  if (enablePerfectionist) {
3100
3120
  configs2.push(
3101
- ...perfectionist({
3121
+ perfectionist({
3102
3122
  ...resolveSubOptions(options, "perfectionist"),
3103
3123
  overrides: getOverrides(options, "perfectionist")
3104
3124
  })
@@ -3106,14 +3126,14 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3106
3126
  }
3107
3127
  if (enableUnicorn) {
3108
3128
  configs2.push(
3109
- ...unicorn({
3129
+ unicorn({
3110
3130
  overrides: getOverrides(options, "unicorn")
3111
3131
  })
3112
3132
  );
3113
3133
  }
3114
3134
  if (enablePinia) {
3115
3135
  configs2.push(
3116
- ...pinia({
3136
+ pinia({
3117
3137
  ...resolveSubOptions(options, "pinia"),
3118
3138
  overrides: getOverrides(options, "pinia")
3119
3139
  })
@@ -3121,7 +3141,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3121
3141
  }
3122
3142
  if (enableRegexp) {
3123
3143
  configs2.push(
3124
- ...regexp({
3144
+ regexp({
3125
3145
  ...resolveSubOptions(options, "regexp"),
3126
3146
  overrides: getOverrides(options, "regexp")
3127
3147
  })
@@ -3129,7 +3149,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3129
3149
  }
3130
3150
  if (enableTypeScript) {
3131
3151
  configs2.push(
3132
- ...typescript({
3152
+ typescript({
3133
3153
  ...resolveSubOptions(options, "typescript"),
3134
3154
  extensions: supportedExtensions,
3135
3155
  overrides: getOverrides(options, "typescript")
@@ -3138,7 +3158,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3138
3158
  }
3139
3159
  if (enableVue) {
3140
3160
  configs2.push(
3141
- ...vue({
3161
+ vue({
3142
3162
  ...resolveSubOptions(options, "vue"),
3143
3163
  typescript: !!enableTypeScript,
3144
3164
  overrides: getOverrides(options, "vue")
@@ -3147,52 +3167,48 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3147
3167
  }
3148
3168
  if (enableYML) {
3149
3169
  configs2.push(
3150
- ...yml({
3170
+ yml({
3151
3171
  overrides: getOverrides(options, "yml")
3152
3172
  })
3153
3173
  );
3154
3174
  }
3155
3175
  if (enableTOML) {
3156
3176
  configs2.push(
3157
- ...toml({
3177
+ toml({
3158
3178
  overrides: getOverrides(options, "toml")
3159
3179
  })
3160
3180
  );
3161
3181
  }
3162
3182
  if (enableJSONC) {
3163
3183
  configs2.push(
3164
- ...jsonc({
3184
+ jsonc({
3165
3185
  overrides: getOverrides(options, "jsonc")
3166
3186
  })
3167
3187
  );
3168
3188
  }
3169
3189
  if (enableSort) {
3170
- configs2.push(
3171
- ...sort({
3172
- ...resolveSubOptions(options, "sort")
3173
- })
3174
- );
3190
+ configs2.push(sort(resolveSubOptions(options, "sort")));
3175
3191
  }
3176
3192
  if (enableTest) {
3177
3193
  configs2.push(
3178
- ...test({
3194
+ test({
3179
3195
  overrides: getOverrides(options, "test")
3180
3196
  }),
3181
- ...vitest({
3197
+ vitest({
3182
3198
  overrides: getOverrides(options, "test")
3183
3199
  })
3184
3200
  );
3185
3201
  }
3186
3202
  if (enableUnoCSS) {
3187
3203
  configs2.push(
3188
- ...unocss({
3204
+ unocss({
3189
3205
  overrides: getOverrides(options, "unocss")
3190
3206
  })
3191
3207
  );
3192
3208
  }
3193
3209
  if (enableMarkdown) {
3194
3210
  configs2.push(
3195
- ...markdown({
3211
+ markdown({
3196
3212
  extensions: supportedExtensions,
3197
3213
  overrides: getOverrides(options, "markdown")
3198
3214
  })
@@ -3200,14 +3216,14 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3200
3216
  }
3201
3217
  if (enableAntfu) {
3202
3218
  configs2.push(
3203
- ...antfu({
3219
+ antfu({
3204
3220
  overrides: getOverrides(options, "antfu")
3205
3221
  })
3206
3222
  );
3207
3223
  }
3208
3224
  if (enableDepend) {
3209
3225
  configs2.push(
3210
- ...depend({
3226
+ depend({
3211
3227
  ...resolveSubOptions(options, "depend"),
3212
3228
  overrides: getOverrides(options, "depend")
3213
3229
  })
@@ -3242,15 +3258,9 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3242
3258
  );
3243
3259
  }
3244
3260
  if (enableSVGO) {
3245
- configs2.push(
3246
- ...svgo({
3247
- ...resolveSubOptions(options, "svgo")
3248
- })
3249
- );
3261
+ configs2.push(svgo(resolveSubOptions(options, "svgo")));
3250
3262
  }
3251
- const configSpecials = specials({
3252
- ...resolveSubOptions(options, "specials")
3253
- });
3263
+ const configSpecials = specials(resolveSubOptions(options, "specials"));
3254
3264
  const configPrettier = enablePrettier ? prettier({
3255
3265
  ...resolveSubOptions(options, "prettier"),
3256
3266
  overrides: getOverrides(options, "prettier")
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "3.12.0",
5
- "packageManager": "pnpm@9.15.3",
4
+ "version": "3.12.2",
5
+ "packageManager": "pnpm@9.15.4",
6
6
  "description": "An opinionated ESLint config preset of ntnyq",
7
7
  "keywords": [
8
8
  "eslint",
@@ -41,9 +41,11 @@
41
41
  "scripts": {
42
42
  "build": "pnpm run generate:type && tsup",
43
43
  "dev": "tsup --watch src",
44
+ "docs:build": "pnpm -C docs run build",
45
+ "docs:dev": "pnpm -C docs run dev",
44
46
  "generate:site": "tsx scripts/generateSite.ts",
45
47
  "generate:type": "tsx scripts/generateType.ts",
46
- "lint": "eslint --flag unstable_ts_config .",
48
+ "lint": "eslint .",
47
49
  "prepare": "husky",
48
50
  "release": "run-s release:check release:version",
49
51
  "release:check": "run-s build lint typecheck",
@@ -72,10 +74,10 @@
72
74
  "@antfu/install-pkg": "^1.0.0",
73
75
  "@clack/prompts": "^0.9.1",
74
76
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
75
- "@eslint/js": "^9.17.0",
77
+ "@eslint/js": "^9.18.0",
76
78
  "@eslint/markdown": "^6.2.1",
77
- "@unocss/eslint-plugin": "^0.65.4",
78
- "@vitest/eslint-plugin": "^1.1.24",
79
+ "@unocss/eslint-plugin": "^65.4.0",
80
+ "@vitest/eslint-plugin": "^1.1.25",
79
81
  "eslint-config-flat-gitignore": "^1.0.0",
80
82
  "eslint-flat-config-utils": "^1.0.0",
81
83
  "eslint-import-resolver-typescript": "^3.7.0",
@@ -84,7 +86,7 @@
84
86
  "eslint-plugin-command": "^2.1.0",
85
87
  "eslint-plugin-depend": "^0.12.0",
86
88
  "eslint-plugin-format": "^1.0.1",
87
- "eslint-plugin-github-action": "^0.0.12",
89
+ "eslint-plugin-github-action": "^0.0.13",
88
90
  "eslint-plugin-import-x": "^4.6.1",
89
91
  "eslint-plugin-jsdoc": "^50.6.1",
90
92
  "eslint-plugin-jsonc": "^2.18.2",
@@ -94,7 +96,7 @@
94
96
  "eslint-plugin-pinia": "^0.4.1",
95
97
  "eslint-plugin-prettier": "^5.2.1",
96
98
  "eslint-plugin-regexp": "^2.7.0",
97
- "eslint-plugin-svgo": "^0.3.1",
99
+ "eslint-plugin-svgo": "^0.4.0",
98
100
  "eslint-plugin-toml": "^0.12.0",
99
101
  "eslint-plugin-unicorn": "^56.0.1",
100
102
  "eslint-plugin-unused-imports": "^4.1.4",
@@ -106,15 +108,15 @@
106
108
  "local-pkg": "^1.0.0",
107
109
  "prettier": "^3.4.2",
108
110
  "toml-eslint-parser": "^0.10.0",
109
- "typescript-eslint": "^8.19.1",
111
+ "typescript-eslint": "^8.20.0",
110
112
  "vue-eslint-parser": "^9.4.3",
111
113
  "yaml-eslint-parser": "^1.2.3"
112
114
  },
113
115
  "devDependencies": {
114
116
  "@ntnyq/prettier-config": "^1.22.1",
115
- "@types/node": "^22.10.5",
117
+ "@types/node": "^22.10.6",
116
118
  "bumpp": "^9.10.0",
117
- "eslint": "^9.17.0",
119
+ "eslint": "^9.18.0",
118
120
  "eslint-typegen": "^1.0.0",
119
121
  "husky": "^9.1.7",
120
122
  "jiti": "^2.4.2",
@@ -135,6 +137,7 @@
135
137
  }
136
138
  },
137
139
  "nano-staged": {
138
- "*.{js,ts,mjs,cjs,json,jsonc,md,yaml,yml}": "eslint --flag unstable_ts_config --fix"
140
+ "*.{js,ts,mjs,cjs,vue,svg,json,jsonc,md,yaml,yml}": "eslint --fix",
141
+ "*.css": "prettier --write"
139
142
  }
140
143
  }