@vinicunca/eslint-config 2.0.0-beta.7 → 2.0.0-beta.9

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
@@ -160,6 +160,55 @@ function _uniq(array) {
160
160
  uniq2.lazy = lazy;
161
161
  })(uniq || (uniq = {}));
162
162
 
163
+ // src/flags.ts
164
+ var ERROR = "error";
165
+ var OFF = "off";
166
+ var WARN = "warn";
167
+ var CONSISTENT = "consistent";
168
+ var NEVER = "never";
169
+ var ALWAYS = "always";
170
+
171
+ // src/plugins.ts
172
+ var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
173
+ var import_eslint_plugin_vinicunca = __toESM(require("@vinicunca/eslint-plugin-vinicunca"), 1);
174
+ var import_eslint_plugin2 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
175
+ var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
176
+ var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
177
+ var pluginImport = __toESM(require("eslint-plugin-i"), 1);
178
+ var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
179
+ var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
180
+ var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
181
+ var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
182
+ var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
183
+ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
184
+ var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
185
+ var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
186
+ var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
187
+ var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
188
+ var pluginYaml = __toESM(require("eslint-plugin-yml"), 1);
189
+ var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
190
+ var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
191
+ var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
192
+ var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
193
+
194
+ // src/configs/comments.ts
195
+ function comments() {
196
+ return [
197
+ {
198
+ name: "vinicunca:eslint-comments",
199
+ plugins: {
200
+ "eslint-comments": import_eslint_plugin_eslint_comments.default
201
+ },
202
+ rules: {
203
+ "eslint-comments/no-aggregating-enable": ERROR,
204
+ "eslint-comments/no-duplicate-disable": ERROR,
205
+ "eslint-comments/no-unlimited-disable": ERROR,
206
+ "eslint-comments/no-unused-enable": ERROR
207
+ }
208
+ }
209
+ ];
210
+ }
211
+
163
212
  // src/configs/ignores.ts
164
213
  var import_node_fs = __toESM(require("fs"), 1);
165
214
  var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
@@ -180,6 +229,7 @@ var GLOB_EXCLUDE = [
180
229
  "**/temp",
181
230
  "**/.vitepress/cache",
182
231
  "**/.nuxt",
232
+ "**/.next",
183
233
  "**/.vercel",
184
234
  "**/.changeset",
185
235
  "**/.idea",
@@ -239,77 +289,11 @@ function ignores({
239
289
  }
240
290
  return [
241
291
  {
242
- name: "vinicunca:ignores",
243
292
  ignores: uniq(ignoreList)
244
293
  }
245
294
  ];
246
295
  }
247
296
 
248
- // src/utils.ts
249
- function combineConfigs(...configs) {
250
- return configs.flatMap((config) => Array.isArray(config) ? config : [config]);
251
- }
252
- function renameRules(rules, from, to) {
253
- return Object.fromEntries(
254
- Object.entries(rules).map(([key, value]) => {
255
- if (key.startsWith(from)) {
256
- return [to + key.slice(from.length), value];
257
- }
258
- ;
259
- return [key, value];
260
- })
261
- );
262
- }
263
-
264
- // src/flags.ts
265
- var ERROR = "error";
266
- var OFF = "off";
267
- var WARN = "warn";
268
- var CONSISTENT = "consistent";
269
- var NEVER = "never";
270
- var ALWAYS = "always";
271
-
272
- // src/plugins.ts
273
- var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
274
- var import_eslint_plugin_vinicunca = __toESM(require("@vinicunca/eslint-plugin-vinicunca"), 1);
275
- var import_eslint_plugin2 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
276
- var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
277
- var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
278
- var pluginImport = __toESM(require("eslint-plugin-i"), 1);
279
- var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
280
- var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
281
- var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
282
- var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
283
- var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
284
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
285
- var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
286
- var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
287
- var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
288
- var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
289
- var pluginYaml = __toESM(require("eslint-plugin-yml"), 1);
290
- var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
291
- var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
292
- var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
293
- var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
294
-
295
- // src/configs/comments.ts
296
- function comments() {
297
- return [
298
- {
299
- name: "vinicunca:eslint-comments",
300
- plugins: {
301
- "eslint-comments": import_eslint_plugin_eslint_comments.default
302
- },
303
- rules: {
304
- "eslint-comments/no-aggregating-enable": ERROR,
305
- "eslint-comments/no-duplicate-disable": ERROR,
306
- "eslint-comments/no-unlimited-disable": ERROR,
307
- "eslint-comments/no-unused-enable": ERROR
308
- }
309
- }
310
- ];
311
- }
312
-
313
297
  // src/configs/imports.ts
314
298
  function imports() {
315
299
  return [
@@ -365,6 +349,9 @@ function javascript(options = {}) {
365
349
  },
366
350
  sourceType: "module"
367
351
  },
352
+ linterOptions: {
353
+ reportUnusedDisableDirectives: true
354
+ },
368
355
  plugins: {
369
356
  "vinicunca": import_eslint_plugin_vinicunca.default,
370
357
  "unused-imports": import_eslint_plugin_unused_imports.default
@@ -496,7 +483,9 @@ function javascript(options = {}) {
496
483
  "DebuggerStatement",
497
484
  "ForInStatement",
498
485
  "LabeledStatement",
499
- "WithStatement"
486
+ "WithStatement",
487
+ "TSEnumDeclaration[const=true]",
488
+ "TSExportAssignment"
500
489
  ],
501
490
  "no-return-assign": [ERROR, ALWAYS],
502
491
  "no-self-assign": [ERROR, {
@@ -1141,20 +1130,42 @@ function stylistic() {
1141
1130
  "style/eol-last": ERROR,
1142
1131
  "style/func-call-spacing": [ERROR, NEVER],
1143
1132
  "style/indent": [ERROR, 2, {
1144
- SwitchCase: 1,
1145
- VariableDeclarator: 1,
1146
- outerIIFEBody: 1,
1147
- MemberExpression: 1,
1148
- FunctionDeclaration: { parameters: 1, body: 1 },
1149
- FunctionExpression: { parameters: 1, body: 1 },
1150
- CallExpression: { arguments: 1 },
1151
1133
  ArrayExpression: 1,
1152
- ObjectExpression: 1,
1134
+ CallExpression: { arguments: 1 },
1135
+ FunctionDeclaration: { body: 1, parameters: 1 },
1136
+ FunctionExpression: { body: 1, parameters: 1 },
1153
1137
  ImportDeclaration: 1,
1138
+ MemberExpression: 1,
1139
+ ObjectExpression: 1,
1140
+ SwitchCase: 1,
1141
+ VariableDeclarator: 1,
1154
1142
  flatTernaryExpressions: false,
1155
1143
  ignoreComments: false,
1156
- ignoredNodes: ["TemplateLiteral *", "JSXElement", "JSXElement > *", "JSXAttribute", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", "JSXSpreadAttribute", "JSXExpressionContainer", "JSXOpeningElement", "JSXClosingElement", "JSXFragment", "JSXOpeningFragment", "JSXClosingFragment", "JSXText", "JSXEmptyExpression", "JSXSpreadChild"],
1157
- offsetTernaryExpressions: true
1144
+ ignoredNodes: [
1145
+ "TemplateLiteral *",
1146
+ "JSXElement",
1147
+ "JSXElement > *",
1148
+ "JSXAttribute",
1149
+ "JSXIdentifier",
1150
+ "JSXNamespacedName",
1151
+ "JSXMemberExpression",
1152
+ "JSXSpreadAttribute",
1153
+ "JSXExpressionContainer",
1154
+ "JSXOpeningElement",
1155
+ "JSXClosingElement",
1156
+ "JSXFragment",
1157
+ "JSXOpeningFragment",
1158
+ "JSXClosingFragment",
1159
+ "JSXText",
1160
+ "JSXEmptyExpression",
1161
+ "JSXSpreadChild",
1162
+ "TSTypeParameterInstantiation",
1163
+ "FunctionExpression > .params[decorators.length > 0]",
1164
+ "FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
1165
+ "ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
1166
+ ],
1167
+ offsetTernaryExpressions: true,
1168
+ outerIIFEBody: 1
1158
1169
  }],
1159
1170
  "style/key-spacing": [ERROR, { beforeColon: false, afterColon: true }],
1160
1171
  "style/keyword-spacing": [ERROR, { before: true, after: true }],
@@ -1262,6 +1273,24 @@ function test(options = {}) {
1262
1273
 
1263
1274
  // src/configs/typescript.ts
1264
1275
  var import_node_process = __toESM(require("process"), 1);
1276
+
1277
+ // src/utils.ts
1278
+ function combineConfigs(...configs) {
1279
+ return configs.flatMap((config) => Array.isArray(config) ? config : [config]);
1280
+ }
1281
+ function renameRules(rules, from, to) {
1282
+ return Object.fromEntries(
1283
+ Object.entries(rules).map(([key, value]) => {
1284
+ if (key.startsWith(from)) {
1285
+ return [to + key.slice(from.length), value];
1286
+ }
1287
+ ;
1288
+ return [key, value];
1289
+ })
1290
+ );
1291
+ }
1292
+
1293
+ // src/configs/typescript.ts
1265
1294
  function typescript(options) {
1266
1295
  const {
1267
1296
  componentExts = [],
@@ -1350,6 +1379,7 @@ function typescript(options) {
1350
1379
  "ts/no-empty-function": OFF,
1351
1380
  "ts/no-empty-interface": OFF,
1352
1381
  "ts/no-explicit-any": OFF,
1382
+ "ts/no-import-type-side-effects": ERROR,
1353
1383
  "ts/no-invalid-void-type": OFF,
1354
1384
  "ts/no-non-null-assertion": OFF,
1355
1385
  "ts/no-require-imports": ERROR,
@@ -1365,9 +1395,7 @@ function typescript(options) {
1365
1395
  "vinicunca/generic-spacing": ERROR,
1366
1396
  "vinicunca/named-tuple-spacing": ERROR,
1367
1397
  "vinicunca/no-cjs-exports": ERROR,
1368
- "vinicunca/no-const-enum": ERROR,
1369
1398
  "vinicunca/no-ts-export-equal": ERROR,
1370
- "vinicunca/prefer-inline-type-import": ERROR,
1371
1399
  ...tsconfigPath ? typeAwareRules : {},
1372
1400
  ...overrides
1373
1401
  }
@@ -1620,7 +1648,6 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
1620
1648
  } = options;
1621
1649
  const configs = [];
1622
1650
  configs.push(
1623
- ignores(options.ignores),
1624
1651
  javascript({
1625
1652
  isInEditor,
1626
1653
  overrides: overrides.javascript
@@ -1685,6 +1712,7 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
1685
1712
  overrides: overrides.react
1686
1713
  }));
1687
1714
  }
1715
+ configs.push(ignores(options.ignores));
1688
1716
  return combineConfigs(
1689
1717
  ...configs,
1690
1718
  ...userConfigs
package/dist/index.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- import * as eslint_define_config from 'eslint-define-config';
2
- import { FlatESLintConfigItem as FlatESLintConfigItem$1 } from 'eslint-define-config';
1
+ import { MergeIntersection, EslintRules, Unprefix, ReactRules, TypeScriptRules, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ImportRules, JsoncRules, VueRules, UnicornRules, EslintCommentsRules, RuleConfig, FlatESLintConfigItem } from '@antfu/eslint-define-config';
3
2
  import { ParserOptions } from '@typescript-eslint/parser';
4
3
  import * as parser from '@typescript-eslint/parser';
5
4
  export { parser as parserTs };
6
- export { default as pluginStylistic } from '@stylistic/eslint-plugin';
5
+ import { Rules as Rules$1 } from '@vinicunca/eslint-plugin-vinicunca';
7
6
  export { default as pluginVinicunca } from '@vinicunca/eslint-plugin-vinicunca';
7
+ export { default as pluginStylistic } from '@stylistic/eslint-plugin';
8
8
  export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
9
9
  export { default as pluginComments } from 'eslint-plugin-eslint-comments';
10
10
  import * as eslintPluginI from 'eslint-plugin-i';
@@ -27,12 +27,24 @@ export { default as parserJsonc } from 'jsonc-eslint-parser';
27
27
  export { default as parserVue } from 'vue-eslint-parser';
28
28
  export { default as parserYaml } from 'yaml-eslint-parser';
29
29
 
30
- interface FlatESLintConfigItem extends FlatESLintConfigItem$1 {
30
+ type MergedRules = MergeIntersection<EslintRules & Unprefix<ReactRules, 'react/'> & Unprefix<TypeScriptRules, '@typescript-eslint/'>>;
31
+ type StylisticRules = Pick<MergedRules, 'array-bracket-newline' | 'array-bracket-spacing' | 'array-element-newline' | 'arrow-spacing' | 'block-spacing' | 'brace-style' | 'comma-dangle' | 'comma-spacing' | 'comma-style' | 'computed-property-spacing' | 'dot-location' | 'eol-last' | 'func-call-spacing' | 'function-call-argument-newline' | 'function-paren-newline' | 'generator-star-spacing' | 'implicit-arrow-linebreak' | 'indent' | 'jsx-quotes' | 'key-spacing' | 'keyword-spacing' | 'linebreak-style' | 'lines-around-comment' | 'lines-around-directive' | 'lines-between-class-members' | 'max-len' | 'max-statements-per-line' | 'multiline-ternary' | 'new-parens' | 'newline-after-var' | 'newline-before-return' | 'newline-per-chained-call' | 'no-confusing-arrow' | 'no-extra-parens' | 'no-extra-semi' | 'no-floating-decimal' | 'no-mixed-operators' | 'no-mixed-spaces-and-tabs' | 'no-multi-spaces' | 'no-multiple-empty-lines' | 'no-spaced-func' | 'no-tabs' | 'no-trailing-spaces' | 'no-whitespace-before-property' | 'nonblock-statement-body-position' | 'object-curly-newline' | 'object-curly-spacing' | 'object-property-newline' | 'one-var-declaration-per-line' | 'operator-linebreak' | 'padded-blocks' | 'padding-line-between-statements' | 'quote-props' | 'quotes' | 'rest-spread-spacing' | 'semi' | 'semi-spacing' | 'semi-style' | 'space-before-blocks' | 'space-before-function-paren' | 'space-in-parens' | 'space-infix-ops' | 'space-unary-ops' | 'spaced-comment' | 'switch-colon-spacing' | 'template-curly-spacing' | 'template-tag-spacing' | 'wrap-iife' | 'wrap-regex' | 'yield-star-spacing' | 'jsx-child-element-spacing' | 'jsx-closing-bracket-location' | 'jsx-closing-tag-location' | 'jsx-curly-brace-presence' | 'jsx-curly-newline' | 'jsx-curly-spacing' | 'jsx-equals-spacing' | 'jsx-first-prop-new-line' | 'jsx-indent' | 'jsx-indent-props' | 'jsx-max-props-per-line' | 'jsx-newline' | 'jsx-one-expression-per-line' | 'jsx-props-no-multi-spaces' | 'jsx-sort-props' | 'jsx-space-before-closing' | 'jsx-tag-spacing' | 'jsx-wrap-multilines' | 'block-spacing' | 'brace-style' | 'comma-dangle' | 'comma-spacing' | 'func-call-spacing' | 'indent' | 'key-spacing' | 'keyword-spacing' | 'lines-around-comment' | 'lines-between-class-members' | 'member-delimiter-style' | 'object-curly-spacing' | 'padding-line-between-statements' | 'quotes' | 'semi' | 'space-before-blocks' | 'space-before-function-paren' | 'space-infix-ops' | 'type-annotation-spacing'>;
32
+
33
+ type Rules = MergeIntersection<RenamePrefix<TypeScriptRules, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<StylisticRules, 'style/'> & Prefix<Rules$1, 'vinicunca/'> & ImportRules & EslintRules & JsoncRules & VueRules & UnicornRules & EslintCommentsRules & {
34
+ 'test/no-only-tests': RuleConfig<[]>;
35
+ }>;
36
+ type ConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
31
37
  /**
32
38
  * The name of the configuration object.
33
39
  */
34
40
  name?: string;
35
- }
41
+ /**
42
+ * An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
43
+ *
44
+ * @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
45
+ */
46
+ plugins?: Record<string, any>;
47
+ };
36
48
  interface OptionsConfig extends OptionsComponentExts {
37
49
  /**
38
50
  * Additional options for the ignore rules.
@@ -46,6 +58,14 @@ interface OptionsConfig extends OptionsComponentExts {
46
58
  * @default auto-detect based on the dependencies
47
59
  */
48
60
  typescript?: boolean | OptionsTypeScriptWithTypes;
61
+ /**
62
+ * Enable JSX related rules.
63
+ *
64
+ * Currently only stylistic rules are included.
65
+ *
66
+ * @default true
67
+ */
68
+ jsx?: boolean;
49
69
  /**
50
70
  * Enable test support.
51
71
  *
@@ -104,18 +124,18 @@ interface OptionsConfig extends OptionsComponentExts {
104
124
  * Provide overrides for rules for each integration.
105
125
  */
106
126
  overrides?: {
107
- javascript?: FlatESLintConfigItem['rules'];
108
- typescript?: FlatESLintConfigItem['rules'];
109
- test?: FlatESLintConfigItem['rules'];
110
- vue?: FlatESLintConfigItem['rules'];
111
- jsonc?: FlatESLintConfigItem['rules'];
112
- markdown?: FlatESLintConfigItem['rules'];
113
- yaml?: FlatESLintConfigItem['rules'];
114
- react?: FlatESLintConfigItem['rules'];
127
+ javascript?: ConfigItem['rules'];
128
+ typescript?: ConfigItem['rules'];
129
+ test?: ConfigItem['rules'];
130
+ vue?: ConfigItem['rules'];
131
+ jsonc?: ConfigItem['rules'];
132
+ markdown?: ConfigItem['rules'];
133
+ yaml?: ConfigItem['rules'];
134
+ react?: ConfigItem['rules'];
115
135
  };
116
136
  }
117
137
  interface OptionsOverrides {
118
- overrides?: FlatESLintConfigItem['rules'];
138
+ overrides?: ConfigItem['rules'];
119
139
  }
120
140
  interface OptionsIsInEditor {
121
141
  isInEditor?: boolean;
@@ -152,57 +172,57 @@ interface OptionsHasTypeScript {
152
172
  }
153
173
 
154
174
  declare function vinicuncaESLint({ options, userConfigs }?: {
155
- options?: OptionsConfig;
156
- userConfigs?: (FlatESLintConfigItem | FlatESLintConfigItem[])[];
157
- }): eslint_define_config.FlatESLintConfigItem[];
175
+ options?: OptionsConfig & ConfigItem;
176
+ userConfigs?: (ConfigItem | ConfigItem[])[];
177
+ }): ConfigItem[];
158
178
 
159
- declare function comments(): FlatESLintConfigItem[];
179
+ declare function comments(): ConfigItem[];
160
180
 
161
- declare function ignores({ enableGitignore, items, replace, }?: OptionsIgnores): FlatESLintConfigItem[];
181
+ declare function ignores({ enableGitignore, items, replace, }?: OptionsIgnores): ConfigItem[];
162
182
 
163
- declare function imports(): FlatESLintConfigItem[];
183
+ declare function imports(): ConfigItem[];
164
184
 
165
- declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
185
+ declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
166
186
 
167
- declare function jsdoc(): FlatESLintConfigItem[];
187
+ declare function jsdoc(): ConfigItem[];
168
188
 
169
- declare function jsonc(options?: OptionsOverrides): FlatESLintConfigItem[];
189
+ declare function jsonc(options?: OptionsOverrides): ConfigItem[];
170
190
 
171
- declare function markdown(options?: OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
191
+ declare function markdown(options?: OptionsComponentExts & OptionsOverrides): ConfigItem[];
172
192
 
173
- declare function node(): FlatESLintConfigItem[];
193
+ declare function node(): ConfigItem[];
174
194
 
175
- declare function react(options?: OptionsOverrides): FlatESLintConfigItem[];
195
+ declare function react(options?: OptionsOverrides): ConfigItem[];
176
196
 
177
197
  /**
178
198
  * Sort package.json
179
199
  *
180
200
  * Requires `jsonc` config
181
201
  */
182
- declare function sortPackageJson(): FlatESLintConfigItem[];
202
+ declare function sortPackageJson(): ConfigItem[];
183
203
  /**
184
204
  * Sort tsconfig.json
185
205
  *
186
206
  * Requires `jsonc` config
187
207
  */
188
- declare function sortTsconfig(): FlatESLintConfigItem[];
208
+ declare function sortTsconfig(): ConfigItem[];
189
209
 
190
- declare function stylistic(): FlatESLintConfigItem[];
210
+ declare function stylistic(): ConfigItem[];
191
211
 
192
- declare function test(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
212
+ declare function test(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
193
213
 
194
- declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): FlatESLintConfigItem[];
214
+ declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): ConfigItem[];
195
215
 
196
- declare function unicorn(options?: OptionsOverrides): FlatESLintConfigItem[];
216
+ declare function unicorn(options?: OptionsOverrides): ConfigItem[];
197
217
 
198
- declare function vue(options?: OptionsHasTypeScript & OptionsOverrides): FlatESLintConfigItem[];
218
+ declare function vue(options?: OptionsHasTypeScript & OptionsOverrides): ConfigItem[];
199
219
 
200
- declare function yaml(options?: OptionsOverrides): FlatESLintConfigItem[];
220
+ declare function yaml(options?: OptionsOverrides): ConfigItem[];
201
221
 
202
222
  /**
203
223
  * Combine array and non-array configs into a single array.
204
224
  */
205
- declare function combineConfigs(...configs: (FlatESLintConfigItem$1 | FlatESLintConfigItem$1[])[]): FlatESLintConfigItem$1[];
225
+ declare function combineConfigs(...configs: (ConfigItem | ConfigItem[])[]): ConfigItem[];
206
226
  declare function renameRules(rules: Record<string, any>, from: string, to: string): {
207
227
  [k: string]: any;
208
228
  };
@@ -223,4 +243,4 @@ declare const GLOB_YAML = "**/*.y?(a)ml";
223
243
  declare const GLOB_MARKDOWN = "**/*.md";
224
244
  declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
225
245
 
226
- export { FlatESLintConfigItem, GLOB_EXCLUDE, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, combineConfigs, comments, vinicuncaESLint as default, ignores, imports, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vinicuncaESLint, vue, yaml };
246
+ export { ConfigItem, GLOB_EXCLUDE, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, combineConfigs, comments, vinicuncaESLint as default, ignores, imports, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vinicuncaESLint, vue, yaml };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import * as eslint_define_config from 'eslint-define-config';
2
- import { FlatESLintConfigItem as FlatESLintConfigItem$1 } from 'eslint-define-config';
1
+ import { MergeIntersection, EslintRules, Unprefix, ReactRules, TypeScriptRules, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ImportRules, JsoncRules, VueRules, UnicornRules, EslintCommentsRules, RuleConfig, FlatESLintConfigItem } from '@antfu/eslint-define-config';
3
2
  import { ParserOptions } from '@typescript-eslint/parser';
4
3
  import * as parser from '@typescript-eslint/parser';
5
4
  export { parser as parserTs };
6
- export { default as pluginStylistic } from '@stylistic/eslint-plugin';
5
+ import { Rules as Rules$1 } from '@vinicunca/eslint-plugin-vinicunca';
7
6
  export { default as pluginVinicunca } from '@vinicunca/eslint-plugin-vinicunca';
7
+ export { default as pluginStylistic } from '@stylistic/eslint-plugin';
8
8
  export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
9
9
  export { default as pluginComments } from 'eslint-plugin-eslint-comments';
10
10
  import * as eslintPluginI from 'eslint-plugin-i';
@@ -27,12 +27,24 @@ export { default as parserJsonc } from 'jsonc-eslint-parser';
27
27
  export { default as parserVue } from 'vue-eslint-parser';
28
28
  export { default as parserYaml } from 'yaml-eslint-parser';
29
29
 
30
- interface FlatESLintConfigItem extends FlatESLintConfigItem$1 {
30
+ type MergedRules = MergeIntersection<EslintRules & Unprefix<ReactRules, 'react/'> & Unprefix<TypeScriptRules, '@typescript-eslint/'>>;
31
+ type StylisticRules = Pick<MergedRules, 'array-bracket-newline' | 'array-bracket-spacing' | 'array-element-newline' | 'arrow-spacing' | 'block-spacing' | 'brace-style' | 'comma-dangle' | 'comma-spacing' | 'comma-style' | 'computed-property-spacing' | 'dot-location' | 'eol-last' | 'func-call-spacing' | 'function-call-argument-newline' | 'function-paren-newline' | 'generator-star-spacing' | 'implicit-arrow-linebreak' | 'indent' | 'jsx-quotes' | 'key-spacing' | 'keyword-spacing' | 'linebreak-style' | 'lines-around-comment' | 'lines-around-directive' | 'lines-between-class-members' | 'max-len' | 'max-statements-per-line' | 'multiline-ternary' | 'new-parens' | 'newline-after-var' | 'newline-before-return' | 'newline-per-chained-call' | 'no-confusing-arrow' | 'no-extra-parens' | 'no-extra-semi' | 'no-floating-decimal' | 'no-mixed-operators' | 'no-mixed-spaces-and-tabs' | 'no-multi-spaces' | 'no-multiple-empty-lines' | 'no-spaced-func' | 'no-tabs' | 'no-trailing-spaces' | 'no-whitespace-before-property' | 'nonblock-statement-body-position' | 'object-curly-newline' | 'object-curly-spacing' | 'object-property-newline' | 'one-var-declaration-per-line' | 'operator-linebreak' | 'padded-blocks' | 'padding-line-between-statements' | 'quote-props' | 'quotes' | 'rest-spread-spacing' | 'semi' | 'semi-spacing' | 'semi-style' | 'space-before-blocks' | 'space-before-function-paren' | 'space-in-parens' | 'space-infix-ops' | 'space-unary-ops' | 'spaced-comment' | 'switch-colon-spacing' | 'template-curly-spacing' | 'template-tag-spacing' | 'wrap-iife' | 'wrap-regex' | 'yield-star-spacing' | 'jsx-child-element-spacing' | 'jsx-closing-bracket-location' | 'jsx-closing-tag-location' | 'jsx-curly-brace-presence' | 'jsx-curly-newline' | 'jsx-curly-spacing' | 'jsx-equals-spacing' | 'jsx-first-prop-new-line' | 'jsx-indent' | 'jsx-indent-props' | 'jsx-max-props-per-line' | 'jsx-newline' | 'jsx-one-expression-per-line' | 'jsx-props-no-multi-spaces' | 'jsx-sort-props' | 'jsx-space-before-closing' | 'jsx-tag-spacing' | 'jsx-wrap-multilines' | 'block-spacing' | 'brace-style' | 'comma-dangle' | 'comma-spacing' | 'func-call-spacing' | 'indent' | 'key-spacing' | 'keyword-spacing' | 'lines-around-comment' | 'lines-between-class-members' | 'member-delimiter-style' | 'object-curly-spacing' | 'padding-line-between-statements' | 'quotes' | 'semi' | 'space-before-blocks' | 'space-before-function-paren' | 'space-infix-ops' | 'type-annotation-spacing'>;
32
+
33
+ type Rules = MergeIntersection<RenamePrefix<TypeScriptRules, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<StylisticRules, 'style/'> & Prefix<Rules$1, 'vinicunca/'> & ImportRules & EslintRules & JsoncRules & VueRules & UnicornRules & EslintCommentsRules & {
34
+ 'test/no-only-tests': RuleConfig<[]>;
35
+ }>;
36
+ type ConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
31
37
  /**
32
38
  * The name of the configuration object.
33
39
  */
34
40
  name?: string;
35
- }
41
+ /**
42
+ * An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
43
+ *
44
+ * @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
45
+ */
46
+ plugins?: Record<string, any>;
47
+ };
36
48
  interface OptionsConfig extends OptionsComponentExts {
37
49
  /**
38
50
  * Additional options for the ignore rules.
@@ -46,6 +58,14 @@ interface OptionsConfig extends OptionsComponentExts {
46
58
  * @default auto-detect based on the dependencies
47
59
  */
48
60
  typescript?: boolean | OptionsTypeScriptWithTypes;
61
+ /**
62
+ * Enable JSX related rules.
63
+ *
64
+ * Currently only stylistic rules are included.
65
+ *
66
+ * @default true
67
+ */
68
+ jsx?: boolean;
49
69
  /**
50
70
  * Enable test support.
51
71
  *
@@ -104,18 +124,18 @@ interface OptionsConfig extends OptionsComponentExts {
104
124
  * Provide overrides for rules for each integration.
105
125
  */
106
126
  overrides?: {
107
- javascript?: FlatESLintConfigItem['rules'];
108
- typescript?: FlatESLintConfigItem['rules'];
109
- test?: FlatESLintConfigItem['rules'];
110
- vue?: FlatESLintConfigItem['rules'];
111
- jsonc?: FlatESLintConfigItem['rules'];
112
- markdown?: FlatESLintConfigItem['rules'];
113
- yaml?: FlatESLintConfigItem['rules'];
114
- react?: FlatESLintConfigItem['rules'];
127
+ javascript?: ConfigItem['rules'];
128
+ typescript?: ConfigItem['rules'];
129
+ test?: ConfigItem['rules'];
130
+ vue?: ConfigItem['rules'];
131
+ jsonc?: ConfigItem['rules'];
132
+ markdown?: ConfigItem['rules'];
133
+ yaml?: ConfigItem['rules'];
134
+ react?: ConfigItem['rules'];
115
135
  };
116
136
  }
117
137
  interface OptionsOverrides {
118
- overrides?: FlatESLintConfigItem['rules'];
138
+ overrides?: ConfigItem['rules'];
119
139
  }
120
140
  interface OptionsIsInEditor {
121
141
  isInEditor?: boolean;
@@ -152,57 +172,57 @@ interface OptionsHasTypeScript {
152
172
  }
153
173
 
154
174
  declare function vinicuncaESLint({ options, userConfigs }?: {
155
- options?: OptionsConfig;
156
- userConfigs?: (FlatESLintConfigItem | FlatESLintConfigItem[])[];
157
- }): eslint_define_config.FlatESLintConfigItem[];
175
+ options?: OptionsConfig & ConfigItem;
176
+ userConfigs?: (ConfigItem | ConfigItem[])[];
177
+ }): ConfigItem[];
158
178
 
159
- declare function comments(): FlatESLintConfigItem[];
179
+ declare function comments(): ConfigItem[];
160
180
 
161
- declare function ignores({ enableGitignore, items, replace, }?: OptionsIgnores): FlatESLintConfigItem[];
181
+ declare function ignores({ enableGitignore, items, replace, }?: OptionsIgnores): ConfigItem[];
162
182
 
163
- declare function imports(): FlatESLintConfigItem[];
183
+ declare function imports(): ConfigItem[];
164
184
 
165
- declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
185
+ declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
166
186
 
167
- declare function jsdoc(): FlatESLintConfigItem[];
187
+ declare function jsdoc(): ConfigItem[];
168
188
 
169
- declare function jsonc(options?: OptionsOverrides): FlatESLintConfigItem[];
189
+ declare function jsonc(options?: OptionsOverrides): ConfigItem[];
170
190
 
171
- declare function markdown(options?: OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
191
+ declare function markdown(options?: OptionsComponentExts & OptionsOverrides): ConfigItem[];
172
192
 
173
- declare function node(): FlatESLintConfigItem[];
193
+ declare function node(): ConfigItem[];
174
194
 
175
- declare function react(options?: OptionsOverrides): FlatESLintConfigItem[];
195
+ declare function react(options?: OptionsOverrides): ConfigItem[];
176
196
 
177
197
  /**
178
198
  * Sort package.json
179
199
  *
180
200
  * Requires `jsonc` config
181
201
  */
182
- declare function sortPackageJson(): FlatESLintConfigItem[];
202
+ declare function sortPackageJson(): ConfigItem[];
183
203
  /**
184
204
  * Sort tsconfig.json
185
205
  *
186
206
  * Requires `jsonc` config
187
207
  */
188
- declare function sortTsconfig(): FlatESLintConfigItem[];
208
+ declare function sortTsconfig(): ConfigItem[];
189
209
 
190
- declare function stylistic(): FlatESLintConfigItem[];
210
+ declare function stylistic(): ConfigItem[];
191
211
 
192
- declare function test(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
212
+ declare function test(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
193
213
 
194
- declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): FlatESLintConfigItem[];
214
+ declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): ConfigItem[];
195
215
 
196
- declare function unicorn(options?: OptionsOverrides): FlatESLintConfigItem[];
216
+ declare function unicorn(options?: OptionsOverrides): ConfigItem[];
197
217
 
198
- declare function vue(options?: OptionsHasTypeScript & OptionsOverrides): FlatESLintConfigItem[];
218
+ declare function vue(options?: OptionsHasTypeScript & OptionsOverrides): ConfigItem[];
199
219
 
200
- declare function yaml(options?: OptionsOverrides): FlatESLintConfigItem[];
220
+ declare function yaml(options?: OptionsOverrides): ConfigItem[];
201
221
 
202
222
  /**
203
223
  * Combine array and non-array configs into a single array.
204
224
  */
205
- declare function combineConfigs(...configs: (FlatESLintConfigItem$1 | FlatESLintConfigItem$1[])[]): FlatESLintConfigItem$1[];
225
+ declare function combineConfigs(...configs: (ConfigItem | ConfigItem[])[]): ConfigItem[];
206
226
  declare function renameRules(rules: Record<string, any>, from: string, to: string): {
207
227
  [k: string]: any;
208
228
  };
@@ -223,4 +243,4 @@ declare const GLOB_YAML = "**/*.y?(a)ml";
223
243
  declare const GLOB_MARKDOWN = "**/*.md";
224
244
  declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
225
245
 
226
- export { FlatESLintConfigItem, GLOB_EXCLUDE, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, combineConfigs, comments, vinicuncaESLint as default, ignores, imports, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vinicuncaESLint, vue, yaml };
246
+ export { ConfigItem, GLOB_EXCLUDE, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, combineConfigs, comments, vinicuncaESLint as default, ignores, imports, javascript, jsdoc, jsonc, markdown, node, react, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vinicuncaESLint, vue, yaml };
package/dist/index.js CHANGED
@@ -68,6 +68,55 @@ function _uniq(array) {
68
68
  uniq2.lazy = lazy;
69
69
  })(uniq || (uniq = {}));
70
70
 
71
+ // src/flags.ts
72
+ var ERROR = "error";
73
+ var OFF = "off";
74
+ var WARN = "warn";
75
+ var CONSISTENT = "consistent";
76
+ var NEVER = "never";
77
+ var ALWAYS = "always";
78
+
79
+ // src/plugins.ts
80
+ import { default as default2 } from "@stylistic/eslint-plugin";
81
+ import { default as default3 } from "@vinicunca/eslint-plugin-vinicunca";
82
+ import { default as default4 } from "@typescript-eslint/eslint-plugin";
83
+ import * as parserTs from "@typescript-eslint/parser";
84
+ import { default as default5 } from "eslint-plugin-eslint-comments";
85
+ import * as pluginImport from "eslint-plugin-i";
86
+ import { default as default6 } from "eslint-plugin-jsdoc";
87
+ import * as pluginJsonc from "eslint-plugin-jsonc";
88
+ import { default as default7 } from "eslint-plugin-markdown";
89
+ import { default as default8 } from "eslint-plugin-n";
90
+ import { default as default9 } from "eslint-plugin-no-only-tests";
91
+ import { default as default10 } from "eslint-plugin-unicorn";
92
+ import { default as default11 } from "eslint-plugin-unused-imports";
93
+ import { default as default12 } from "eslint-plugin-react";
94
+ import { default as default13 } from "eslint-plugin-react-hooks";
95
+ import { default as default14 } from "eslint-plugin-vue";
96
+ import * as pluginYaml from "eslint-plugin-yml";
97
+ import { default as default15 } from "eslint-plugin-vitest";
98
+ import { default as default16 } from "jsonc-eslint-parser";
99
+ import { default as default17 } from "vue-eslint-parser";
100
+ import { default as default18 } from "yaml-eslint-parser";
101
+
102
+ // src/configs/comments.ts
103
+ function comments() {
104
+ return [
105
+ {
106
+ name: "vinicunca:eslint-comments",
107
+ plugins: {
108
+ "eslint-comments": default5
109
+ },
110
+ rules: {
111
+ "eslint-comments/no-aggregating-enable": ERROR,
112
+ "eslint-comments/no-duplicate-disable": ERROR,
113
+ "eslint-comments/no-unlimited-disable": ERROR,
114
+ "eslint-comments/no-unused-enable": ERROR
115
+ }
116
+ }
117
+ ];
118
+ }
119
+
71
120
  // src/configs/ignores.ts
72
121
  import fs from "fs";
73
122
  import parseGitignore from "parse-gitignore";
@@ -88,6 +137,7 @@ var GLOB_EXCLUDE = [
88
137
  "**/temp",
89
138
  "**/.vitepress/cache",
90
139
  "**/.nuxt",
140
+ "**/.next",
91
141
  "**/.vercel",
92
142
  "**/.changeset",
93
143
  "**/.idea",
@@ -147,77 +197,11 @@ function ignores({
147
197
  }
148
198
  return [
149
199
  {
150
- name: "vinicunca:ignores",
151
200
  ignores: uniq(ignoreList)
152
201
  }
153
202
  ];
154
203
  }
155
204
 
156
- // src/utils.ts
157
- function combineConfigs(...configs) {
158
- return configs.flatMap((config) => Array.isArray(config) ? config : [config]);
159
- }
160
- function renameRules(rules, from, to) {
161
- return Object.fromEntries(
162
- Object.entries(rules).map(([key, value]) => {
163
- if (key.startsWith(from)) {
164
- return [to + key.slice(from.length), value];
165
- }
166
- ;
167
- return [key, value];
168
- })
169
- );
170
- }
171
-
172
- // src/flags.ts
173
- var ERROR = "error";
174
- var OFF = "off";
175
- var WARN = "warn";
176
- var CONSISTENT = "consistent";
177
- var NEVER = "never";
178
- var ALWAYS = "always";
179
-
180
- // src/plugins.ts
181
- import { default as default2 } from "@stylistic/eslint-plugin";
182
- import { default as default3 } from "@vinicunca/eslint-plugin-vinicunca";
183
- import { default as default4 } from "@typescript-eslint/eslint-plugin";
184
- import * as parserTs from "@typescript-eslint/parser";
185
- import { default as default5 } from "eslint-plugin-eslint-comments";
186
- import * as pluginImport from "eslint-plugin-i";
187
- import { default as default6 } from "eslint-plugin-jsdoc";
188
- import * as pluginJsonc from "eslint-plugin-jsonc";
189
- import { default as default7 } from "eslint-plugin-markdown";
190
- import { default as default8 } from "eslint-plugin-n";
191
- import { default as default9 } from "eslint-plugin-no-only-tests";
192
- import { default as default10 } from "eslint-plugin-unicorn";
193
- import { default as default11 } from "eslint-plugin-unused-imports";
194
- import { default as default12 } from "eslint-plugin-react";
195
- import { default as default13 } from "eslint-plugin-react-hooks";
196
- import { default as default14 } from "eslint-plugin-vue";
197
- import * as pluginYaml from "eslint-plugin-yml";
198
- import { default as default15 } from "eslint-plugin-vitest";
199
- import { default as default16 } from "jsonc-eslint-parser";
200
- import { default as default17 } from "vue-eslint-parser";
201
- import { default as default18 } from "yaml-eslint-parser";
202
-
203
- // src/configs/comments.ts
204
- function comments() {
205
- return [
206
- {
207
- name: "vinicunca:eslint-comments",
208
- plugins: {
209
- "eslint-comments": default5
210
- },
211
- rules: {
212
- "eslint-comments/no-aggregating-enable": ERROR,
213
- "eslint-comments/no-duplicate-disable": ERROR,
214
- "eslint-comments/no-unlimited-disable": ERROR,
215
- "eslint-comments/no-unused-enable": ERROR
216
- }
217
- }
218
- ];
219
- }
220
-
221
205
  // src/configs/imports.ts
222
206
  function imports() {
223
207
  return [
@@ -273,6 +257,9 @@ function javascript(options = {}) {
273
257
  },
274
258
  sourceType: "module"
275
259
  },
260
+ linterOptions: {
261
+ reportUnusedDisableDirectives: true
262
+ },
276
263
  plugins: {
277
264
  "vinicunca": default3,
278
265
  "unused-imports": default11
@@ -404,7 +391,9 @@ function javascript(options = {}) {
404
391
  "DebuggerStatement",
405
392
  "ForInStatement",
406
393
  "LabeledStatement",
407
- "WithStatement"
394
+ "WithStatement",
395
+ "TSEnumDeclaration[const=true]",
396
+ "TSExportAssignment"
408
397
  ],
409
398
  "no-return-assign": [ERROR, ALWAYS],
410
399
  "no-self-assign": [ERROR, {
@@ -1049,20 +1038,42 @@ function stylistic() {
1049
1038
  "style/eol-last": ERROR,
1050
1039
  "style/func-call-spacing": [ERROR, NEVER],
1051
1040
  "style/indent": [ERROR, 2, {
1052
- SwitchCase: 1,
1053
- VariableDeclarator: 1,
1054
- outerIIFEBody: 1,
1055
- MemberExpression: 1,
1056
- FunctionDeclaration: { parameters: 1, body: 1 },
1057
- FunctionExpression: { parameters: 1, body: 1 },
1058
- CallExpression: { arguments: 1 },
1059
1041
  ArrayExpression: 1,
1060
- ObjectExpression: 1,
1042
+ CallExpression: { arguments: 1 },
1043
+ FunctionDeclaration: { body: 1, parameters: 1 },
1044
+ FunctionExpression: { body: 1, parameters: 1 },
1061
1045
  ImportDeclaration: 1,
1046
+ MemberExpression: 1,
1047
+ ObjectExpression: 1,
1048
+ SwitchCase: 1,
1049
+ VariableDeclarator: 1,
1062
1050
  flatTernaryExpressions: false,
1063
1051
  ignoreComments: false,
1064
- ignoredNodes: ["TemplateLiteral *", "JSXElement", "JSXElement > *", "JSXAttribute", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", "JSXSpreadAttribute", "JSXExpressionContainer", "JSXOpeningElement", "JSXClosingElement", "JSXFragment", "JSXOpeningFragment", "JSXClosingFragment", "JSXText", "JSXEmptyExpression", "JSXSpreadChild"],
1065
- offsetTernaryExpressions: true
1052
+ ignoredNodes: [
1053
+ "TemplateLiteral *",
1054
+ "JSXElement",
1055
+ "JSXElement > *",
1056
+ "JSXAttribute",
1057
+ "JSXIdentifier",
1058
+ "JSXNamespacedName",
1059
+ "JSXMemberExpression",
1060
+ "JSXSpreadAttribute",
1061
+ "JSXExpressionContainer",
1062
+ "JSXOpeningElement",
1063
+ "JSXClosingElement",
1064
+ "JSXFragment",
1065
+ "JSXOpeningFragment",
1066
+ "JSXClosingFragment",
1067
+ "JSXText",
1068
+ "JSXEmptyExpression",
1069
+ "JSXSpreadChild",
1070
+ "TSTypeParameterInstantiation",
1071
+ "FunctionExpression > .params[decorators.length > 0]",
1072
+ "FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
1073
+ "ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
1074
+ ],
1075
+ offsetTernaryExpressions: true,
1076
+ outerIIFEBody: 1
1066
1077
  }],
1067
1078
  "style/key-spacing": [ERROR, { beforeColon: false, afterColon: true }],
1068
1079
  "style/keyword-spacing": [ERROR, { before: true, after: true }],
@@ -1170,6 +1181,24 @@ function test(options = {}) {
1170
1181
 
1171
1182
  // src/configs/typescript.ts
1172
1183
  import process from "process";
1184
+
1185
+ // src/utils.ts
1186
+ function combineConfigs(...configs) {
1187
+ return configs.flatMap((config) => Array.isArray(config) ? config : [config]);
1188
+ }
1189
+ function renameRules(rules, from, to) {
1190
+ return Object.fromEntries(
1191
+ Object.entries(rules).map(([key, value]) => {
1192
+ if (key.startsWith(from)) {
1193
+ return [to + key.slice(from.length), value];
1194
+ }
1195
+ ;
1196
+ return [key, value];
1197
+ })
1198
+ );
1199
+ }
1200
+
1201
+ // src/configs/typescript.ts
1173
1202
  function typescript(options) {
1174
1203
  const {
1175
1204
  componentExts = [],
@@ -1258,6 +1287,7 @@ function typescript(options) {
1258
1287
  "ts/no-empty-function": OFF,
1259
1288
  "ts/no-empty-interface": OFF,
1260
1289
  "ts/no-explicit-any": OFF,
1290
+ "ts/no-import-type-side-effects": ERROR,
1261
1291
  "ts/no-invalid-void-type": OFF,
1262
1292
  "ts/no-non-null-assertion": OFF,
1263
1293
  "ts/no-require-imports": ERROR,
@@ -1273,9 +1303,7 @@ function typescript(options) {
1273
1303
  "vinicunca/generic-spacing": ERROR,
1274
1304
  "vinicunca/named-tuple-spacing": ERROR,
1275
1305
  "vinicunca/no-cjs-exports": ERROR,
1276
- "vinicunca/no-const-enum": ERROR,
1277
1306
  "vinicunca/no-ts-export-equal": ERROR,
1278
- "vinicunca/prefer-inline-type-import": ERROR,
1279
1307
  ...tsconfigPath ? typeAwareRules : {},
1280
1308
  ...overrides
1281
1309
  }
@@ -1528,7 +1556,6 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
1528
1556
  } = options;
1529
1557
  const configs = [];
1530
1558
  configs.push(
1531
- ignores(options.ignores),
1532
1559
  javascript({
1533
1560
  isInEditor,
1534
1561
  overrides: overrides.javascript
@@ -1593,6 +1620,7 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
1593
1620
  overrides: overrides.react
1594
1621
  }));
1595
1622
  }
1623
+ configs.push(ignores(options.ignores));
1596
1624
  return combineConfigs(
1597
1625
  ...configs,
1598
1626
  ...userConfigs
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@vinicunca/eslint-config",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.7",
5
- "packageManager": "pnpm@8.7.6",
4
+ "version": "2.0.0-beta.9",
6
5
  "description": "Vinicunca ESLint config",
7
6
  "author": {
8
7
  "name": "praburangki",
@@ -59,16 +58,17 @@
59
58
  "eslint": ">=8.51.0"
60
59
  },
61
60
  "dependencies": {
62
- "@stylistic/eslint-plugin": "0.0.6",
63
- "@typescript-eslint/eslint-plugin": "^6.7.4",
64
- "@typescript-eslint/parser": "^6.7.4",
65
- "@vinicunca/eslint-plugin-vinicunca": "^1.0.0-beta.4",
61
+ "@antfu/eslint-define-config": "^1.23.0-1",
62
+ "@stylistic/eslint-plugin": "0.0.8",
63
+ "@typescript-eslint/eslint-plugin": "^6.7.5",
64
+ "@typescript-eslint/parser": "^6.7.5",
65
+ "@vinicunca/eslint-plugin-vinicunca": "^1.0.0-beta.5",
66
66
  "eslint-plugin-eslint-comments": "^3.2.0",
67
67
  "eslint-plugin-i": "^2.28.1",
68
68
  "eslint-plugin-jsdoc": "^46.8.2",
69
- "eslint-plugin-jsonc": "^2.9.0",
69
+ "eslint-plugin-jsonc": "^2.10.0",
70
70
  "eslint-plugin-markdown": "^3.0.1",
71
- "eslint-plugin-n": "^16.1.0",
71
+ "eslint-plugin-n": "^16.2.0",
72
72
  "eslint-plugin-no-only-tests": "^3.1.0",
73
73
  "eslint-plugin-react": "^7.33.2",
74
74
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -76,16 +76,16 @@
76
76
  "eslint-plugin-unused-imports": "^3.0.0",
77
77
  "eslint-plugin-vitest": "^0.3.2",
78
78
  "eslint-plugin-vue": "^9.17.0",
79
- "eslint-plugin-yml": "^1.9.0",
79
+ "eslint-plugin-yml": "^1.10.0",
80
80
  "globals": "^13.23.0",
81
81
  "jsonc-eslint-parser": "^2.3.0",
82
82
  "local-pkg": "^0.5.0",
83
83
  "parse-gitignore": "^2.0.0",
84
- "vue-eslint-parser": "^9.3.1",
84
+ "vue-eslint-parser": "^9.3.2",
85
85
  "yaml-eslint-parser": "^1.2.2"
86
86
  },
87
87
  "devDependencies": {
88
- "@eslint-stylistic/metadata": "^0.0.6",
88
+ "@eslint-stylistic/metadata": "^0.0.8",
89
89
  "@types/fs-extra": "^11.0.2",
90
90
  "fs-extra": "^11.1.1",
91
91
  "react": "^18.2.0",