@ntnyq/eslint-config 3.10.1 → 3.10.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
@@ -59,6 +59,7 @@ __export(index_exports, {
59
59
  GLOB_SRC_EXT: () => GLOB_SRC_EXT,
60
60
  GLOB_STYLE: () => GLOB_STYLE,
61
61
  GLOB_SVELTE: () => GLOB_SVELTE,
62
+ GLOB_SVG: () => GLOB_SVG,
62
63
  GLOB_TEST: () => GLOB_TEST,
63
64
  GLOB_TOML: () => GLOB_TOML,
64
65
  GLOB_TS: () => GLOB_TS,
@@ -69,6 +70,8 @@ __export(index_exports, {
69
70
  antfu: () => antfu,
70
71
  command: () => command,
71
72
  comments: () => comments,
73
+ createNodeResolver: () => createNodeResolver,
74
+ createTypeScriptImportResolver: () => import_eslint_import_resolver_typescript.createTypeScriptImportResolver,
72
75
  defineESLintConfig: () => defineESLintConfig,
73
76
  depend: () => depend,
74
77
  esX: () => esX,
@@ -216,6 +219,10 @@ var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/es
216
219
  // src/eslint/configs.ts
217
220
  var import_typescript_eslint3 = require("typescript-eslint");
218
221
 
222
+ // src/eslint/resolvers.ts
223
+ var import_eslint_import_resolver_typescript = require("eslint-import-resolver-typescript");
224
+ var createNodeResolver = import_eslint_plugin_import_x.default.createNodeResolver;
225
+
219
226
  // src/eslint/processors.ts
220
227
  var import_eslint_merge_processors = require("eslint-merge-processors");
221
228
  var import_eslint_merge_processors2 = require("eslint-merge-processors");
@@ -245,6 +252,7 @@ var GLOB_JSON = "**/*.json";
245
252
  var GLOB_JSON5 = "**/*.json5";
246
253
  var GLOB_JSONC = "**/*.jsonc";
247
254
  var GLOB_PACKAGE_JSON = "**/package.json";
255
+ var GLOB_SVG = "**/*.svg";
248
256
  var GLOB_VUE = "**/*.vue";
249
257
  var GLOB_YAML = "**/*.y?(a)ml";
250
258
  var GLOB_TOML = "**/*.toml";
@@ -1847,38 +1855,46 @@ var ignores = (customIgnores = []) => [
1847
1855
  ];
1848
1856
 
1849
1857
  // src/configs/importX.ts
1850
- var { createNodeResolver } = import_eslint_plugin_import_x.default;
1851
- var importX = (options = {}) => [
1852
- {
1853
- name: "ntnyq/import-x",
1854
- plugins: {
1855
- "import-x": import_eslint_plugin_import_x.default
1856
- },
1857
- settings: {
1858
- "import-x/resolver-next": [
1859
- createNodeResolver({
1860
- extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts", ".json"]
1861
- })
1862
- ]
1863
- },
1864
- rules: {
1865
- "import-x/no-unresolved": "off",
1866
- "import-x/no-absolute-path": "off",
1867
- "import-x/no-named-as-default-member": "off",
1868
- "import-x/no-named-default": "off",
1869
- // disabled in favor or `perfectionist/sort-imports`
1870
- "import-x/order": "off",
1871
- "import-x/first": "error",
1872
- "import-x/export": "error",
1873
- "import-x/no-self-import": "error",
1874
- "import-x/no-duplicates": "error",
1875
- "import-x/no-mutable-exports": "error",
1876
- "import-x/newline-after-import": "error",
1877
- // Overrides rules
1878
- ...options.overrides
1858
+ var importX = (options = {}) => {
1859
+ const {
1860
+ typescript: enableTypeScript,
1861
+ // use typescript resolve if possible
1862
+ preferTypeScriptResolver = true
1863
+ } = options;
1864
+ return [
1865
+ {
1866
+ name: "ntnyq/import-x",
1867
+ plugins: {
1868
+ "import-x": import_eslint_plugin_import_x.default
1869
+ },
1870
+ settings: {
1871
+ "import-x/resolver-next": [
1872
+ enableTypeScript && preferTypeScriptResolver ? (0, import_eslint_import_resolver_typescript.createTypeScriptImportResolver)({
1873
+ extensions: [".ts", ".tsx", ".d.ts", ".js", ".jsx", ".json", ".node"]
1874
+ }) : createNodeResolver({
1875
+ extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts", ".json"]
1876
+ })
1877
+ ]
1878
+ },
1879
+ rules: {
1880
+ "import-x/no-unresolved": "off",
1881
+ "import-x/no-absolute-path": "off",
1882
+ "import-x/no-named-as-default-member": "off",
1883
+ "import-x/no-named-default": "off",
1884
+ // disabled in favor or `perfectionist/sort-imports`
1885
+ "import-x/order": "off",
1886
+ "import-x/first": "error",
1887
+ "import-x/export": "error",
1888
+ "import-x/no-self-import": "error",
1889
+ "import-x/no-duplicates": "error",
1890
+ "import-x/no-mutable-exports": "error",
1891
+ "import-x/newline-after-import": "error",
1892
+ // Overrides rules
1893
+ ...options.overrides
1894
+ }
1879
1895
  }
1880
- }
1881
- ];
1896
+ ];
1897
+ };
1882
1898
 
1883
1899
  // src/configs/unicorn.ts
1884
1900
  var disabledRules2 = {
@@ -2128,7 +2144,7 @@ var markdown = (options = {}) => {
2128
2144
  // src/configs/prettier.ts
2129
2145
  var prettier = (options = {}) => {
2130
2146
  const {
2131
- disabledFiles = [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
2147
+ disabledFiles = [GLOB_SVG, GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
2132
2148
  // User defined disabled files
2133
2149
  userDisabledFiles = []
2134
2150
  } = options;
@@ -3073,6 +3089,8 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3073
3089
  ...resolveSubOptions(options, "command")
3074
3090
  }),
3075
3091
  ...importX({
3092
+ ...resolveSubOptions(options, "importX"),
3093
+ typescript: !!enableTypeScript,
3076
3094
  overrides: getOverrides(options, "importX")
3077
3095
  }),
3078
3096
  ...jsdoc({
@@ -3271,6 +3289,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3271
3289
  GLOB_SRC_EXT,
3272
3290
  GLOB_STYLE,
3273
3291
  GLOB_SVELTE,
3292
+ GLOB_SVG,
3274
3293
  GLOB_TEST,
3275
3294
  GLOB_TOML,
3276
3295
  GLOB_TS,
@@ -3281,6 +3300,8 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3281
3300
  antfu,
3282
3301
  command,
3283
3302
  comments,
3303
+ createNodeResolver,
3304
+ createTypeScriptImportResolver,
3284
3305
  defineESLintConfig,
3285
3306
  depend,
3286
3307
  esX,
package/dist/index.d.cts CHANGED
@@ -37,6 +37,7 @@ export { default as pluginStylistic } from '@stylistic/eslint-plugin';
37
37
  export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
38
38
  export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
39
39
  export { default as pluginComments } from '@eslint-community/eslint-plugin-eslint-comments';
40
+ import * as eslint_plugin_import_x_node_resolver_js from 'eslint-plugin-import-x/node-resolver.js';
40
41
  export { mergeProcessors, processorPassThrough } from 'eslint-merge-processors';
41
42
  import * as vueEslintParser from 'vue-eslint-parser';
42
43
  export { vueEslintParser as parserVue };
@@ -46,6 +47,7 @@ import * as yamlEslintParser from 'yaml-eslint-parser';
46
47
  export { yamlEslintParser as parserYaml };
47
48
  import * as jsoncEslintParser from 'jsonc-eslint-parser';
48
49
  export { jsoncEslintParser as parserJsonc };
50
+ export { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
49
51
 
50
52
  /**
51
53
  * @file Type Utils
@@ -17697,7 +17699,13 @@ type ConfigGitIgnoreOptions = Omit<FlatGitignoreOptions, 'strict'> & {
17697
17699
  strict?: boolean;
17698
17700
  };
17699
17701
  type ConfigIgnoresOptions = string[];
17700
- interface ConfigImportXOptions extends OptionsOverrides {
17702
+ interface ConfigImportXOptions extends OptionsFeatures, OptionsOverrides {
17703
+ /**
17704
+ * Use typescriptResolver if `typescript` is installed
17705
+ *
17706
+ * @default true
17707
+ */
17708
+ preferTypeScriptResolver?: boolean;
17701
17709
  }
17702
17710
  interface ConfigJavaScriptOptions extends OptionsOverrides {
17703
17711
  /**
@@ -18004,6 +18012,7 @@ declare const GLOB_JSON = "**/*.json";
18004
18012
  declare const GLOB_JSON5 = "**/*.json5";
18005
18013
  declare const GLOB_JSONC = "**/*.jsonc";
18006
18014
  declare const GLOB_PACKAGE_JSON = "**/package.json";
18015
+ declare const GLOB_SVG = "**/*.svg";
18007
18016
  declare const GLOB_VUE = "**/*.vue";
18008
18017
  declare const GLOB_YAML = "**/*.y?(a)ml";
18009
18018
  declare const GLOB_TOML = "**/*.toml";
@@ -18067,6 +18076,8 @@ declare const parserTypeScript: {
18067
18076
  */
18068
18077
  declare const parserPlain: ESLintParser;
18069
18078
 
18079
+ declare const createNodeResolver: typeof eslint_plugin_import_x_node_resolver_js.createNodeResolver;
18080
+
18070
18081
  declare const vue: (options?: ConfigVueOptions) => TypedConfigItem[];
18071
18082
 
18072
18083
  declare const yml: (options?: ConfigYmlOptions) => TypedConfigItem[];
@@ -18152,4 +18163,4 @@ declare const unusedImports: (options?: ConfigUnusedImportsOptions) => TypedConf
18152
18163
  */
18153
18164
  declare const DEFAULT_PRETTIER_OPTIONS: PrettierOptions;
18154
18165
 
18155
- export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigDependOptions, type ConfigEsXOptions, type ConfigFormatOptions, type ConfigGitHubActionOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportXOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigNtnyqOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPiniaOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigSVGOOptions, type ConfigSortOptions, type ConfigSpecialsOptions, 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, type ESLintRuleSeverity, type ESLintRulesRecord, 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_PACKAGE_JSON, GLOB_PINIA_STORE, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_TYPES, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type OptionsExtensions, type OptionsFeatures, type OptionsFiles, type OptionsOverrides, type PrettierOptions, type Pretty, type ResolvedOptions, type RuleOptions, type TSESLintParserOptions, type TypedConfigItem, antfu, command, comments, defineESLintConfig, depend, esX, format, getOverrides, githubAction, gitignore, hasPinia, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, importX, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, mergePrettierOptions, node, ntnyq, parserPlain, parserTypeScript, perfectionist, pinia, prettier, regexp, resolveSubOptions, sort, specials, stylistic, svgo, test, toArray, toml, typescript, unicorn, unocss, unusedImports, vitest, vue, yml };
18166
+ export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigDependOptions, type ConfigEsXOptions, type ConfigFormatOptions, type ConfigGitHubActionOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportXOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigNtnyqOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPiniaOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigSVGOOptions, type ConfigSortOptions, type ConfigSpecialsOptions, 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, type ESLintRuleSeverity, type ESLintRulesRecord, 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_PACKAGE_JSON, GLOB_PINIA_STORE, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_TYPES, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type OptionsExtensions, type OptionsFeatures, type OptionsFiles, type OptionsOverrides, type PrettierOptions, type Pretty, type ResolvedOptions, type RuleOptions, type TSESLintParserOptions, type TypedConfigItem, antfu, command, comments, createNodeResolver, defineESLintConfig, depend, esX, format, getOverrides, githubAction, gitignore, hasPinia, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, importX, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, mergePrettierOptions, node, ntnyq, parserPlain, parserTypeScript, perfectionist, pinia, prettier, regexp, resolveSubOptions, sort, specials, stylistic, svgo, test, toArray, toml, typescript, unicorn, unocss, unusedImports, vitest, vue, yml };
package/dist/index.d.ts CHANGED
@@ -37,6 +37,7 @@ export { default as pluginStylistic } from '@stylistic/eslint-plugin';
37
37
  export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
38
38
  export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
39
39
  export { default as pluginComments } from '@eslint-community/eslint-plugin-eslint-comments';
40
+ import * as eslint_plugin_import_x_node_resolver_js from 'eslint-plugin-import-x/node-resolver.js';
40
41
  export { mergeProcessors, processorPassThrough } from 'eslint-merge-processors';
41
42
  import * as vueEslintParser from 'vue-eslint-parser';
42
43
  export { vueEslintParser as parserVue };
@@ -46,6 +47,7 @@ import * as yamlEslintParser from 'yaml-eslint-parser';
46
47
  export { yamlEslintParser as parserYaml };
47
48
  import * as jsoncEslintParser from 'jsonc-eslint-parser';
48
49
  export { jsoncEslintParser as parserJsonc };
50
+ export { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
49
51
 
50
52
  /**
51
53
  * @file Type Utils
@@ -17697,7 +17699,13 @@ type ConfigGitIgnoreOptions = Omit<FlatGitignoreOptions, 'strict'> & {
17697
17699
  strict?: boolean;
17698
17700
  };
17699
17701
  type ConfigIgnoresOptions = string[];
17700
- interface ConfigImportXOptions extends OptionsOverrides {
17702
+ interface ConfigImportXOptions extends OptionsFeatures, OptionsOverrides {
17703
+ /**
17704
+ * Use typescriptResolver if `typescript` is installed
17705
+ *
17706
+ * @default true
17707
+ */
17708
+ preferTypeScriptResolver?: boolean;
17701
17709
  }
17702
17710
  interface ConfigJavaScriptOptions extends OptionsOverrides {
17703
17711
  /**
@@ -18004,6 +18012,7 @@ declare const GLOB_JSON = "**/*.json";
18004
18012
  declare const GLOB_JSON5 = "**/*.json5";
18005
18013
  declare const GLOB_JSONC = "**/*.jsonc";
18006
18014
  declare const GLOB_PACKAGE_JSON = "**/package.json";
18015
+ declare const GLOB_SVG = "**/*.svg";
18007
18016
  declare const GLOB_VUE = "**/*.vue";
18008
18017
  declare const GLOB_YAML = "**/*.y?(a)ml";
18009
18018
  declare const GLOB_TOML = "**/*.toml";
@@ -18067,6 +18076,8 @@ declare const parserTypeScript: {
18067
18076
  */
18068
18077
  declare const parserPlain: ESLintParser;
18069
18078
 
18079
+ declare const createNodeResolver: typeof eslint_plugin_import_x_node_resolver_js.createNodeResolver;
18080
+
18070
18081
  declare const vue: (options?: ConfigVueOptions) => TypedConfigItem[];
18071
18082
 
18072
18083
  declare const yml: (options?: ConfigYmlOptions) => TypedConfigItem[];
@@ -18152,4 +18163,4 @@ declare const unusedImports: (options?: ConfigUnusedImportsOptions) => TypedConf
18152
18163
  */
18153
18164
  declare const DEFAULT_PRETTIER_OPTIONS: PrettierOptions;
18154
18165
 
18155
- export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigDependOptions, type ConfigEsXOptions, type ConfigFormatOptions, type ConfigGitHubActionOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportXOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigNtnyqOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPiniaOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigSVGOOptions, type ConfigSortOptions, type ConfigSpecialsOptions, 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, type ESLintRuleSeverity, type ESLintRulesRecord, 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_PACKAGE_JSON, GLOB_PINIA_STORE, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_TYPES, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type OptionsExtensions, type OptionsFeatures, type OptionsFiles, type OptionsOverrides, type PrettierOptions, type Pretty, type ResolvedOptions, type RuleOptions, type TSESLintParserOptions, type TypedConfigItem, antfu, command, comments, defineESLintConfig, depend, esX, format, getOverrides, githubAction, gitignore, hasPinia, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, importX, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, mergePrettierOptions, node, ntnyq, parserPlain, parserTypeScript, perfectionist, pinia, prettier, regexp, resolveSubOptions, sort, specials, stylistic, svgo, test, toArray, toml, typescript, unicorn, unocss, unusedImports, vitest, vue, yml };
18166
+ export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigDependOptions, type ConfigEsXOptions, type ConfigFormatOptions, type ConfigGitHubActionOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportXOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigNtnyqOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPiniaOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigSVGOOptions, type ConfigSortOptions, type ConfigSpecialsOptions, 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, type ESLintRuleSeverity, type ESLintRulesRecord, 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_PACKAGE_JSON, GLOB_PINIA_STORE, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_TYPES, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type OptionsExtensions, type OptionsFeatures, type OptionsFiles, type OptionsOverrides, type PrettierOptions, type Pretty, type ResolvedOptions, type RuleOptions, type TSESLintParserOptions, type TypedConfigItem, antfu, command, comments, createNodeResolver, defineESLintConfig, depend, esX, format, getOverrides, githubAction, gitignore, hasPinia, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, importX, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, mergePrettierOptions, node, ntnyq, parserPlain, parserTypeScript, perfectionist, pinia, prettier, regexp, resolveSubOptions, sort, specials, stylistic, svgo, test, toArray, toml, typescript, unicorn, unocss, unusedImports, vitest, vue, yml };
package/dist/index.js CHANGED
@@ -63,6 +63,10 @@ import { default as default24 } from "@eslint-community/eslint-plugin-eslint-com
63
63
  // src/eslint/configs.ts
64
64
  import { configs } from "typescript-eslint";
65
65
 
66
+ // src/eslint/resolvers.ts
67
+ import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
68
+ var createNodeResolver = default18.createNodeResolver;
69
+
66
70
  // src/eslint/processors.ts
67
71
  import { mergeProcessors } from "eslint-merge-processors";
68
72
  import { processorPassThrough } from "eslint-merge-processors";
@@ -92,6 +96,7 @@ var GLOB_JSON = "**/*.json";
92
96
  var GLOB_JSON5 = "**/*.json5";
93
97
  var GLOB_JSONC = "**/*.jsonc";
94
98
  var GLOB_PACKAGE_JSON = "**/package.json";
99
+ var GLOB_SVG = "**/*.svg";
95
100
  var GLOB_VUE = "**/*.vue";
96
101
  var GLOB_YAML = "**/*.y?(a)ml";
97
102
  var GLOB_TOML = "**/*.toml";
@@ -1694,38 +1699,46 @@ var ignores = (customIgnores = []) => [
1694
1699
  ];
1695
1700
 
1696
1701
  // src/configs/importX.ts
1697
- var { createNodeResolver } = default18;
1698
- var importX = (options = {}) => [
1699
- {
1700
- name: "ntnyq/import-x",
1701
- plugins: {
1702
- "import-x": default18
1703
- },
1704
- settings: {
1705
- "import-x/resolver-next": [
1706
- createNodeResolver({
1707
- extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts", ".json"]
1708
- })
1709
- ]
1710
- },
1711
- rules: {
1712
- "import-x/no-unresolved": "off",
1713
- "import-x/no-absolute-path": "off",
1714
- "import-x/no-named-as-default-member": "off",
1715
- "import-x/no-named-default": "off",
1716
- // disabled in favor or `perfectionist/sort-imports`
1717
- "import-x/order": "off",
1718
- "import-x/first": "error",
1719
- "import-x/export": "error",
1720
- "import-x/no-self-import": "error",
1721
- "import-x/no-duplicates": "error",
1722
- "import-x/no-mutable-exports": "error",
1723
- "import-x/newline-after-import": "error",
1724
- // Overrides rules
1725
- ...options.overrides
1702
+ var importX = (options = {}) => {
1703
+ const {
1704
+ typescript: enableTypeScript,
1705
+ // use typescript resolve if possible
1706
+ preferTypeScriptResolver = true
1707
+ } = options;
1708
+ return [
1709
+ {
1710
+ name: "ntnyq/import-x",
1711
+ plugins: {
1712
+ "import-x": default18
1713
+ },
1714
+ settings: {
1715
+ "import-x/resolver-next": [
1716
+ enableTypeScript && preferTypeScriptResolver ? createTypeScriptImportResolver({
1717
+ extensions: [".ts", ".tsx", ".d.ts", ".js", ".jsx", ".json", ".node"]
1718
+ }) : createNodeResolver({
1719
+ extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts", ".json"]
1720
+ })
1721
+ ]
1722
+ },
1723
+ rules: {
1724
+ "import-x/no-unresolved": "off",
1725
+ "import-x/no-absolute-path": "off",
1726
+ "import-x/no-named-as-default-member": "off",
1727
+ "import-x/no-named-default": "off",
1728
+ // disabled in favor or `perfectionist/sort-imports`
1729
+ "import-x/order": "off",
1730
+ "import-x/first": "error",
1731
+ "import-x/export": "error",
1732
+ "import-x/no-self-import": "error",
1733
+ "import-x/no-duplicates": "error",
1734
+ "import-x/no-mutable-exports": "error",
1735
+ "import-x/newline-after-import": "error",
1736
+ // Overrides rules
1737
+ ...options.overrides
1738
+ }
1726
1739
  }
1727
- }
1728
- ];
1740
+ ];
1741
+ };
1729
1742
 
1730
1743
  // src/configs/unicorn.ts
1731
1744
  var disabledRules2 = {
@@ -1975,7 +1988,7 @@ var markdown = (options = {}) => {
1975
1988
  // src/configs/prettier.ts
1976
1989
  var prettier = (options = {}) => {
1977
1990
  const {
1978
- disabledFiles = [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
1991
+ disabledFiles = [GLOB_SVG, GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
1979
1992
  // User defined disabled files
1980
1993
  userDisabledFiles = []
1981
1994
  } = options;
@@ -2920,6 +2933,8 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2920
2933
  ...resolveSubOptions(options, "command")
2921
2934
  }),
2922
2935
  ...importX({
2936
+ ...resolveSubOptions(options, "importX"),
2937
+ typescript: !!enableTypeScript,
2923
2938
  overrides: getOverrides(options, "importX")
2924
2939
  }),
2925
2940
  ...jsdoc({
@@ -3117,6 +3132,7 @@ export {
3117
3132
  GLOB_SRC_EXT,
3118
3133
  GLOB_STYLE,
3119
3134
  GLOB_SVELTE,
3135
+ GLOB_SVG,
3120
3136
  GLOB_TEST,
3121
3137
  GLOB_TOML,
3122
3138
  GLOB_TS,
@@ -3127,6 +3143,8 @@ export {
3127
3143
  antfu,
3128
3144
  command,
3129
3145
  comments,
3146
+ createNodeResolver,
3147
+ createTypeScriptImportResolver,
3130
3148
  defineESLintConfig,
3131
3149
  depend,
3132
3150
  esX,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "3.10.1",
4
+ "version": "3.10.2",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "An opinionated ESLint config preset of ntnyq",
7
7
  "keywords": [
@@ -63,6 +63,7 @@
63
63
  "@vitest/eslint-plugin": "^1.1.20",
64
64
  "eslint-config-flat-gitignore": "^0.3.0",
65
65
  "eslint-flat-config-utils": "^0.4.0",
66
+ "eslint-import-resolver-typescript": "^3.7.0",
66
67
  "eslint-merge-processors": "^0.1.0",
67
68
  "eslint-plugin-antfu": "^2.7.0",
68
69
  "eslint-plugin-command": "^0.2.7",