@ntnyq/eslint-config 3.10.0 → 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
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  DEFAULT_PRETTIER_OPTIONS: () => DEFAULT_PRETTIER_OPTIONS,
34
34
  GLOB_ALL_SRC: () => GLOB_ALL_SRC,
35
35
  GLOB_ASTRO: () => GLOB_ASTRO,
@@ -59,6 +59,7 @@ __export(src_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(src_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,
@@ -149,7 +152,7 @@ __export(src_exports, {
149
152
  vue: () => vue,
150
153
  yml: () => yml
151
154
  });
152
- module.exports = __toCommonJS(src_exports);
155
+ module.exports = __toCommonJS(index_exports);
153
156
 
154
157
  // src/core.ts
155
158
  var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
@@ -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";
@@ -1143,8 +1151,6 @@ var vitest = (options = {}) => [
1143
1151
  // src/configs/svgo.ts
1144
1152
  var import_eslint_plugin_svgo2 = require("eslint-plugin-svgo");
1145
1153
  var svgo = (options = {}) => [
1146
- // TODO: remove after fix type
1147
- // @ts-expect-error type
1148
1154
  {
1149
1155
  ...(0, import_eslint_plugin_svgo2.config)(options),
1150
1156
  name: "ntnyq/svgo"
@@ -1849,38 +1855,46 @@ var ignores = (customIgnores = []) => [
1849
1855
  ];
1850
1856
 
1851
1857
  // src/configs/importX.ts
1852
- var { createNodeResolver } = import_eslint_plugin_import_x.default;
1853
- var importX = (options = {}) => [
1854
- {
1855
- name: "ntnyq/import-x",
1856
- plugins: {
1857
- "import-x": import_eslint_plugin_import_x.default
1858
- },
1859
- settings: {
1860
- "import-x/resolver-next": [
1861
- createNodeResolver({
1862
- extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts", ".json"]
1863
- })
1864
- ]
1865
- },
1866
- rules: {
1867
- "import-x/no-unresolved": "off",
1868
- "import-x/no-absolute-path": "off",
1869
- "import-x/no-named-as-default-member": "off",
1870
- "import-x/no-named-default": "off",
1871
- // disabled in favor or `perfectionist/sort-imports`
1872
- "import-x/order": "off",
1873
- "import-x/first": "error",
1874
- "import-x/export": "error",
1875
- "import-x/no-self-import": "error",
1876
- "import-x/no-duplicates": "error",
1877
- "import-x/no-mutable-exports": "error",
1878
- "import-x/newline-after-import": "error",
1879
- // Overrides rules
1880
- ...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
+ }
1881
1895
  }
1882
- }
1883
- ];
1896
+ ];
1897
+ };
1884
1898
 
1885
1899
  // src/configs/unicorn.ts
1886
1900
  var disabledRules2 = {
@@ -2130,7 +2144,7 @@ var markdown = (options = {}) => {
2130
2144
  // src/configs/prettier.ts
2131
2145
  var prettier = (options = {}) => {
2132
2146
  const {
2133
- disabledFiles = [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
2147
+ disabledFiles = [GLOB_SVG, GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
2134
2148
  // User defined disabled files
2135
2149
  userDisabledFiles = []
2136
2150
  } = options;
@@ -3075,6 +3089,8 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3075
3089
  ...resolveSubOptions(options, "command")
3076
3090
  }),
3077
3091
  ...importX({
3092
+ ...resolveSubOptions(options, "importX"),
3093
+ typescript: !!enableTypeScript,
3078
3094
  overrides: getOverrides(options, "importX")
3079
3095
  }),
3080
3096
  ...jsdoc({
@@ -3273,6 +3289,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3273
3289
  GLOB_SRC_EXT,
3274
3290
  GLOB_STYLE,
3275
3291
  GLOB_SVELTE,
3292
+ GLOB_SVG,
3276
3293
  GLOB_TEST,
3277
3294
  GLOB_TOML,
3278
3295
  GLOB_TS,
@@ -3283,6 +3300,8 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3283
3300
  antfu,
3284
3301
  command,
3285
3302
  comments,
3303
+ createNodeResolver,
3304
+ createTypeScriptImportResolver,
3286
3305
  defineESLintConfig,
3287
3306
  depend,
3288
3307
  esX,