@ntnyq/eslint-config 3.5.0 → 3.5.1

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
@@ -499,14 +499,37 @@ var unCategorizedRules = {
499
499
  var vue = (options = {}) => {
500
500
  const isVue3 = options.vueVersion !== 2;
501
501
  const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
502
+ const { files: FILES_VUE = [GLOB_VUE] } = options;
503
+ function getVueProcessor() {
504
+ const processorVueSFC = import_eslint_plugin_vue.default.processors[".vue"];
505
+ if (!sfcBlocks) return processorVueSFC;
506
+ return (0, import_eslint_merge_processors3.mergeProcessors)([
507
+ processorVueSFC,
508
+ (0, import_eslint_processor_vue_blocks.default)({
509
+ ...sfcBlocks,
510
+ blocks: {
511
+ styles: true,
512
+ ...sfcBlocks.blocks
513
+ }
514
+ })
515
+ ]);
516
+ }
502
517
  return [
503
518
  {
504
519
  name: "ntnyq/vue/setup",
505
520
  plugins: {
506
521
  vue: import_eslint_plugin_vue.default,
507
522
  "@typescript-eslint": import_typescript_eslint2.plugin
508
- },
523
+ }
524
+ },
525
+ {
526
+ name: "ntnyq/vue/rules",
527
+ files: [
528
+ // File apply vue rules
529
+ ...FILES_VUE
530
+ ],
509
531
  languageOptions: {
532
+ parser: parserVue,
510
533
  parserOptions: {
511
534
  sourceType: "module",
512
535
  ecmaVersion: "latest",
@@ -516,24 +539,8 @@ var vue = (options = {}) => {
516
539
  jsx: true
517
540
  }
518
541
  }
519
- }
520
- },
521
- {
522
- name: "ntnyq/vue/rules",
523
- files: [GLOB_VUE],
524
- languageOptions: {
525
- parser: parserVue
526
542
  },
527
- processor: sfcBlocks === false ? import_eslint_plugin_vue.default.processors[".vue"] : (0, import_eslint_merge_processors3.mergeProcessors)([
528
- import_eslint_plugin_vue.default.processors[".vue"],
529
- (0, import_eslint_processor_vue_blocks.default)({
530
- ...sfcBlocks,
531
- blocks: {
532
- styles: true,
533
- ...sfcBlocks.blocks
534
- }
535
- })
536
- ]),
543
+ processor: getVueProcessor(),
537
544
  rules: {
538
545
  ...isVue3 ? vue3Rules : vue2Rules,
539
546
  "vue/html-self-closing": [
@@ -1637,14 +1644,43 @@ var comments = (options = {}) => [
1637
1644
  // src/configs/markdown.ts
1638
1645
  var markdown = (options = {}) => {
1639
1646
  if (!Array.isArray(import_markdown.default.configs?.processor)) return [];
1647
+ const { files = [`${GLOB_MARKDOWN}/${GLOB_SRC}`], extensions = [] } = options;
1640
1648
  return [
1641
1649
  ...import_markdown.default.configs.processor.map((config) => ({
1642
1650
  ...config,
1643
1651
  name: `ntnyq/${config.name}`
1644
1652
  })),
1653
+ {
1654
+ name: "ntnyq/markdown/processor",
1655
+ files,
1656
+ ignores: [GLOB_MARKDOWN_NESTED],
1657
+ processor: (0, import_eslint_merge_processors.mergeProcessors)([
1658
+ import_markdown.default.processors.markdown,
1659
+ // Just pass through processor
1660
+ import_eslint_merge_processors2.processorPassThrough
1661
+ ])
1662
+ },
1663
+ {
1664
+ name: "ntnyq/markdown/parser",
1665
+ files,
1666
+ languageOptions: {
1667
+ parser: parserPlain
1668
+ }
1669
+ },
1645
1670
  {
1646
1671
  name: "ntnyq/markdown/disabled/code-blocks",
1647
- files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
1672
+ files: [
1673
+ ...files,
1674
+ // Extension block support
1675
+ ...extensions.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
1676
+ ],
1677
+ languageOptions: {
1678
+ parserOptions: {
1679
+ ecmaFeatures: {
1680
+ impliedStrict: true
1681
+ }
1682
+ }
1683
+ },
1648
1684
  rules: {
1649
1685
  "no-undef": "off",
1650
1686
  "no-alert": "off",
@@ -2043,14 +2079,21 @@ var recommendedRules = import_typescript_eslint3.configs.recommended.reduce((rul
2043
2079
  var typescript = (options = {}) => {
2044
2080
  const enableTypeAwareLint = !!options?.tsconfigPath;
2045
2081
  const {
2082
+ extensions = [],
2046
2083
  filesTypeAware = [GLOB_TS, GLOB_TSX],
2047
2084
  ignoresTypeAware = [GLOB_ASTRO, `${GLOB_MARKDOWN}/**`],
2048
2085
  overridesTypeAwareRules = {},
2049
2086
  parserOptions = {}
2050
2087
  } = options;
2051
- function createParserConfig(enableTypeAware = false, files = [], ignores2 = []) {
2088
+ const files = options.files ?? [
2089
+ GLOB_TS,
2090
+ GLOB_TSX,
2091
+ // Enable typescript in these exts
2092
+ ...extensions.map((ext) => `**/*.${ext}`)
2093
+ ];
2094
+ function createParserConfig(enableTypeAware = false, files2 = [], ignores2 = []) {
2052
2095
  const typescriptParserOptions = {
2053
- // extraFileExtensions: [''],
2096
+ extraFileExtensions: extensions.map((ext) => `.${ext}`),
2054
2097
  sourceType: "module",
2055
2098
  ...enableTypeAware ? {
2056
2099
  projectService: {
@@ -2063,7 +2106,7 @@ var typescript = (options = {}) => {
2063
2106
  };
2064
2107
  const parserConfig = {
2065
2108
  name: `ntnyq/ts/${enableTypeAware ? "parser-type-aware" : "parser"}`,
2066
- files,
2109
+ files: files2,
2067
2110
  ignores: [...ignores2],
2068
2111
  languageOptions: {
2069
2112
  parser: parserTypeScript,
@@ -2081,12 +2124,12 @@ var typescript = (options = {}) => {
2081
2124
  }
2082
2125
  },
2083
2126
  ...enableTypeAwareLint ? [
2084
- createParserConfig(false, [GLOB_TS, GLOB_TSX]),
2127
+ createParserConfig(false, files),
2085
2128
  createParserConfig(true, filesTypeAware, ignoresTypeAware)
2086
- ] : [createParserConfig(false, [GLOB_TS, GLOB_TSX])],
2129
+ ] : [createParserConfig(false, files)],
2087
2130
  {
2088
2131
  name: "ntnyq/ts/rules",
2089
- files: [GLOB_TS, GLOB_TSX],
2132
+ files,
2090
2133
  rules: {
2091
2134
  ...recommendedRules,
2092
2135
  // Disabled in favor of ts rules
@@ -2331,7 +2374,18 @@ var unusedImports = (options = {}) => [
2331
2374
  // src/core.ts
2332
2375
  async function defineESLintConfig(options = {}, ...userConfigs) {
2333
2376
  const configs2 = [];
2334
- if (options.gitignore ?? true) {
2377
+ const {
2378
+ markdown: enableMarkdown = true,
2379
+ gitignore: enableGitIgnore = true,
2380
+ vue: enableVue = hasVue,
2381
+ unocss: enableUnoCSS = hasUnoCSS,
2382
+ typescript: enableTypeScript = hasTypeScript,
2383
+ extensions: supportedExtensions = []
2384
+ } = options;
2385
+ if (enableVue) {
2386
+ supportedExtensions.push("vue");
2387
+ }
2388
+ if (enableGitIgnore) {
2335
2389
  configs2.push(
2336
2390
  ...gitignore({
2337
2391
  ...resolveSubOptions(options, "gitignore")
@@ -2384,14 +2438,24 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
2384
2438
  })
2385
2439
  );
2386
2440
  }
2387
- if (options.typescript ?? hasTypeScript) {
2441
+ if (enableTypeScript) {
2388
2442
  configs2.push(
2389
2443
  ...typescript({
2390
2444
  ...resolveSubOptions(options, "typescript"),
2445
+ extensions: supportedExtensions,
2391
2446
  overrides: getOverrides(options, "typescript")
2392
2447
  })
2393
2448
  );
2394
2449
  }
2450
+ if (enableVue) {
2451
+ configs2.push(
2452
+ ...vue({
2453
+ ...resolveSubOptions(options, "vue"),
2454
+ typescript: !!enableTypeScript,
2455
+ overrides: getOverrides(options, "vue")
2456
+ })
2457
+ );
2458
+ }
2395
2459
  if (options.yml ?? true) {
2396
2460
  configs2.push(
2397
2461
  ...yml({
@@ -2420,14 +2484,6 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
2420
2484
  })
2421
2485
  );
2422
2486
  }
2423
- if (options.vue ?? hasVue) {
2424
- configs2.push(
2425
- ...vue({
2426
- ...resolveSubOptions(options, "vue"),
2427
- overrides: getOverrides(options, "vue")
2428
- })
2429
- );
2430
- }
2431
2487
  if (options.test ?? hasVitest) {
2432
2488
  configs2.push(
2433
2489
  ...test({
@@ -2438,16 +2494,17 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
2438
2494
  })
2439
2495
  );
2440
2496
  }
2441
- if (options.unocss ?? hasUnoCSS) {
2497
+ if (enableUnoCSS) {
2442
2498
  configs2.push(
2443
2499
  ...unocss({
2444
2500
  overrides: getOverrides(options, "unocss")
2445
2501
  })
2446
2502
  );
2447
2503
  }
2448
- if (options.markdown ?? true) {
2504
+ if (enableMarkdown) {
2449
2505
  configs2.push(
2450
2506
  ...markdown({
2507
+ extensions: supportedExtensions,
2451
2508
  overrides: getOverrides(options, "markdown")
2452
2509
  })
2453
2510
  );
package/dist/index.d.cts CHANGED
@@ -14634,7 +14634,7 @@ type Yoda = [] | [("always" | "never")] | [
14634
14634
  onlyEquality?: boolean;
14635
14635
  }
14636
14636
  ];
14637
- type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/format/setup' | 'ntnyq/format/css' | 'ntnyq/format/scss' | 'ntnyq/format/less' | 'ntnyq/format/html' | 'ntnyq/github-action' | 'ntnyq/gitignore' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/jsdoc' | 'ntnyq/jsonc' | 'ntnyq/jsx' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/ntnyq' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/perfectionist' | 'ntnyq/regexp' | 'ntnyq/sort/tsconfig' | 'ntnyq/sort/package-json' | 'ntnyq/sort/i18n-locale/json' | 'ntnyq/sort/i18n-locale/yaml' | 'ntnyq/sort/pnpm-workspace' | 'ntnyq/specials/scripts' | 'ntnyq/specials/cli' | 'ntnyq/specials/userscript' | 'ntnyq/stylistic' | 'ntnyq/toml' | 'ntnyq/ts/setup' | 'ntnyq/ts/parser' | 'ntnyq/ts/rules' | 'ntnyq/ts/types' | 'ntnyq/unused-imports' | 'ntnyq/unicorn' | 'ntnyq/unocss' | 'ntnyq/vitest' | 'ntnyq/vue/setup' | 'ntnyq/vue/rules' | 'ntnyq/yaml';
14637
+ type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/format/setup' | 'ntnyq/format/css' | 'ntnyq/format/scss' | 'ntnyq/format/less' | 'ntnyq/format/html' | 'ntnyq/github-action' | 'ntnyq/gitignore' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/jsdoc' | 'ntnyq/jsonc' | 'ntnyq/jsx' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/processor' | 'ntnyq/markdown/parser' | 'ntnyq/markdown/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/ntnyq' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/perfectionist' | 'ntnyq/regexp' | 'ntnyq/sort/tsconfig' | 'ntnyq/sort/package-json' | 'ntnyq/sort/i18n-locale/json' | 'ntnyq/sort/i18n-locale/yaml' | 'ntnyq/sort/pnpm-workspace' | 'ntnyq/specials/scripts' | 'ntnyq/specials/cli' | 'ntnyq/specials/userscript' | 'ntnyq/stylistic' | 'ntnyq/toml' | 'ntnyq/ts/setup' | 'ntnyq/ts/parser' | 'ntnyq/ts/rules' | 'ntnyq/ts/types' | 'ntnyq/unused-imports' | 'ntnyq/unicorn' | 'ntnyq/unocss' | 'ntnyq/vitest' | 'ntnyq/vue/setup' | 'ntnyq/vue/rules' | 'ntnyq/yaml';
14638
14638
 
14639
14639
  /**
14640
14640
  * Typed flat config item
@@ -14676,6 +14676,21 @@ type TSESLintParserOptions = Pretty<Required<Required<ConfigWithExtends>['langua
14676
14676
  interface OptionsFiles {
14677
14677
  files?: string[];
14678
14678
  }
14679
+ /**
14680
+ * Options for add `extensions` support
14681
+ */
14682
+ interface OptionsExtensions {
14683
+ extensions?: string[];
14684
+ }
14685
+ /**
14686
+ * Options for add `features` support
14687
+ */
14688
+ type OptionsFeatures = {
14689
+ /**
14690
+ * Support typescript
14691
+ */
14692
+ typescript?: boolean;
14693
+ };
14679
14694
  /**
14680
14695
  * Options for overrides `rules`
14681
14696
  */
@@ -14771,7 +14786,7 @@ interface ConfigJavaScriptOptions extends OptionsOverrides {
14771
14786
  */
14772
14787
  strict?: boolean;
14773
14788
  }
14774
- interface ConfigTypeScriptOptions extends OptionsOverrides {
14789
+ interface ConfigTypeScriptOptions extends OptionsOverrides, OptionsFiles, OptionsExtensions {
14775
14790
  /**
14776
14791
  * Enable type aware check for TypeScript files
14777
14792
  */
@@ -14817,11 +14832,11 @@ interface ConfigJsoncOptions extends OptionsOverrides {
14817
14832
  }
14818
14833
  interface ConfigYmlOptions extends OptionsOverrides {
14819
14834
  }
14820
- interface ConfigMarkdownOptions extends OptionsOverrides {
14835
+ interface ConfigMarkdownOptions extends OptionsOverrides, OptionsFiles, OptionsExtensions {
14821
14836
  }
14822
14837
  interface ConfigTomlOptions extends OptionsOverrides {
14823
14838
  }
14824
- interface ConfigVueOptions extends OptionsOverrides {
14839
+ interface ConfigVueOptions extends OptionsOverrides, OptionsFiles, OptionsFeatures {
14825
14840
  /**
14826
14841
  * Create virtual files for Vue SFC blocks to enable linting.
14827
14842
  *
@@ -14889,7 +14904,7 @@ interface ConfigOptionsInternal {
14889
14904
  /**
14890
14905
  * Config factory options
14891
14906
  */
14892
- interface ConfigOptions extends ConfigOptionsInternal {
14907
+ interface ConfigOptions extends ConfigOptionsInternal, OptionsExtensions {
14893
14908
  node?: ConfigNodeOptions;
14894
14909
  jsdoc?: ConfigJsdocOptions;
14895
14910
  ignores?: ConfigIgnoresOptions;
@@ -15095,4 +15110,4 @@ declare const unusedImports: (options?: ConfigUnusedImportsOptions) => TypedConf
15095
15110
  */
15096
15111
  declare const DEFAULT_PRETTIER_OPTIONS: PrettierOptions;
15097
15112
 
15098
- export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigFormatOptions, type ConfigGitHubActionOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigNtnyqOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigSortOptions, type ConfigStylisticOptions, type ConfigTestOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVueOptions, type ConfigYmlOptions, DEFAULT_PRETTIER_OPTIONS, type ESLintConfig, type ESLintParser, type ESLintParserOptions, type ESLintProcessor, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsFiles, type OptionsOverrides, type PerfectionistSortOrder, type PerfectionistSortType, type PrettierOptions, type Pretty, type ResolvedOptions, type RuleOptions, type TSESLintParserOptions, type TypedConfigItem, antfu, command, comments, defineESLintConfig, format, getOverrides, githubAction, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, mergePrettierOptions, node, ntnyq, parserPlain, parserTypeScript, perfectionist, prettier, regexp, resolveSubOptions, sort, specials, stylistic, test, toArray, toml, typescript, unicorn, unocss, unusedImports, vitest, vue, yml };
15113
+ export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigFormatOptions, type ConfigGitHubActionOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigNtnyqOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigSortOptions, type ConfigStylisticOptions, type ConfigTestOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVueOptions, type ConfigYmlOptions, DEFAULT_PRETTIER_OPTIONS, type ESLintConfig, type ESLintParser, type ESLintParserOptions, type ESLintProcessor, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsExtensions, type OptionsFeatures, type OptionsFiles, type OptionsOverrides, type PerfectionistSortOrder, type PerfectionistSortType, type PrettierOptions, type Pretty, type ResolvedOptions, type RuleOptions, type TSESLintParserOptions, type TypedConfigItem, antfu, command, comments, defineESLintConfig, format, getOverrides, githubAction, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, mergePrettierOptions, node, ntnyq, parserPlain, parserTypeScript, perfectionist, prettier, regexp, resolveSubOptions, sort, specials, stylistic, test, toArray, toml, typescript, unicorn, unocss, unusedImports, vitest, vue, yml };
package/dist/index.d.ts CHANGED
@@ -14634,7 +14634,7 @@ type Yoda = [] | [("always" | "never")] | [
14634
14634
  onlyEquality?: boolean;
14635
14635
  }
14636
14636
  ];
14637
- type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/format/setup' | 'ntnyq/format/css' | 'ntnyq/format/scss' | 'ntnyq/format/less' | 'ntnyq/format/html' | 'ntnyq/github-action' | 'ntnyq/gitignore' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/jsdoc' | 'ntnyq/jsonc' | 'ntnyq/jsx' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/ntnyq' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/perfectionist' | 'ntnyq/regexp' | 'ntnyq/sort/tsconfig' | 'ntnyq/sort/package-json' | 'ntnyq/sort/i18n-locale/json' | 'ntnyq/sort/i18n-locale/yaml' | 'ntnyq/sort/pnpm-workspace' | 'ntnyq/specials/scripts' | 'ntnyq/specials/cli' | 'ntnyq/specials/userscript' | 'ntnyq/stylistic' | 'ntnyq/toml' | 'ntnyq/ts/setup' | 'ntnyq/ts/parser' | 'ntnyq/ts/rules' | 'ntnyq/ts/types' | 'ntnyq/unused-imports' | 'ntnyq/unicorn' | 'ntnyq/unocss' | 'ntnyq/vitest' | 'ntnyq/vue/setup' | 'ntnyq/vue/rules' | 'ntnyq/yaml';
14637
+ type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/format/setup' | 'ntnyq/format/css' | 'ntnyq/format/scss' | 'ntnyq/format/less' | 'ntnyq/format/html' | 'ntnyq/github-action' | 'ntnyq/gitignore' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/jsdoc' | 'ntnyq/jsonc' | 'ntnyq/jsx' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/processor' | 'ntnyq/markdown/parser' | 'ntnyq/markdown/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/ntnyq' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/perfectionist' | 'ntnyq/regexp' | 'ntnyq/sort/tsconfig' | 'ntnyq/sort/package-json' | 'ntnyq/sort/i18n-locale/json' | 'ntnyq/sort/i18n-locale/yaml' | 'ntnyq/sort/pnpm-workspace' | 'ntnyq/specials/scripts' | 'ntnyq/specials/cli' | 'ntnyq/specials/userscript' | 'ntnyq/stylistic' | 'ntnyq/toml' | 'ntnyq/ts/setup' | 'ntnyq/ts/parser' | 'ntnyq/ts/rules' | 'ntnyq/ts/types' | 'ntnyq/unused-imports' | 'ntnyq/unicorn' | 'ntnyq/unocss' | 'ntnyq/vitest' | 'ntnyq/vue/setup' | 'ntnyq/vue/rules' | 'ntnyq/yaml';
14638
14638
 
14639
14639
  /**
14640
14640
  * Typed flat config item
@@ -14676,6 +14676,21 @@ type TSESLintParserOptions = Pretty<Required<Required<ConfigWithExtends>['langua
14676
14676
  interface OptionsFiles {
14677
14677
  files?: string[];
14678
14678
  }
14679
+ /**
14680
+ * Options for add `extensions` support
14681
+ */
14682
+ interface OptionsExtensions {
14683
+ extensions?: string[];
14684
+ }
14685
+ /**
14686
+ * Options for add `features` support
14687
+ */
14688
+ type OptionsFeatures = {
14689
+ /**
14690
+ * Support typescript
14691
+ */
14692
+ typescript?: boolean;
14693
+ };
14679
14694
  /**
14680
14695
  * Options for overrides `rules`
14681
14696
  */
@@ -14771,7 +14786,7 @@ interface ConfigJavaScriptOptions extends OptionsOverrides {
14771
14786
  */
14772
14787
  strict?: boolean;
14773
14788
  }
14774
- interface ConfigTypeScriptOptions extends OptionsOverrides {
14789
+ interface ConfigTypeScriptOptions extends OptionsOverrides, OptionsFiles, OptionsExtensions {
14775
14790
  /**
14776
14791
  * Enable type aware check for TypeScript files
14777
14792
  */
@@ -14817,11 +14832,11 @@ interface ConfigJsoncOptions extends OptionsOverrides {
14817
14832
  }
14818
14833
  interface ConfigYmlOptions extends OptionsOverrides {
14819
14834
  }
14820
- interface ConfigMarkdownOptions extends OptionsOverrides {
14835
+ interface ConfigMarkdownOptions extends OptionsOverrides, OptionsFiles, OptionsExtensions {
14821
14836
  }
14822
14837
  interface ConfigTomlOptions extends OptionsOverrides {
14823
14838
  }
14824
- interface ConfigVueOptions extends OptionsOverrides {
14839
+ interface ConfigVueOptions extends OptionsOverrides, OptionsFiles, OptionsFeatures {
14825
14840
  /**
14826
14841
  * Create virtual files for Vue SFC blocks to enable linting.
14827
14842
  *
@@ -14889,7 +14904,7 @@ interface ConfigOptionsInternal {
14889
14904
  /**
14890
14905
  * Config factory options
14891
14906
  */
14892
- interface ConfigOptions extends ConfigOptionsInternal {
14907
+ interface ConfigOptions extends ConfigOptionsInternal, OptionsExtensions {
14893
14908
  node?: ConfigNodeOptions;
14894
14909
  jsdoc?: ConfigJsdocOptions;
14895
14910
  ignores?: ConfigIgnoresOptions;
@@ -15095,4 +15110,4 @@ declare const unusedImports: (options?: ConfigUnusedImportsOptions) => TypedConf
15095
15110
  */
15096
15111
  declare const DEFAULT_PRETTIER_OPTIONS: PrettierOptions;
15097
15112
 
15098
- export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigFormatOptions, type ConfigGitHubActionOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigNtnyqOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigSortOptions, type ConfigStylisticOptions, type ConfigTestOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVueOptions, type ConfigYmlOptions, DEFAULT_PRETTIER_OPTIONS, type ESLintConfig, type ESLintParser, type ESLintParserOptions, type ESLintProcessor, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsFiles, type OptionsOverrides, type PerfectionistSortOrder, type PerfectionistSortType, type PrettierOptions, type Pretty, type ResolvedOptions, type RuleOptions, type TSESLintParserOptions, type TypedConfigItem, antfu, command, comments, defineESLintConfig, format, getOverrides, githubAction, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, mergePrettierOptions, node, ntnyq, parserPlain, parserTypeScript, perfectionist, prettier, regexp, resolveSubOptions, sort, specials, stylistic, test, toArray, toml, typescript, unicorn, unocss, unusedImports, vitest, vue, yml };
15113
+ export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigFormatOptions, type ConfigGitHubActionOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigNtnyqOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigSortOptions, type ConfigStylisticOptions, type ConfigTestOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVueOptions, type ConfigYmlOptions, DEFAULT_PRETTIER_OPTIONS, type ESLintConfig, type ESLintParser, type ESLintParserOptions, type ESLintProcessor, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsExtensions, type OptionsFeatures, type OptionsFiles, type OptionsOverrides, type PerfectionistSortOrder, type PerfectionistSortType, type PrettierOptions, type Pretty, type ResolvedOptions, type RuleOptions, type TSESLintParserOptions, type TypedConfigItem, antfu, command, comments, defineESLintConfig, format, getOverrides, githubAction, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, mergePrettierOptions, node, ntnyq, parserPlain, parserTypeScript, perfectionist, prettier, regexp, resolveSubOptions, sort, specials, stylistic, test, toArray, toml, typescript, unicorn, unocss, unusedImports, vitest, vue, yml };
package/dist/index.js CHANGED
@@ -358,14 +358,37 @@ var unCategorizedRules = {
358
358
  var vue = (options = {}) => {
359
359
  const isVue3 = options.vueVersion !== 2;
360
360
  const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
361
+ const { files: FILES_VUE = [GLOB_VUE] } = options;
362
+ function getVueProcessor() {
363
+ const processorVueSFC = default3.processors[".vue"];
364
+ if (!sfcBlocks) return processorVueSFC;
365
+ return mergeProcessors2([
366
+ processorVueSFC,
367
+ default22({
368
+ ...sfcBlocks,
369
+ blocks: {
370
+ styles: true,
371
+ ...sfcBlocks.blocks
372
+ }
373
+ })
374
+ ]);
375
+ }
361
376
  return [
362
377
  {
363
378
  name: "ntnyq/vue/setup",
364
379
  plugins: {
365
380
  vue: default3,
366
381
  "@typescript-eslint": plugin
367
- },
382
+ }
383
+ },
384
+ {
385
+ name: "ntnyq/vue/rules",
386
+ files: [
387
+ // File apply vue rules
388
+ ...FILES_VUE
389
+ ],
368
390
  languageOptions: {
391
+ parser: parserVue,
369
392
  parserOptions: {
370
393
  sourceType: "module",
371
394
  ecmaVersion: "latest",
@@ -375,24 +398,8 @@ var vue = (options = {}) => {
375
398
  jsx: true
376
399
  }
377
400
  }
378
- }
379
- },
380
- {
381
- name: "ntnyq/vue/rules",
382
- files: [GLOB_VUE],
383
- languageOptions: {
384
- parser: parserVue
385
401
  },
386
- processor: sfcBlocks === false ? default3.processors[".vue"] : mergeProcessors2([
387
- default3.processors[".vue"],
388
- default22({
389
- ...sfcBlocks,
390
- blocks: {
391
- styles: true,
392
- ...sfcBlocks.blocks
393
- }
394
- })
395
- ]),
402
+ processor: getVueProcessor(),
396
403
  rules: {
397
404
  ...isVue3 ? vue3Rules : vue2Rules,
398
405
  "vue/html-self-closing": [
@@ -1496,14 +1503,43 @@ var comments = (options = {}) => [
1496
1503
  // src/configs/markdown.ts
1497
1504
  var markdown = (options = {}) => {
1498
1505
  if (!Array.isArray(default7.configs?.processor)) return [];
1506
+ const { files = [`${GLOB_MARKDOWN}/${GLOB_SRC}`], extensions = [] } = options;
1499
1507
  return [
1500
1508
  ...default7.configs.processor.map((config) => ({
1501
1509
  ...config,
1502
1510
  name: `ntnyq/${config.name}`
1503
1511
  })),
1512
+ {
1513
+ name: "ntnyq/markdown/processor",
1514
+ files,
1515
+ ignores: [GLOB_MARKDOWN_NESTED],
1516
+ processor: mergeProcessors([
1517
+ default7.processors.markdown,
1518
+ // Just pass through processor
1519
+ processorPassThrough
1520
+ ])
1521
+ },
1522
+ {
1523
+ name: "ntnyq/markdown/parser",
1524
+ files,
1525
+ languageOptions: {
1526
+ parser: parserPlain
1527
+ }
1528
+ },
1504
1529
  {
1505
1530
  name: "ntnyq/markdown/disabled/code-blocks",
1506
- files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
1531
+ files: [
1532
+ ...files,
1533
+ // Extension block support
1534
+ ...extensions.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
1535
+ ],
1536
+ languageOptions: {
1537
+ parserOptions: {
1538
+ ecmaFeatures: {
1539
+ impliedStrict: true
1540
+ }
1541
+ }
1542
+ },
1507
1543
  rules: {
1508
1544
  "no-undef": "off",
1509
1545
  "no-alert": "off",
@@ -1902,14 +1938,21 @@ var recommendedRules = configs.recommended.reduce((rules, config) => {
1902
1938
  var typescript = (options = {}) => {
1903
1939
  const enableTypeAwareLint = !!options?.tsconfigPath;
1904
1940
  const {
1941
+ extensions = [],
1905
1942
  filesTypeAware = [GLOB_TS, GLOB_TSX],
1906
1943
  ignoresTypeAware = [GLOB_ASTRO, `${GLOB_MARKDOWN}/**`],
1907
1944
  overridesTypeAwareRules = {},
1908
1945
  parserOptions = {}
1909
1946
  } = options;
1910
- function createParserConfig(enableTypeAware = false, files = [], ignores2 = []) {
1947
+ const files = options.files ?? [
1948
+ GLOB_TS,
1949
+ GLOB_TSX,
1950
+ // Enable typescript in these exts
1951
+ ...extensions.map((ext) => `**/*.${ext}`)
1952
+ ];
1953
+ function createParserConfig(enableTypeAware = false, files2 = [], ignores2 = []) {
1911
1954
  const typescriptParserOptions = {
1912
- // extraFileExtensions: [''],
1955
+ extraFileExtensions: extensions.map((ext) => `.${ext}`),
1913
1956
  sourceType: "module",
1914
1957
  ...enableTypeAware ? {
1915
1958
  projectService: {
@@ -1922,7 +1965,7 @@ var typescript = (options = {}) => {
1922
1965
  };
1923
1966
  const parserConfig = {
1924
1967
  name: `ntnyq/ts/${enableTypeAware ? "parser-type-aware" : "parser"}`,
1925
- files,
1968
+ files: files2,
1926
1969
  ignores: [...ignores2],
1927
1970
  languageOptions: {
1928
1971
  parser: parserTypeScript,
@@ -1940,12 +1983,12 @@ var typescript = (options = {}) => {
1940
1983
  }
1941
1984
  },
1942
1985
  ...enableTypeAwareLint ? [
1943
- createParserConfig(false, [GLOB_TS, GLOB_TSX]),
1986
+ createParserConfig(false, files),
1944
1987
  createParserConfig(true, filesTypeAware, ignoresTypeAware)
1945
- ] : [createParserConfig(false, [GLOB_TS, GLOB_TSX])],
1988
+ ] : [createParserConfig(false, files)],
1946
1989
  {
1947
1990
  name: "ntnyq/ts/rules",
1948
- files: [GLOB_TS, GLOB_TSX],
1991
+ files,
1949
1992
  rules: {
1950
1993
  ...recommendedRules,
1951
1994
  // Disabled in favor of ts rules
@@ -2190,7 +2233,18 @@ var unusedImports = (options = {}) => [
2190
2233
  // src/core.ts
2191
2234
  async function defineESLintConfig(options = {}, ...userConfigs) {
2192
2235
  const configs2 = [];
2193
- if (options.gitignore ?? true) {
2236
+ const {
2237
+ markdown: enableMarkdown = true,
2238
+ gitignore: enableGitIgnore = true,
2239
+ vue: enableVue = hasVue,
2240
+ unocss: enableUnoCSS = hasUnoCSS,
2241
+ typescript: enableTypeScript = hasTypeScript,
2242
+ extensions: supportedExtensions = []
2243
+ } = options;
2244
+ if (enableVue) {
2245
+ supportedExtensions.push("vue");
2246
+ }
2247
+ if (enableGitIgnore) {
2194
2248
  configs2.push(
2195
2249
  ...gitignore({
2196
2250
  ...resolveSubOptions(options, "gitignore")
@@ -2243,14 +2297,24 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
2243
2297
  })
2244
2298
  );
2245
2299
  }
2246
- if (options.typescript ?? hasTypeScript) {
2300
+ if (enableTypeScript) {
2247
2301
  configs2.push(
2248
2302
  ...typescript({
2249
2303
  ...resolveSubOptions(options, "typescript"),
2304
+ extensions: supportedExtensions,
2250
2305
  overrides: getOverrides(options, "typescript")
2251
2306
  })
2252
2307
  );
2253
2308
  }
2309
+ if (enableVue) {
2310
+ configs2.push(
2311
+ ...vue({
2312
+ ...resolveSubOptions(options, "vue"),
2313
+ typescript: !!enableTypeScript,
2314
+ overrides: getOverrides(options, "vue")
2315
+ })
2316
+ );
2317
+ }
2254
2318
  if (options.yml ?? true) {
2255
2319
  configs2.push(
2256
2320
  ...yml({
@@ -2279,14 +2343,6 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
2279
2343
  })
2280
2344
  );
2281
2345
  }
2282
- if (options.vue ?? hasVue) {
2283
- configs2.push(
2284
- ...vue({
2285
- ...resolveSubOptions(options, "vue"),
2286
- overrides: getOverrides(options, "vue")
2287
- })
2288
- );
2289
- }
2290
2346
  if (options.test ?? hasVitest) {
2291
2347
  configs2.push(
2292
2348
  ...test({
@@ -2297,16 +2353,17 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
2297
2353
  })
2298
2354
  );
2299
2355
  }
2300
- if (options.unocss ?? hasUnoCSS) {
2356
+ if (enableUnoCSS) {
2301
2357
  configs2.push(
2302
2358
  ...unocss({
2303
2359
  overrides: getOverrides(options, "unocss")
2304
2360
  })
2305
2361
  );
2306
2362
  }
2307
- if (options.markdown ?? true) {
2363
+ if (enableMarkdown) {
2308
2364
  configs2.push(
2309
2365
  ...markdown({
2366
+ extensions: supportedExtensions,
2310
2367
  overrides: getOverrides(options, "markdown")
2311
2368
  })
2312
2369
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "3.5.0",
4
+ "version": "3.5.1",
5
5
  "packageManager": "pnpm@9.14.2",
6
6
  "description": "An opinionated ESLint config preset of ntnyq",
7
7
  "keywords": [