@ntnyq/eslint-config 3.9.4 → 3.10.0

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
@@ -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,
@@ -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,17 @@ 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
+ // TODO: remove after fix type
1147
+ // @ts-expect-error type
1148
+ {
1149
+ ...(0, import_eslint_plugin_svgo2.config)(options),
1150
+ name: "ntnyq/svgo"
1151
+ }
1152
+ ];
1153
+
1135
1154
  // src/configs/antfu.ts
1136
1155
  var antfu = (options = {}) => [
1137
1156
  {
@@ -1478,6 +1497,47 @@ var ntnyq = (options = {}) => [
1478
1497
  }
1479
1498
  ];
1480
1499
 
1500
+ // src/configs/depend.ts
1501
+ var depend = (options = {}) => {
1502
+ const {
1503
+ files = [GLOB_SRC],
1504
+ // check package.json file
1505
+ packageJson: enableCheckPackageJson = true
1506
+ } = options;
1507
+ const configs2 = [
1508
+ {
1509
+ name: "ntnyq/depend",
1510
+ files,
1511
+ plugins: {
1512
+ depend: pluginDepend
1513
+ },
1514
+ rules: {
1515
+ "depend/ban-dependencies": "error",
1516
+ // Overrides rules
1517
+ ...options.overrides
1518
+ }
1519
+ }
1520
+ ];
1521
+ if (enableCheckPackageJson) {
1522
+ configs2.push({
1523
+ name: "ntnyq/depend/package-json",
1524
+ files: [GLOB_PACKAGE_JSON],
1525
+ plugins: {
1526
+ depend: pluginDepend
1527
+ },
1528
+ languageOptions: {
1529
+ parser: parserJsonc
1530
+ },
1531
+ rules: {
1532
+ "depend/ban-dependencies": "error",
1533
+ // Overrides rules
1534
+ ...options.overrides
1535
+ }
1536
+ });
1537
+ }
1538
+ return configs2;
1539
+ };
1540
+
1481
1541
  // src/configs/regexp.ts
1482
1542
  var regexp = (options = {}) => {
1483
1543
  const recommendedConfig = pluginRegexp.configs["flat/recommended"];
@@ -2749,14 +2809,17 @@ var perfectionist = (options = {}) => {
2749
2809
  type: "natural",
2750
2810
  ignoreCase: true,
2751
2811
  internalPattern: ["^~/.+", "^@/.+", "^#.+"],
2752
- newlinesBetween: "ignore"
2812
+ newlinesBetween: "ignore",
2813
+ partitionByComment: true
2753
2814
  }
2754
2815
  ],
2755
2816
  "perfectionist/sort-exports": [
2756
2817
  "error",
2757
2818
  {
2758
2819
  order: "asc",
2759
- type: "line-length"
2820
+ type: "line-length",
2821
+ groupKind: "values-first",
2822
+ partitionByComment: true
2760
2823
  }
2761
2824
  ],
2762
2825
  "perfectionist/sort-named-exports": [
@@ -2765,7 +2828,8 @@ var perfectionist = (options = {}) => {
2765
2828
  type: "alphabetical",
2766
2829
  order: "asc",
2767
2830
  ignoreCase: true,
2768
- groupKind: "values-first"
2831
+ groupKind: "values-first",
2832
+ partitionByComment: true
2769
2833
  }
2770
2834
  ],
2771
2835
  "perfectionist/sort-named-imports": [
@@ -2775,7 +2839,8 @@ var perfectionist = (options = {}) => {
2775
2839
  order: "asc",
2776
2840
  ignoreCase: true,
2777
2841
  ignoreAlias: false,
2778
- groupKind: "values-first"
2842
+ groupKind: "values-first",
2843
+ partitionByComment: true
2779
2844
  }
2780
2845
  ],
2781
2846
  // Overrides rules
@@ -2977,6 +3042,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2977
3042
  toml: enableTOML = true,
2978
3043
  jsonc: enableJSONC = true,
2979
3044
  antfu: enableAntfu = true,
3045
+ depend: enableDepend = true,
2980
3046
  regexp: enableRegexp = true,
2981
3047
  unicorn: enableUnicorn = true,
2982
3048
  prettier: enablePrettier = true,
@@ -2984,7 +3050,9 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2984
3050
  stylistic: enableStylistic = true,
2985
3051
  gitignore: enableGitIgnore = true,
2986
3052
  githubAction: enableGitHubAction = true,
2987
- perfectionist: enablePerfectionist = true
3053
+ perfectionist: enablePerfectionist = true,
3054
+ // disabled by default
3055
+ svgo: enableSVGO = false
2988
3056
  } = options;
2989
3057
  const configs2 = [];
2990
3058
  if (enableVue) {
@@ -3137,6 +3205,14 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3137
3205
  })
3138
3206
  );
3139
3207
  }
3208
+ if (enableDepend) {
3209
+ configs2.push(
3210
+ ...depend({
3211
+ ...resolveSubOptions(options, "depend"),
3212
+ overrides: getOverrides(options, "depend")
3213
+ })
3214
+ );
3215
+ }
3140
3216
  if (enableGitHubAction) {
3141
3217
  configs2.push(
3142
3218
  ...githubAction({
@@ -3144,6 +3220,13 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3144
3220
  })
3145
3221
  );
3146
3222
  }
3223
+ if (enableSVGO) {
3224
+ configs2.push(
3225
+ ...svgo({
3226
+ ...resolveSubOptions(options, "svgo")
3227
+ })
3228
+ );
3229
+ }
3147
3230
  const configSpecials = specials({
3148
3231
  ...resolveSubOptions(options, "specials")
3149
3232
  });
@@ -3182,6 +3265,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3182
3265
  GLOB_MARKDOWN_CODE,
3183
3266
  GLOB_MARKDOWN_NESTED,
3184
3267
  GLOB_NODE_MODULES,
3268
+ GLOB_PACKAGE_JSON,
3185
3269
  GLOB_PINIA_STORE,
3186
3270
  GLOB_POSTCSS,
3187
3271
  GLOB_SCSS,
@@ -3200,6 +3284,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3200
3284
  command,
3201
3285
  comments,
3202
3286
  defineESLintConfig,
3287
+ depend,
3203
3288
  esX,
3204
3289
  format,
3205
3290
  getOverrides,
@@ -3233,6 +3318,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3233
3318
  pinia,
3234
3319
  pluginAntfu,
3235
3320
  pluginComments,
3321
+ pluginDepend,
3236
3322
  pluginEsX,
3237
3323
  pluginFormat,
3238
3324
  pluginGitHubAction,
@@ -3247,6 +3333,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3247
3333
  pluginPrettier,
3248
3334
  pluginRegexp,
3249
3335
  pluginStylistic,
3336
+ pluginSvgo,
3250
3337
  pluginToml,
3251
3338
  pluginTypeScript,
3252
3339
  pluginUnicorn,
@@ -3263,6 +3350,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3263
3350
  sort,
3264
3351
  specials,
3265
3352
  stylistic,
3353
+ svgo,
3266
3354
  test,
3267
3355
  toArray,
3268
3356
  toml,