@ntnyq/eslint-config 3.9.4 → 3.10.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/README.md CHANGED
@@ -109,7 +109,7 @@ Check for detail in:
109
109
  ### Config interface
110
110
 
111
111
  ```ts
112
- export interface ConfigOptions extends ConfigOptionsInternal {
112
+ export interface ConfigOptions extends ConfigOptionsInternal, OptionsExtensions {
113
113
  command?: ConfigCommandOptions
114
114
  comments?: ConfigCommentsOptions
115
115
  ignores?: ConfigIgnoresOptions
@@ -123,6 +123,7 @@ export interface ConfigOptions extends ConfigOptionsInternal {
123
123
  * bellow can be disabled
124
124
  */
125
125
  antfu?: boolean | ConfigAntfuOptions
126
+ depend?: boolean | ConfigDependOptions
126
127
  githubAction?: boolean | ConfigGitHubActionOptions
127
128
  gitignore?: boolean | ConfigGitIgnoreOptions
128
129
  jsonc?: boolean | ConfigJsoncOptions
@@ -140,6 +141,11 @@ export interface ConfigOptions extends ConfigOptionsInternal {
140
141
  unocss?: boolean | ConfigUnoCSSOptions
141
142
  vue?: boolean | ConfigVueOptions
142
143
  yml?: boolean | ConfigYmlOptions
144
+
145
+ /**
146
+ * bellow need enable explicitly
147
+ */
148
+ svgo?: boolean | ConfigSVGOOptions
143
149
  }
144
150
  ```
145
151
 
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,
@@ -51,6 +51,7 @@ __export(src_exports, {
51
51
  GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
52
52
  GLOB_MARKDOWN_NESTED: () => GLOB_MARKDOWN_NESTED,
53
53
  GLOB_NODE_MODULES: () => GLOB_NODE_MODULES,
54
+ GLOB_PACKAGE_JSON: () => GLOB_PACKAGE_JSON,
54
55
  GLOB_PINIA_STORE: () => GLOB_PINIA_STORE,
55
56
  GLOB_POSTCSS: () => GLOB_POSTCSS,
56
57
  GLOB_SCSS: () => GLOB_SCSS,
@@ -69,6 +70,7 @@ __export(src_exports, {
69
70
  command: () => command,
70
71
  comments: () => comments,
71
72
  defineESLintConfig: () => defineESLintConfig,
73
+ depend: () => depend,
72
74
  esX: () => esX,
73
75
  format: () => format,
74
76
  getOverrides: () => getOverrides,
@@ -102,6 +104,7 @@ __export(src_exports, {
102
104
  pinia: () => pinia,
103
105
  pluginAntfu: () => import_eslint_plugin_antfu.default,
104
106
  pluginComments: () => import_eslint_plugin_eslint_comments.default,
107
+ pluginDepend: () => pluginDepend,
105
108
  pluginEsX: () => import_eslint_plugin_es_x.default,
106
109
  pluginFormat: () => import_eslint_plugin_format.default,
107
110
  pluginGitHubAction: () => import_eslint_plugin_github_action.default,
@@ -116,6 +119,7 @@ __export(src_exports, {
116
119
  pluginPrettier: () => import_eslint_plugin_prettier.default,
117
120
  pluginRegexp: () => pluginRegexp,
118
121
  pluginStylistic: () => import_eslint_plugin3.default,
122
+ pluginSvgo: () => import_eslint_plugin_svgo.default,
119
123
  pluginToml: () => import_eslint_plugin_toml.default,
120
124
  pluginTypeScript: () => import_typescript_eslint2.plugin,
121
125
  pluginUnicorn: () => import_eslint_plugin_unicorn.default,
@@ -132,6 +136,7 @@ __export(src_exports, {
132
136
  sort: () => sort,
133
137
  specials: () => specials,
134
138
  stylistic: () => stylistic,
139
+ svgo: () => svgo,
135
140
  test: () => test,
136
141
  toArray: () => toArray,
137
142
  toml: () => toml,
@@ -144,7 +149,7 @@ __export(src_exports, {
144
149
  vue: () => vue,
145
150
  yml: () => yml
146
151
  });
147
- module.exports = __toCommonJS(src_exports);
152
+ module.exports = __toCommonJS(index_exports);
148
153
 
149
154
  // src/core.ts
150
155
  var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
@@ -182,10 +187,12 @@ var parserPlain = {
182
187
 
183
188
  // src/eslint/plugins.ts
184
189
  var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
190
+ var pluginDepend = __toESM(require("eslint-plugin-depend"), 1);
185
191
  var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
186
192
  var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
187
193
  var import_eslint_plugin_es_x = __toESM(require("eslint-plugin-es-x"), 1);
188
194
  var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
195
+ var import_eslint_plugin_svgo = __toESM(require("eslint-plugin-svgo"), 1);
189
196
  var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
190
197
  var import_eslint_plugin_pinia = __toESM(require("eslint-plugin-pinia"), 1);
191
198
  var import_eslint_plugin_ntnyq = __toESM(require("eslint-plugin-ntnyq"), 1);
@@ -237,6 +244,7 @@ var GLOB_POSTCSS = "**/*.{p,post}css";
237
244
  var GLOB_JSON = "**/*.json";
238
245
  var GLOB_JSON5 = "**/*.json5";
239
246
  var GLOB_JSONC = "**/*.jsonc";
247
+ var GLOB_PACKAGE_JSON = "**/package.json";
240
248
  var GLOB_VUE = "**/*.vue";
241
249
  var GLOB_YAML = "**/*.y?(a)ml";
242
250
  var GLOB_TOML = "**/*.toml";
@@ -1132,6 +1140,15 @@ var vitest = (options = {}) => [
1132
1140
  }
1133
1141
  ];
1134
1142
 
1143
+ // src/configs/svgo.ts
1144
+ var import_eslint_plugin_svgo2 = require("eslint-plugin-svgo");
1145
+ var svgo = (options = {}) => [
1146
+ {
1147
+ ...(0, import_eslint_plugin_svgo2.config)(options),
1148
+ name: "ntnyq/svgo"
1149
+ }
1150
+ ];
1151
+
1135
1152
  // src/configs/antfu.ts
1136
1153
  var antfu = (options = {}) => [
1137
1154
  {
@@ -1478,6 +1495,47 @@ var ntnyq = (options = {}) => [
1478
1495
  }
1479
1496
  ];
1480
1497
 
1498
+ // src/configs/depend.ts
1499
+ var depend = (options = {}) => {
1500
+ const {
1501
+ files = [GLOB_SRC],
1502
+ // check package.json file
1503
+ packageJson: enableCheckPackageJson = true
1504
+ } = options;
1505
+ const configs2 = [
1506
+ {
1507
+ name: "ntnyq/depend",
1508
+ files,
1509
+ plugins: {
1510
+ depend: pluginDepend
1511
+ },
1512
+ rules: {
1513
+ "depend/ban-dependencies": "error",
1514
+ // Overrides rules
1515
+ ...options.overrides
1516
+ }
1517
+ }
1518
+ ];
1519
+ if (enableCheckPackageJson) {
1520
+ configs2.push({
1521
+ name: "ntnyq/depend/package-json",
1522
+ files: [GLOB_PACKAGE_JSON],
1523
+ plugins: {
1524
+ depend: pluginDepend
1525
+ },
1526
+ languageOptions: {
1527
+ parser: parserJsonc
1528
+ },
1529
+ rules: {
1530
+ "depend/ban-dependencies": "error",
1531
+ // Overrides rules
1532
+ ...options.overrides
1533
+ }
1534
+ });
1535
+ }
1536
+ return configs2;
1537
+ };
1538
+
1481
1539
  // src/configs/regexp.ts
1482
1540
  var regexp = (options = {}) => {
1483
1541
  const recommendedConfig = pluginRegexp.configs["flat/recommended"];
@@ -2749,14 +2807,17 @@ var perfectionist = (options = {}) => {
2749
2807
  type: "natural",
2750
2808
  ignoreCase: true,
2751
2809
  internalPattern: ["^~/.+", "^@/.+", "^#.+"],
2752
- newlinesBetween: "ignore"
2810
+ newlinesBetween: "ignore",
2811
+ partitionByComment: true
2753
2812
  }
2754
2813
  ],
2755
2814
  "perfectionist/sort-exports": [
2756
2815
  "error",
2757
2816
  {
2758
2817
  order: "asc",
2759
- type: "line-length"
2818
+ type: "line-length",
2819
+ groupKind: "values-first",
2820
+ partitionByComment: true
2760
2821
  }
2761
2822
  ],
2762
2823
  "perfectionist/sort-named-exports": [
@@ -2765,7 +2826,8 @@ var perfectionist = (options = {}) => {
2765
2826
  type: "alphabetical",
2766
2827
  order: "asc",
2767
2828
  ignoreCase: true,
2768
- groupKind: "values-first"
2829
+ groupKind: "values-first",
2830
+ partitionByComment: true
2769
2831
  }
2770
2832
  ],
2771
2833
  "perfectionist/sort-named-imports": [
@@ -2775,7 +2837,8 @@ var perfectionist = (options = {}) => {
2775
2837
  order: "asc",
2776
2838
  ignoreCase: true,
2777
2839
  ignoreAlias: false,
2778
- groupKind: "values-first"
2840
+ groupKind: "values-first",
2841
+ partitionByComment: true
2779
2842
  }
2780
2843
  ],
2781
2844
  // Overrides rules
@@ -2977,6 +3040,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2977
3040
  toml: enableTOML = true,
2978
3041
  jsonc: enableJSONC = true,
2979
3042
  antfu: enableAntfu = true,
3043
+ depend: enableDepend = true,
2980
3044
  regexp: enableRegexp = true,
2981
3045
  unicorn: enableUnicorn = true,
2982
3046
  prettier: enablePrettier = true,
@@ -2984,7 +3048,9 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2984
3048
  stylistic: enableStylistic = true,
2985
3049
  gitignore: enableGitIgnore = true,
2986
3050
  githubAction: enableGitHubAction = true,
2987
- perfectionist: enablePerfectionist = true
3051
+ perfectionist: enablePerfectionist = true,
3052
+ // disabled by default
3053
+ svgo: enableSVGO = false
2988
3054
  } = options;
2989
3055
  const configs2 = [];
2990
3056
  if (enableVue) {
@@ -3137,6 +3203,14 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3137
3203
  })
3138
3204
  );
3139
3205
  }
3206
+ if (enableDepend) {
3207
+ configs2.push(
3208
+ ...depend({
3209
+ ...resolveSubOptions(options, "depend"),
3210
+ overrides: getOverrides(options, "depend")
3211
+ })
3212
+ );
3213
+ }
3140
3214
  if (enableGitHubAction) {
3141
3215
  configs2.push(
3142
3216
  ...githubAction({
@@ -3144,6 +3218,13 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3144
3218
  })
3145
3219
  );
3146
3220
  }
3221
+ if (enableSVGO) {
3222
+ configs2.push(
3223
+ ...svgo({
3224
+ ...resolveSubOptions(options, "svgo")
3225
+ })
3226
+ );
3227
+ }
3147
3228
  const configSpecials = specials({
3148
3229
  ...resolveSubOptions(options, "specials")
3149
3230
  });
@@ -3182,6 +3263,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3182
3263
  GLOB_MARKDOWN_CODE,
3183
3264
  GLOB_MARKDOWN_NESTED,
3184
3265
  GLOB_NODE_MODULES,
3266
+ GLOB_PACKAGE_JSON,
3185
3267
  GLOB_PINIA_STORE,
3186
3268
  GLOB_POSTCSS,
3187
3269
  GLOB_SCSS,
@@ -3200,6 +3282,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3200
3282
  command,
3201
3283
  comments,
3202
3284
  defineESLintConfig,
3285
+ depend,
3203
3286
  esX,
3204
3287
  format,
3205
3288
  getOverrides,
@@ -3233,6 +3316,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3233
3316
  pinia,
3234
3317
  pluginAntfu,
3235
3318
  pluginComments,
3319
+ pluginDepend,
3236
3320
  pluginEsX,
3237
3321
  pluginFormat,
3238
3322
  pluginGitHubAction,
@@ -3247,6 +3331,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3247
3331
  pluginPrettier,
3248
3332
  pluginRegexp,
3249
3333
  pluginStylistic,
3334
+ pluginSvgo,
3250
3335
  pluginToml,
3251
3336
  pluginTypeScript,
3252
3337
  pluginUnicorn,
@@ -3263,6 +3348,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3263
3348
  sort,
3264
3349
  specials,
3265
3350
  stylistic,
3351
+ svgo,
3266
3352
  test,
3267
3353
  toArray,
3268
3354
  toml,