@vinicunca/eslint-config 2.0.0-beta.2 → 2.0.0-beta.6

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.js CHANGED
@@ -2,12 +2,79 @@
2
2
  import process2 from "process";
3
3
  import { isPackageExists } from "local-pkg";
4
4
 
5
+ // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/function/purry.js
6
+ function purry(fn, args, lazy) {
7
+ const diff = fn.length - args.length;
8
+ const arrayArgs = Array.from(args);
9
+ if (diff === 0) {
10
+ return fn(...arrayArgs);
11
+ }
12
+ if (diff === 1) {
13
+ const ret = (data) => fn(data, ...arrayArgs);
14
+ if (lazy || fn.lazy) {
15
+ ret.lazy = lazy || fn.lazy;
16
+ ret.lazyArgs = args;
17
+ }
18
+ return ret;
19
+ }
20
+ throw new Error("Wrong number of arguments");
21
+ }
22
+
5
23
  // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/guard/is-boolean.js
6
24
  function isBoolean(data) {
7
25
  return typeof data === "boolean";
8
26
  }
9
27
 
28
+ // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/utils/reduce-lazy.js
29
+ function _reduceLazy(array, lazy, indexed) {
30
+ const newArray = [];
31
+ for (let index = 0; index < array.length; index++) {
32
+ const item = array[index];
33
+ const result = indexed ? lazy(item, index, array) : lazy(item);
34
+ if (result.hasMany === true) {
35
+ newArray.push(...result.next);
36
+ } else if (result.hasNext) {
37
+ newArray.push(result.next);
38
+ }
39
+ }
40
+ return newArray;
41
+ }
42
+
43
+ // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/array/uniq.js
44
+ function uniq() {
45
+ return purry(_uniq, arguments, uniq.lazy);
46
+ }
47
+ function _uniq(array) {
48
+ return _reduceLazy(array, uniq.lazy());
49
+ }
50
+ (function(uniq2) {
51
+ function lazy() {
52
+ const set = /* @__PURE__ */ new Set();
53
+ return (value) => {
54
+ if (set.has(value)) {
55
+ return {
56
+ done: false,
57
+ hasNext: false
58
+ };
59
+ }
60
+ set.add(value);
61
+ return {
62
+ done: false,
63
+ hasNext: true,
64
+ next: value
65
+ };
66
+ };
67
+ }
68
+ uniq2.lazy = lazy;
69
+ })(uniq || (uniq = {}));
70
+
71
+ // src/configs/ignores.ts
72
+ import fs from "fs";
73
+ import parseGitignore from "parse-gitignore";
74
+
10
75
  // src/globs.ts
76
+ var GLOB_JS = "**/*.?([cm])js";
77
+ var GLOB_JSX = "**/*.?([cm])jsx";
11
78
  var GLOB_TS = "**/*.?([cm])ts";
12
79
  var GLOB_TSX = "**/*.?([cm])tsx";
13
80
  var GLOB_EXCLUDE = [
@@ -24,6 +91,7 @@ var GLOB_EXCLUDE = [
24
91
  "**/.vercel",
25
92
  "**/.changeset",
26
93
  "**/.idea",
94
+ "**/.cache",
27
95
  "**/.output",
28
96
  "**/.vite-inspect",
29
97
  "**/CHANGELOG*.md",
@@ -38,7 +106,9 @@ var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
38
106
  var GLOB_TESTS = [
39
107
  `**/__tests__/**/*.${GLOB_SRC_EXT}`,
40
108
  `**/*.spec.${GLOB_SRC_EXT}`,
41
- `**/*.test.${GLOB_SRC_EXT}`
109
+ `**/*.test.${GLOB_SRC_EXT}`,
110
+ `**/*.bench.${GLOB_SRC_EXT}`,
111
+ `**/*.benchmark.${GLOB_SRC_EXT}`
42
112
  ];
43
113
  var GLOB_VUE = "**/*.vue";
44
114
  var GLOB_JSON = "**/*.json";
@@ -49,9 +119,39 @@ var GLOB_MARKDOWN = "**/*.md";
49
119
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
50
120
 
51
121
  // src/configs/ignores.ts
52
- var ignores = [
53
- { ignores: GLOB_EXCLUDE }
54
- ];
122
+ function ignores({
123
+ enableGitignore = true,
124
+ items = [],
125
+ replace = false
126
+ } = {}) {
127
+ const ignoreList = [];
128
+ if (enableGitignore) {
129
+ if (fs.existsSync(".gitignore")) {
130
+ const gitignoreContent = fs.readFileSync(".gitignore", "utf8");
131
+ const parsed = parseGitignore(gitignoreContent);
132
+ const globs = parsed.globs();
133
+ for (const glob of globs) {
134
+ if (glob.type === "ignore") {
135
+ ignoreList.push(...glob.patterns);
136
+ } else if (glob.type === "unignore") {
137
+ ignoreList.push(...glob.patterns.map((pattern) => `!${pattern}`));
138
+ }
139
+ ;
140
+ }
141
+ }
142
+ }
143
+ if (replace) {
144
+ ignoreList.push(...items);
145
+ } else {
146
+ ignoreList.push(...GLOB_EXCLUDE, ...items);
147
+ }
148
+ return [
149
+ {
150
+ name: "vinicunca:ignores",
151
+ ignores: uniq(ignoreList)
152
+ }
153
+ ];
154
+ }
55
155
 
56
156
  // src/utils.ts
57
157
  function combineConfigs(...configs) {
@@ -78,274 +178,85 @@ var NEVER = "never";
78
178
  var ALWAYS = "always";
79
179
 
80
180
  // src/plugins.ts
81
- import { default as default2 } from "@stylistic/eslint-plugin-js";
82
- import { default as default3 } from "@stylistic/eslint-plugin-ts";
181
+ import { default as default2 } from "@stylistic/eslint-plugin";
182
+ import { default as default3 } from "@vinicunca/eslint-plugin-vinicunca";
83
183
  import { default as default4 } from "@typescript-eslint/eslint-plugin";
84
- import { default as default5 } from "@typescript-eslint/parser";
85
- import { default as default6 } from "eslint-plugin-eslint-comments";
86
- import { default as default7 } from "eslint-plugin-i";
87
- import { default as default8 } from "eslint-plugin-jsdoc";
88
- import { default as default9 } from "eslint-plugin-jsonc";
89
- import { default as default10 } from "eslint-plugin-markdown";
90
- import { default as default11 } from "eslint-plugin-n";
91
- import { default as default12 } from "eslint-plugin-no-only-tests";
92
- import { default as default13 } from "eslint-plugin-unicorn";
93
- import { default as default14 } from "eslint-plugin-unused-imports";
94
- import { default as default15 } from "eslint-plugin-react";
95
- import { default as default16 } from "eslint-plugin-react-hooks";
96
- import { default as default17 } from "eslint-plugin-vue";
97
- import { default as default18 } from "eslint-plugin-yml";
98
- import { default as default19 } from "jsonc-eslint-parser";
99
- import { default as default20 } from "vue-eslint-parser";
100
- import { default as default21 } from "yaml-eslint-parser";
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";
101
202
 
102
203
  // src/configs/comments.ts
103
- var comments = [
104
- {
105
- plugins: {
106
- "eslint-comments": default6
107
- },
108
- rules: {
109
- ...default6.configs.recommended.rules,
110
- "eslint-comments/disable-enable-pair": OFF
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
+ }
111
217
  }
112
- }
113
- ];
218
+ ];
219
+ }
114
220
 
115
221
  // src/configs/imports.ts
116
- var imports = [
117
- {
118
- plugins: {
119
- import: default7
120
- },
121
- rules: {
122
- "import/export": ERROR,
123
- "import/first": ERROR,
124
- "import/newline-after-import": [ERROR, { considerComments: true, count: 1 }],
125
- "import/no-duplicates": ERROR,
126
- "import/no-mutable-exports": ERROR,
127
- "import/no-named-default": ERROR,
128
- "import/no-self-import": ERROR,
129
- "import/no-webpack-loader-syntax": ERROR,
130
- "import/order": ERROR
222
+ function imports() {
223
+ return [
224
+ {
225
+ name: "vinicunca:imports",
226
+ plugins: {
227
+ import: pluginImport,
228
+ vinicunca: default3
229
+ },
230
+ rules: {
231
+ "import/export": ERROR,
232
+ "import/first": ERROR,
233
+ "import/newline-after-import": [ERROR, {
234
+ considerComments: true,
235
+ count: 1
236
+ }],
237
+ "import/no-duplicates": ERROR,
238
+ "import/no-mutable-exports": ERROR,
239
+ "import/no-named-default": ERROR,
240
+ "import/no-self-import": ERROR,
241
+ "import/no-webpack-loader-syntax": ERROR,
242
+ "import/order": ERROR,
243
+ "vinicunca/import-dedupe": ERROR,
244
+ "vinicunca/no-import-node-modules-by-path": ERROR
245
+ }
131
246
  }
132
- }
133
- ];
247
+ ];
248
+ }
134
249
 
135
250
  // src/configs/javascript.ts
136
251
  import globals from "globals";
137
- var rulesProblems = {
138
- "array-callback-return": [ERROR, { checkForEach: true }],
139
- "constructor-super": ERROR,
140
- "for-direction": ERROR,
141
- "no-async-promise-executor": ERROR,
142
- "no-await-in-loop": ERROR,
143
- "no-class-assign": ERROR,
144
- "no-compare-neg-zero": ERROR,
145
- "no-cond-assign": [ERROR, "always"],
146
- "no-const-assign": ERROR,
147
- "no-constant-binary-expression": ERROR,
148
- "no-constant-condition": [ERROR, { checkLoops: false }],
149
- "no-constructor-return": ERROR,
150
- "no-control-regex": ERROR,
151
- "no-debugger": ERROR,
152
- "no-dupe-args": ERROR,
153
- "no-dupe-class-members": ERROR,
154
- "no-dupe-else-if": ERROR,
155
- "no-dupe-keys": ERROR,
156
- "no-duplicate-case": ERROR,
157
- "no-empty-character-class": ERROR,
158
- "no-empty-pattern": ERROR,
159
- "no-ex-assign": ERROR,
160
- "no-fallthrough": ERROR,
161
- "no-func-assign": ERROR,
162
- "no-import-assign": ERROR,
163
- "no-invalid-regexp": ERROR,
164
- "no-irregular-whitespace": ERROR,
165
- "no-loss-of-precision": ERROR,
166
- "no-misleading-character-class": ERROR,
167
- "no-new-symbol": ERROR,
168
- "no-obj-calls": ERROR,
169
- "no-promise-executor-return": ERROR,
170
- "no-prototype-builtins": ERROR,
171
- "no-self-assign": [ERROR, { props: true }],
172
- "no-self-compare": ERROR,
173
- "no-sparse-arrays": ERROR,
174
- "no-template-curly-in-string": ERROR,
175
- "no-this-before-super": ERROR,
176
- "no-undef": ERROR,
177
- "no-unexpected-multiline": ERROR,
178
- "no-unmodified-loop-condition": ERROR,
179
- "no-unreachable": ERROR,
180
- "no-unreachable-loop": ERROR,
181
- "no-unsafe-finally": ERROR,
182
- "no-unsafe-negation": ERROR,
183
- "no-unused-vars": [ERROR, {
184
- args: "none",
185
- caughtErrors: "none",
186
- ignoreRestSiblings: true,
187
- vars: "all"
188
- }],
189
- "no-use-before-define": [ERROR, {
190
- functions: false,
191
- classes: false,
192
- variables: true
193
- }],
194
- "no-useless-backreference": ERROR,
195
- "use-isnan": [ERROR, {
196
- enforceForSwitchCase: true,
197
- enforceForIndexOf: true
198
- }],
199
- "valid-typeof": [ERROR, { requireStringLiterals: true }]
200
- };
201
- var rulesSuggestions = {
202
- "accessor-pairs": [ERROR, { setWithoutGet: true, enforceForClassMembers: true }],
203
- "block-scoped-var": ERROR,
204
- "camelcase": [ERROR, {
205
- allow: ["^UNSAFE_"],
206
- properties: "never",
207
- ignoreGlobals: true
208
- }],
209
- "curly": [ERROR, "all"],
210
- "default-case-last": ERROR,
211
- "dot-notation": [ERROR, { allowKeywords: true }],
212
- "eqeqeq": [ERROR, "smart"],
213
- "new-cap": [ERROR, { capIsNew: false, properties: true }],
214
- "no-alert": WARN,
215
- "no-array-constructor": ERROR,
216
- "no-caller": ERROR,
217
- "no-case-declarations": ERROR,
218
- "no-console": [ERROR, { allow: [WARN, ERROR] }],
219
- "no-delete-var": ERROR,
220
- "no-empty": [ERROR, { allowEmptyCatch: true }],
221
- "no-eval": ERROR,
222
- "no-extend-native": ERROR,
223
- "no-extra-bind": ERROR,
224
- "no-extra-boolean-cast": ERROR,
225
- "no-floating-decimal": ERROR,
226
- "no-global-assign": ERROR,
227
- "no-implied-eval": ERROR,
228
- "no-invalid-this": ERROR,
229
- "no-iterator": ERROR,
230
- "no-labels": [ERROR],
231
- "no-lone-blocks": ERROR,
232
- "no-mixed-operators": [ERROR, {
233
- groups: [
234
- ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
235
- ["&&", "||"],
236
- ["in", "instanceof"]
237
- ],
238
- allowSamePrecedence: true
239
- }],
240
- "no-multi-str": ERROR,
241
- "no-nested-ternary": ERROR,
242
- "no-new": ERROR,
243
- "no-new-func": ERROR,
244
- "no-object-constructor": ERROR,
245
- "no-new-wrappers": ERROR,
246
- "no-octal": ERROR,
247
- "no-octal-escape": ERROR,
248
- "no-proto": ERROR,
249
- "no-redeclare": [ERROR, { builtinGlobals: false }],
250
- "no-regex-spaces": ERROR,
251
- "no-restricted-globals": [
252
- ERROR,
253
- { name: "global", message: "Use `globalThis` instead." },
254
- { name: "self", message: "Use `globalThis` instead." }
255
- ],
256
- "no-restricted-properties": [
257
- ERROR,
258
- { property: "__proto__", message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead." },
259
- { property: "__defineGetter__", message: "Use `Object.defineProperty` instead." },
260
- { property: "__defineSetter__", message: "Use `Object.defineProperty` instead." },
261
- { property: "__lookupGetter__", message: "Use `Object.getOwnPropertyDescriptor` instead." },
262
- { property: "__lookupSetter__", message: "Use `Object.getOwnPropertyDescriptor` instead." }
263
- ],
264
- "no-restricted-syntax": [
265
- ERROR,
266
- "DebuggerStatement",
267
- "ForInStatement",
268
- "LabeledStatement",
269
- "WithStatement"
270
- ],
271
- "no-return-assign": [ERROR, "always"],
272
- "no-sequences": ERROR,
273
- "no-shadow-restricted-names": ERROR,
274
- "no-throw-literal": ERROR,
275
- "no-undef-init": ERROR,
276
- "no-unneeded-ternary": [ERROR, { defaultAssignment: false }],
277
- "no-unused-expressions": [ERROR, {
278
- allowShortCircuit: true,
279
- allowTernary: true,
280
- allowTaggedTemplates: true
281
- }],
282
- "no-useless-call": ERROR,
283
- "no-useless-catch": ERROR,
284
- "no-useless-computed-key": ERROR,
285
- "no-useless-constructor": ERROR,
286
- "no-useless-rename": ERROR,
287
- "no-useless-return": ERROR,
288
- "no-var": ERROR,
289
- "no-void": ERROR,
290
- "no-with": ERROR,
291
- "object-shorthand": [ERROR, "always", {
292
- ignoreConstructors: false,
293
- avoidQuotes: true
294
- }],
295
- "one-var": [ERROR, { initialized: "never" }],
296
- "prefer-arrow-callback": [ERROR],
297
- "prefer-const": [ERROR, {
298
- destructuring: "all",
299
- ignoreReadBeforeAssign: true
300
- }],
301
- "prefer-exponentiation-operator": ERROR,
302
- "prefer-promise-reject-errors": ERROR,
303
- "prefer-regex-literals": [ERROR, { disallowRedundantWrapping: true }],
304
- "prefer-rest-params": ERROR,
305
- "prefer-spread": ERROR,
306
- "prefer-template": ERROR,
307
- "quote-props": [ERROR, "consistent-as-needed"],
308
- "sort-imports": [
309
- ERROR,
310
- {
311
- ignoreCase: false,
312
- ignoreDeclarationSort: true,
313
- ignoreMemberSort: false,
314
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
315
- allowSeparatedGroups: false
316
- }
317
- ],
318
- "symbol-description": ERROR,
319
- "vars-on-top": ERROR,
320
- "yoda": [ERROR, "never"]
321
- };
322
- var rulesLayout = {
323
- "arrow-parens": [ERROR, ALWAYS],
324
- "eol-last": ERROR,
325
- "max-statements-per-line": [ERROR, { max: 1 }],
326
- "new-parens": ERROR,
327
- "no-extra-parens": [ERROR, "functions"],
328
- "quotes": [ERROR, "single"],
329
- "semi": [ERROR, ALWAYS],
330
- "wrap-iife": [ERROR, "any", { functionPrototypeMethods: true }],
331
- "unicode-bom": [ERROR, NEVER]
332
- };
333
252
  function javascript(options = {}) {
334
- const rulesUnusedImports = {
335
- "unused-imports/no-unused-imports": options.isInEditor ? OFF : ERROR,
336
- "unused-imports/no-unused-vars": [
337
- WARN,
338
- {
339
- vars: "all",
340
- varsIgnorePattern: "^_",
341
- args: "after-used",
342
- argsIgnorePattern: "^_",
343
- ignoreRestSiblings: true
344
- }
345
- ]
346
- };
253
+ const {
254
+ isInEditor = false,
255
+ overrides = {}
256
+ } = options;
347
257
  return [
348
258
  {
259
+ name: "vinicunca:javascript",
349
260
  languageOptions: {
350
261
  ecmaVersion: 2022,
351
262
  globals: {
@@ -363,17 +274,242 @@ function javascript(options = {}) {
363
274
  sourceType: "module"
364
275
  },
365
276
  plugins: {
366
- // 'antfu': pluginAntfu,
367
- "unused-imports": default14
277
+ "vinicunca": default3,
278
+ "unused-imports": default11
368
279
  },
369
280
  rules: {
370
- ...rulesProblems,
371
- ...rulesSuggestions,
372
- ...rulesLayout,
373
- ...rulesUnusedImports
281
+ "accessor-pairs": [ERROR, {
282
+ setWithoutGet: true,
283
+ enforceForClassMembers: true
284
+ }],
285
+ "array-callback-return": [ERROR, { checkForEach: true }],
286
+ "arrow-parens": [ERROR, ALWAYS],
287
+ "block-scoped-var": ERROR,
288
+ "camelcase": [ERROR, {
289
+ allow: ["^UNSAFE_"],
290
+ properties: NEVER,
291
+ ignoreGlobals: true
292
+ }],
293
+ "constructor-super": ERROR,
294
+ "default-case-last": ERROR,
295
+ "dot-notation": [ERROR, { allowKeywords: true }],
296
+ "eqeqeq": [ERROR, "smart"],
297
+ "for-direction": ERROR,
298
+ "new-cap": [ERROR, {
299
+ capIsNew: false,
300
+ properties: true
301
+ }],
302
+ "no-alert": WARN,
303
+ "no-array-constructor": ERROR,
304
+ "no-async-promise-executor": ERROR,
305
+ "no-await-in-loop": ERROR,
306
+ "no-caller": ERROR,
307
+ "no-case-declarations": ERROR,
308
+ "no-class-assign": ERROR,
309
+ "no-compare-neg-zero": ERROR,
310
+ "no-console": [ERROR, {
311
+ allow: [WARN, ERROR]
312
+ }],
313
+ "no-cond-assign": [ERROR, ALWAYS],
314
+ "no-const-assign": ERROR,
315
+ "no-constant-binary-expression": ERROR,
316
+ "no-constant-condition": [ERROR, {
317
+ checkLoops: false
318
+ }],
319
+ "no-constructor-return": ERROR,
320
+ "no-control-regex": ERROR,
321
+ "no-debugger": ERROR,
322
+ "no-delete-var": ERROR,
323
+ "no-dupe-args": ERROR,
324
+ "no-dupe-class-members": ERROR,
325
+ "no-dupe-else-if": ERROR,
326
+ "no-dupe-keys": ERROR,
327
+ "no-duplicate-case": ERROR,
328
+ "no-empty": [ERROR, {
329
+ allowEmptyCatch: true
330
+ }],
331
+ "no-empty-character-class": ERROR,
332
+ "no-empty-pattern": ERROR,
333
+ "no-eval": ERROR,
334
+ "no-ex-assign": ERROR,
335
+ "no-extend-native": ERROR,
336
+ "no-extra-bind": ERROR,
337
+ "no-extra-boolean-cast": ERROR,
338
+ "no-fallthrough": ERROR,
339
+ "no-func-assign": ERROR,
340
+ "no-global-assign": ERROR,
341
+ "no-implied-eval": ERROR,
342
+ "no-import-assign": ERROR,
343
+ "no-invalid-this": ERROR,
344
+ "no-invalid-regexp": ERROR,
345
+ "no-irregular-whitespace": ERROR,
346
+ "no-iterator": ERROR,
347
+ "no-labels": ERROR,
348
+ "no-lone-blocks": ERROR,
349
+ "no-loss-of-precision": ERROR,
350
+ "no-misleading-character-class": ERROR,
351
+ "no-multi-str": ERROR,
352
+ "no-nested-ternary": ERROR,
353
+ "no-new": ERROR,
354
+ "no-new-func": ERROR,
355
+ "no-new-symbol": ERROR,
356
+ "no-new-wrappers": ERROR,
357
+ "no-obj-calls": ERROR,
358
+ "no-object-constructor": ERROR,
359
+ "no-octal": ERROR,
360
+ "no-octal-escape": ERROR,
361
+ "no-promise-executor-return": ERROR,
362
+ "no-proto": ERROR,
363
+ "no-prototype-builtins": ERROR,
364
+ "no-redeclare": [ERROR, {
365
+ builtinGlobals: false
366
+ }],
367
+ "no-regex-spaces": ERROR,
368
+ "no-restricted-globals": [
369
+ ERROR,
370
+ {
371
+ name: "global",
372
+ message: "Use `globalThis` instead."
373
+ },
374
+ {
375
+ name: "self",
376
+ message: "Use `globalThis` instead."
377
+ }
378
+ ],
379
+ "no-restricted-properties": [
380
+ ERROR,
381
+ {
382
+ property: "__proto__",
383
+ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead."
384
+ },
385
+ {
386
+ property: "__defineGetter__",
387
+ message: "Use `Object.defineProperty` instead."
388
+ },
389
+ {
390
+ property: "__defineSetter__",
391
+ message: "Use `Object.defineProperty` instead."
392
+ },
393
+ {
394
+ property: "__lookupGetter__",
395
+ message: "Use `Object.getOwnPropertyDescriptor` instead."
396
+ },
397
+ {
398
+ property: "__lookupSetter__",
399
+ message: "Use `Object.getOwnPropertyDescriptor` instead."
400
+ }
401
+ ],
402
+ "no-restricted-syntax": [
403
+ ERROR,
404
+ "DebuggerStatement",
405
+ "ForInStatement",
406
+ "LabeledStatement",
407
+ "WithStatement"
408
+ ],
409
+ "no-return-assign": [ERROR, ALWAYS],
410
+ "no-self-assign": [ERROR, {
411
+ props: true
412
+ }],
413
+ "no-self-compare": ERROR,
414
+ "no-sequences": ERROR,
415
+ "no-shadow-restricted-names": ERROR,
416
+ "no-sparse-arrays": ERROR,
417
+ "no-template-curly-in-string": ERROR,
418
+ "no-this-before-super": ERROR,
419
+ "no-throw-literal": ERROR,
420
+ "no-undef": ERROR,
421
+ "no-undef-init": ERROR,
422
+ "no-unexpected-multiline": ERROR,
423
+ "no-unmodified-loop-condition": ERROR,
424
+ "no-unneeded-ternary": [ERROR, {
425
+ defaultAssignment: false
426
+ }],
427
+ "no-unreachable": ERROR,
428
+ "no-unreachable-loop": ERROR,
429
+ "no-unsafe-finally": ERROR,
430
+ "no-unsafe-negation": ERROR,
431
+ "no-unused-expressions": [ERROR, {
432
+ allowShortCircuit: true,
433
+ allowTernary: true,
434
+ allowTaggedTemplates: true
435
+ }],
436
+ "no-unused-vars": [ERROR, {
437
+ args: "none",
438
+ caughtErrors: "none",
439
+ ignoreRestSiblings: true,
440
+ vars: "all"
441
+ }],
442
+ "no-use-before-define": [ERROR, {
443
+ functions: false,
444
+ classes: false,
445
+ variables: true
446
+ }],
447
+ "no-useless-backreference": ERROR,
448
+ "no-useless-call": ERROR,
449
+ "no-useless-catch": ERROR,
450
+ "no-useless-computed-key": ERROR,
451
+ "no-useless-constructor": ERROR,
452
+ "no-useless-rename": ERROR,
453
+ "no-useless-return": ERROR,
454
+ "no-var": ERROR,
455
+ "no-void": ERROR,
456
+ "no-with": ERROR,
457
+ "object-shorthand": [ERROR, ALWAYS, {
458
+ ignoreConstructors: false,
459
+ avoidQuotes: true
460
+ }],
461
+ "one-var": [ERROR, {
462
+ initialized: NEVER
463
+ }],
464
+ "prefer-arrow-callback": [ERROR],
465
+ "prefer-const": [ERROR, {
466
+ destructuring: "all",
467
+ ignoreReadBeforeAssign: true
468
+ }],
469
+ "prefer-exponentiation-operator": ERROR,
470
+ "prefer-promise-reject-errors": ERROR,
471
+ "prefer-regex-literals": [ERROR, {
472
+ disallowRedundantWrapping: true
473
+ }],
474
+ "prefer-rest-params": ERROR,
475
+ "prefer-spread": ERROR,
476
+ "prefer-template": ERROR,
477
+ "sort-imports": [ERROR, {
478
+ ignoreCase: false,
479
+ ignoreDeclarationSort: true,
480
+ ignoreMemberSort: false,
481
+ memberSyntaxSortOrder: [
482
+ "none",
483
+ "all",
484
+ "multiple",
485
+ "single"
486
+ ],
487
+ allowSeparatedGroups: false
488
+ }],
489
+ "symbol-description": ERROR,
490
+ "unicode-bom": [ERROR, NEVER],
491
+ "use-isnan": [ERROR, {
492
+ enforceForSwitchCase: true,
493
+ enforceForIndexOf: true
494
+ }],
495
+ "valid-typeof": [ERROR, {
496
+ requireStringLiterals: true
497
+ }],
498
+ "vars-on-top": ERROR,
499
+ "yoda": [ERROR, NEVER],
500
+ "unused-imports/no-unused-imports": isInEditor ? OFF : ERROR,
501
+ "unused-imports/no-unused-vars": [WARN, {
502
+ vars: "all",
503
+ varsIgnorePattern: "^_",
504
+ args: "after-used",
505
+ argsIgnorePattern: "^_",
506
+ ignoreRestSiblings: true
507
+ }],
508
+ ...overrides
374
509
  }
375
510
  },
376
511
  {
512
+ name: "vinicunca:javascript:overrides",
377
513
  files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
378
514
  rules: {
379
515
  "no-console": OFF
@@ -383,68 +519,119 @@ function javascript(options = {}) {
383
519
  }
384
520
 
385
521
  // src/configs/jsdoc.ts
386
- var jsdoc = [
387
- {
388
- plugins: {
389
- jsdoc: default8
390
- },
391
- rules: {
392
- ...default8.configs["flat/recommended-typescript"].rules,
393
- "jsdoc/check-tag-names": OFF,
394
- "jsdoc/check-values": OFF,
395
- "jsdoc/no-undefined-types": OFF,
396
- "jsdoc/require-jsdoc": OFF,
397
- "jsdoc/require-param": OFF,
398
- "jsdoc/require-param-description": OFF,
399
- "jsdoc/require-param-type": OFF,
400
- "jsdoc/require-returns": OFF,
401
- "jsdoc/require-returns-type": OFF,
402
- "jsdoc/require-throws": OFF,
403
- "jsdoc/require-yields": OFF,
404
- "jsdoc/tag-lines": OFF
522
+ function jsdoc() {
523
+ return [
524
+ {
525
+ name: "vinicunca:jsdoc",
526
+ plugins: {
527
+ jsdoc: default6
528
+ },
529
+ rules: {
530
+ "jsdoc/check-access": WARN,
531
+ "jsdoc/check-alignment": WARN,
532
+ "jsdoc/check-param-names": WARN,
533
+ "jsdoc/check-property-names": WARN,
534
+ "jsdoc/check-types": WARN,
535
+ "jsdoc/empty-tags": WARN,
536
+ "jsdoc/implements-on-classes": WARN,
537
+ "jsdoc/multiline-blocks": WARN,
538
+ "jsdoc/no-defaults": WARN,
539
+ "jsdoc/no-multi-asterisks": WARN,
540
+ "jsdoc/no-types": WARN,
541
+ "jsdoc/require-param-name": WARN,
542
+ "jsdoc/require-property": WARN,
543
+ "jsdoc/require-property-description": WARN,
544
+ "jsdoc/require-property-name": WARN,
545
+ "jsdoc/require-returns-check": WARN,
546
+ "jsdoc/require-returns-description": WARN,
547
+ "jsdoc/require-yields-check": WARN,
548
+ "jsdoc/valid-types": WARN
549
+ }
405
550
  }
406
- }
407
- ];
551
+ ];
552
+ }
408
553
 
409
554
  // src/configs/jsonc.ts
410
- var jsonc = [
411
- {
412
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
413
- languageOptions: {
414
- parser: default19
415
- },
416
- plugins: {
417
- jsonc: default9
555
+ function jsonc(options = {}) {
556
+ const {
557
+ overrides = {}
558
+ } = options;
559
+ return [
560
+ {
561
+ name: "vinicunca:jsonc:setup",
562
+ plugins: {
563
+ jsonc: pluginJsonc
564
+ }
418
565
  },
419
- rules: {
420
- ...default9.configs["recommended-with-jsonc"].rules,
421
- "jsonc/array-bracket-spacing": [ERROR, NEVER],
422
- "jsonc/comma-dangle": [ERROR, NEVER],
423
- "jsonc/comma-style": [ERROR, "last"],
424
- "jsonc/indent": [ERROR, 2],
425
- "jsonc/key-spacing": [ERROR, { afterColon: true, beforeColon: false }],
426
- "jsonc/no-octal-escape": ERROR,
427
- "jsonc/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
428
- "jsonc/object-curly-spacing": [ERROR, "always"],
429
- "jsonc/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }]
566
+ {
567
+ name: "vinicunca:jsonc:rules",
568
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
569
+ languageOptions: {
570
+ parser: default16
571
+ },
572
+ rules: {
573
+ "jsonc/array-bracket-spacing": [ERROR, NEVER],
574
+ "jsonc/comma-dangle": [ERROR, NEVER],
575
+ "jsonc/comma-style": [ERROR, "last"],
576
+ "jsonc/indent": [ERROR, 2],
577
+ "jsonc/key-spacing": [ERROR, { afterColon: true, beforeColon: false }],
578
+ "jsonc/no-bigint-literals": ERROR,
579
+ "jsonc/no-binary-expression": ERROR,
580
+ "jsonc/no-binary-numeric-literals": ERROR,
581
+ "jsonc/no-dupe-keys": ERROR,
582
+ "jsonc/no-escape-sequence-in-identifier": ERROR,
583
+ "jsonc/no-floating-decimal": ERROR,
584
+ "jsonc/no-hexadecimal-numeric-literals": ERROR,
585
+ "jsonc/no-infinity": ERROR,
586
+ "jsonc/no-multi-str": ERROR,
587
+ "jsonc/no-nan": ERROR,
588
+ "jsonc/no-number-props": ERROR,
589
+ "jsonc/no-numeric-separators": ERROR,
590
+ "jsonc/no-octal": ERROR,
591
+ "jsonc/no-octal-escape": ERROR,
592
+ "jsonc/no-octal-numeric-literals": ERROR,
593
+ "jsonc/no-parenthesized": ERROR,
594
+ "jsonc/no-plus-sign": ERROR,
595
+ "jsonc/no-regexp-literals": ERROR,
596
+ "jsonc/no-sparse-arrays": ERROR,
597
+ "jsonc/no-template-literals": ERROR,
598
+ "jsonc/no-undefined-value": ERROR,
599
+ "jsonc/no-unicode-codepoint-escapes": ERROR,
600
+ "jsonc/no-useless-escape": ERROR,
601
+ "jsonc/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
602
+ "jsonc/object-curly-spacing": [ERROR, "always"],
603
+ "jsonc/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
604
+ "jsonc/quote-props": ERROR,
605
+ "jsonc/quotes": ERROR,
606
+ "jsonc/space-unary-ops": ERROR,
607
+ "jsonc/valid-json-number": ERROR,
608
+ "jsonc/vue-custom-block/no-parsing-error": ERROR,
609
+ ...overrides
610
+ }
430
611
  }
431
- }
432
- ];
612
+ ];
613
+ }
433
614
 
434
615
  // src/configs/markdown.ts
435
616
  function markdown(options = {}) {
436
617
  const {
437
- componentExts = []
618
+ componentExts = [],
619
+ overrides = {}
438
620
  } = options;
439
621
  return [
440
622
  {
441
- files: [GLOB_MARKDOWN],
623
+ name: "vinicunca:markdown:setup",
442
624
  plugins: {
443
- markdown: default10
444
- },
625
+ markdown: default7
626
+ }
627
+ },
628
+ {
629
+ name: "vinicunca:markdown:processor",
630
+ files: [GLOB_MARKDOWN],
445
631
  processor: "markdown/markdown"
446
632
  },
447
633
  {
634
+ name: "vinicunca:markdown:rules",
448
635
  files: [
449
636
  GLOB_MARKDOWN_CODE,
450
637
  ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
@@ -456,22 +643,15 @@ function markdown(options = {}) {
456
643
  }
457
644
  }
458
645
  },
459
- plugins: {
460
- ts: default4
461
- },
462
646
  rules: {
463
- ...default10.configs.recommended.overrides[1].rules,
464
- // 'antfu/no-cjs-exports': OFF,
465
- // 'antfu/no-ts-export-equal': OFF,
466
- "import/no-unresolved": OFF,
467
647
  "no-alert": OFF,
468
648
  "no-console": OFF,
469
- "no-restricted-imports": OFF,
470
649
  "no-undef": OFF,
471
650
  "no-unused-expressions": OFF,
472
651
  "no-unused-vars": OFF,
473
652
  "node/prefer-global/process": OFF,
474
- "ts/comma-dangle": OFF,
653
+ "style/comma-dangle": OFF,
654
+ "style/eol-last": OFF,
475
655
  "ts/consistent-type-imports": OFF,
476
656
  "ts/no-namespace": OFF,
477
657
  "ts/no-redeclare": OFF,
@@ -479,535 +659,510 @@ function markdown(options = {}) {
479
659
  "ts/no-unused-vars": OFF,
480
660
  "ts/no-use-before-define": OFF,
481
661
  "ts/no-var-requires": OFF,
662
+ "unicode-bom": OFF,
482
663
  "unused-imports/no-unused-imports": OFF,
483
- "unused-imports/no-unused-vars": OFF
664
+ "unused-imports/no-unused-vars": OFF,
665
+ // Type aware rules
666
+ ...{
667
+ "ts/await-thenable": OFF,
668
+ "ts/dot-notation": OFF,
669
+ "ts/no-floating-promises": OFF,
670
+ "ts/no-for-in-array": OFF,
671
+ "ts/no-implied-eval": OFF,
672
+ "ts/no-misused-promises": OFF,
673
+ "ts/no-throw-literal": OFF,
674
+ "ts/no-unnecessary-type-assertion": OFF,
675
+ "ts/no-unsafe-argument": OFF,
676
+ "ts/no-unsafe-assignment": OFF,
677
+ "ts/no-unsafe-call": OFF,
678
+ "ts/no-unsafe-member-access": OFF,
679
+ "ts/no-unsafe-return": OFF,
680
+ "ts/restrict-plus-operands": OFF,
681
+ "ts/restrict-template-expressions": OFF,
682
+ "ts/unbound-method": OFF
683
+ },
684
+ "vinicunca/no-cjs-exports": OFF,
685
+ "vinicunca/no-ts-export-equal": OFF,
686
+ ...overrides
484
687
  }
485
688
  }
486
689
  ];
487
690
  }
488
691
 
489
692
  // src/configs/node.ts
490
- var node = [
491
- {
492
- plugins: {
493
- node: default11
494
- },
495
- rules: {
496
- "node/handle-callback-err": [ERROR, "^(err|error)$"],
497
- "node/no-callback-literal": OFF,
498
- "node/no-deprecated-api": ERROR,
499
- "node/no-exports-assign": ERROR,
500
- "node/no-new-require": ERROR,
501
- "node/no-path-concat": ERROR,
502
- "node/prefer-global/buffer": [ERROR, "never"],
503
- "node/prefer-global/process": [ERROR, "never"],
504
- "node/process-exit-as-throw": ERROR
693
+ function node() {
694
+ return [
695
+ {
696
+ name: "vinicunca:node",
697
+ plugins: {
698
+ node: default8
699
+ },
700
+ rules: {
701
+ "node/handle-callback-err": [ERROR, "^(err|error)$"],
702
+ "node/no-callback-literal": OFF,
703
+ "node/no-deprecated-api": ERROR,
704
+ "node/no-exports-assign": ERROR,
705
+ "node/no-new-require": ERROR,
706
+ "node/no-path-concat": ERROR,
707
+ "node/prefer-global/buffer": [ERROR, NEVER],
708
+ "node/prefer-global/process": [ERROR, NEVER],
709
+ "node/process-exit-as-throw": ERROR
710
+ }
505
711
  }
506
- }
507
- ];
712
+ ];
713
+ }
508
714
 
509
715
  // src/configs/react.ts
510
- var react = [
511
- {
512
- plugins: {
513
- "react": default15,
514
- "react-hooks": default16
515
- },
516
- settings: {
517
- react: {
518
- version: "detect"
716
+ function react(options = {}) {
717
+ const {
718
+ overrides = {}
719
+ } = options;
720
+ return [
721
+ {
722
+ name: "vinicunca:react:setup",
723
+ plugins: {
724
+ "react": default12,
725
+ "react-hooks": default13
519
726
  }
520
727
  },
521
- rules: {
522
- ...default15.configs.recommended.rules,
523
- ...default16.configs.recommended.rules,
524
- // Specify whether double or single quotes should be used in JSX attributes
525
- // https://eslint.org/docs/rules/jsx-quotes
526
- "jsx-quotes": ["error", "prefer-double"],
527
- // Enforce boolean attributes notation in JSX
528
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
529
- "react/jsx-boolean-value": ["error", "never", { always: [] }],
530
- // Validate closing bracket location in JSX
531
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
532
- "react/jsx-closing-bracket-location": ["error", "line-aligned"],
533
- // Validate closing tag location in JSX
534
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
535
- "react/jsx-closing-tag-location": "error",
536
- // Enforce or disallow spaces inside of curly braces in JSX attributes
537
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
538
- "react/jsx-curly-spacing": ["error", {
539
- when: "always",
540
- spacing: {
541
- objectLiterals: "never"
542
- },
543
- children: true
544
- }],
545
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
546
- "react/react-in-jsx-scope": "off",
547
- // Validate props indentation in JSX
548
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
549
- "react/jsx-indent-props": ["error", 2],
550
- // Validate JSX has key prop when in array or iterator
551
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
552
- // Turned off because it has too many false positives
553
- "react/jsx-key": "off",
554
- // Limit maximum of props on a single line in JSX
555
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
556
- "react/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
557
- // Prevent duplicate props in JSX
558
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
559
- "react/jsx-no-duplicate-props": ["error", { ignoreCase: true }],
560
- // Prevent usage of unwrapped JSX strings
561
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
562
- "react/jsx-no-literals": ["off", { noStrings: true }],
563
- // Disallow undeclared variables in JSX
564
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
565
- "react/jsx-no-undef": "error",
566
- // Enforce PascalCase for user-defined JSX components
567
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
568
- "react/jsx-pascal-case": ["error", {
569
- allowAllCaps: true,
570
- ignore: []
571
- }],
572
- // Enforce props alphabetical sorting
573
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
574
- "react/jsx-sort-props": ["off", {
575
- ignoreCase: true,
576
- callbacksLast: false,
577
- shorthandFirst: false,
578
- shorthandLast: false,
579
- noSortAlphabetically: false,
580
- reservedFirst: true
581
- }],
582
- // Enforce defaultProps declarations alphabetical sorting
583
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-sort-default-props.md
584
- "react/jsx-sort-default-props": ["off", {
585
- ignoreCase: true
586
- }],
587
- // Prevent usage of dangerous JSX properties
588
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md
589
- "react/no-danger": "warn",
590
- // Prevent extra closing tags for components without children
591
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
592
- "react/self-closing-comp": "error",
593
- // Prevent missing parentheses around multilines JSX
594
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-wrap-multilines.md
595
- "react/jsx-wrap-multilines": ["error", {
596
- declaration: "parens-new-line",
597
- assignment: "parens-new-line",
598
- return: "parens-new-line",
599
- arrow: "parens-new-line",
600
- condition: "parens-new-line",
601
- logical: "parens-new-line",
602
- prop: "parens-new-line"
603
- }],
604
- // Require that the first prop in a JSX element be on a new line when the element is multiline
605
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
606
- "react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
607
- // Enforce spacing around jsx equals signs
608
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
609
- "react/jsx-equals-spacing": ["error", "never"],
610
- // Enforce JSX indentation
611
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
612
- "react/jsx-indent": ["error", 2],
613
- // Require style prop value be an object or var
614
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
615
- "react/style-prop-object": "error",
616
- // Validate whitespace in and around the JSX opening and closing brackets
617
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md
618
- "react/jsx-tag-spacing": ["error", {
619
- closingSlash: "never",
620
- beforeSelfClosing: "always",
621
- afterOpening: "never",
622
- beforeClosing: "never"
623
- }],
624
- // Enforces consistent naming for boolean props
625
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/boolean-prop-naming.md
626
- "react/boolean-prop-naming": ["off", {
627
- propTypeNames: ["bool", "mutuallyExclusiveTrueProps"],
628
- rule: "^(is|has)[A-Z]([A-Za-z0-9]?)+",
629
- message: ""
630
- }],
631
- // Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
632
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
633
- "react/jsx-curly-brace-presence": ["error", { props: "never", children: "never" }],
634
- // One JSX Element Per Line
635
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-one-expression-per-line.md
636
- "react/jsx-one-expression-per-line": ["error", { allow: "single-child" }],
637
- // Enforce consistent usage of destructuring assignment of props, state, and context
638
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md
639
- "react/destructuring-assignment": ["error", "always"],
640
- // Ensures inline tags are not rendered without spaces between them
641
- "react/jsx-child-element-spacing": "off",
642
- // Validate JSX maximum depth
643
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/abe8381c0d6748047224c430ce47f02e40160ed0/docs/rules/jsx-max-depth.md
644
- "react/jsx-max-depth": "off",
645
- // Disallow multiple spaces between inline JSX props
646
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-props-no-multi-spaces.md
647
- "react/jsx-props-no-multi-spaces": "error",
648
- // Enforce linebreaks in curly braces in JSX attributes and expressions.
649
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
650
- "react/jsx-curly-newline": ["error", {
651
- multiline: "consistent",
652
- singleline: "consistent"
653
- }],
654
- // Enforce a new line after jsx elements and expressions
655
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-newline.md
656
- "react/jsx-newline": "error"
728
+ {
729
+ name: "vinicunca:react:rules",
730
+ settings: {
731
+ react: {
732
+ version: "detect"
733
+ }
734
+ },
735
+ rules: {
736
+ ...default12.configs.recommended.rules,
737
+ ...default13.configs.recommended.rules,
738
+ "style/jsx-quotes": [ERROR, "prefer-double"],
739
+ "react/jsx-boolean-value": [ERROR, NEVER, { always: [] }],
740
+ "react/jsx-closing-bracket-location": [ERROR, "line-aligned"],
741
+ "react/jsx-closing-tag-location": ERROR,
742
+ "react/jsx-curly-spacing": [ERROR, {
743
+ when: "always",
744
+ spacing: {
745
+ objectLiterals: NEVER
746
+ },
747
+ children: true
748
+ }],
749
+ "react/jsx-indent-props": [ERROR, 2],
750
+ "react/jsx-key": OFF,
751
+ "react/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
752
+ "react/jsx-no-duplicate-props": [ERROR, { ignoreCase: true }],
753
+ "react/jsx-no-literals": [OFF, { noStrings: true }],
754
+ "react/jsx-pascal-case": [ERROR, {
755
+ allowAllCaps: true,
756
+ ignore: []
757
+ }],
758
+ "react/jsx-sort-props": [OFF, {
759
+ ignoreCase: true,
760
+ callbacksLast: false,
761
+ shorthandFirst: false,
762
+ shorthandLast: false,
763
+ noSortAlphabetically: false,
764
+ reservedFirst: true
765
+ }],
766
+ "react/jsx-sort-default-props": [OFF, {
767
+ ignoreCase: true
768
+ }],
769
+ "react/no-danger": WARN,
770
+ "react/self-closing-comp": ERROR,
771
+ "react/jsx-wrap-multilines": [ERROR, {
772
+ declaration: "parens-new-line",
773
+ assignment: "parens-new-line",
774
+ return: "parens-new-line",
775
+ arrow: "parens-new-line",
776
+ condition: "parens-new-line",
777
+ logical: "parens-new-line",
778
+ prop: "parens-new-line"
779
+ }],
780
+ "react/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
781
+ "react/jsx-equals-spacing": [ERROR, NEVER],
782
+ "react/jsx-indent": [ERROR, 2],
783
+ "react/style-prop-object": ERROR,
784
+ "react/jsx-tag-spacing": [ERROR, {
785
+ closingSlash: NEVER,
786
+ beforeSelfClosing: "always",
787
+ afterOpening: NEVER,
788
+ beforeClosing: NEVER
789
+ }],
790
+ "react/boolean-prop-naming": [OFF, {
791
+ propTypeNames: ["bool", "mutuallyExclusiveTrueProps"],
792
+ rule: "^(is|has)[A-Z]([A-Za-z0-9]?)+",
793
+ message: ""
794
+ }],
795
+ "react/jsx-curly-brace-presence": [ERROR, { props: NEVER, children: NEVER }],
796
+ "react/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
797
+ "react/destructuring-assignment": [ERROR, "always"],
798
+ "react/jsx-child-element-spacing": OFF,
799
+ "react/jsx-max-depth": OFF,
800
+ "react/jsx-props-no-multi-spaces": ERROR,
801
+ "react/jsx-curly-newline": [ERROR, {
802
+ multiline: "consistent",
803
+ singleline: "consistent"
804
+ }],
805
+ "react/jsx-newline": ERROR,
806
+ ...overrides
807
+ }
657
808
  }
658
- }
659
- ];
809
+ ];
810
+ }
660
811
 
661
812
  // src/configs/sort-package-json.ts
662
- var sortPackageJson = [
663
- {
664
- files: ["**/package.json"],
665
- rules: {
666
- "jsonc/sort-array-values": [
667
- ERROR,
668
- {
669
- order: { type: "asc" },
670
- pathPattern: "^files$"
671
- }
672
- ],
673
- "jsonc/sort-keys": [
674
- ERROR,
675
- {
676
- order: [
677
- "publisher",
678
- "name",
679
- "displayName",
680
- "type",
681
- "version",
682
- "private",
683
- "packageManager",
684
- "description",
685
- "author",
686
- "license",
687
- "funding",
688
- "homepage",
689
- "repository",
690
- "bugs",
691
- "keywords",
692
- "categories",
693
- "sideEffects",
694
- "exports",
695
- "main",
696
- "module",
697
- "unpkg",
698
- "jsdelivr",
699
- "types",
700
- "typesVersions",
701
- "bin",
702
- "icon",
703
- "files",
704
- "engines",
705
- "activationEvents",
706
- "contributes",
707
- "scripts",
708
- "peerDependencies",
709
- "peerDependenciesMeta",
710
- "dependencies",
711
- "optionalDependencies",
712
- "devDependencies",
713
- "pnpm",
714
- "overrides",
715
- "resolutions",
716
- "husky",
717
- "simple-git-hooks",
718
- "lint-staged",
719
- "eslintConfig"
720
- ],
721
- pathPattern: "^$"
722
- },
723
- {
724
- order: { type: "asc" },
725
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
726
- },
727
- {
728
- order: { type: "asc" },
729
- pathPattern: "^resolutions$"
730
- },
731
- {
732
- order: { type: "asc" },
733
- pathPattern: "^pnpm.overrides$"
734
- },
735
- {
736
- order: [
737
- "types",
738
- "import",
739
- "require",
740
- "default"
741
- ],
742
- pathPattern: "^exports.*$"
743
- }
744
- ]
813
+ function sortPackageJson() {
814
+ return [
815
+ {
816
+ name: "vinicunca:sort-package-json",
817
+ files: ["**/package.json"],
818
+ rules: {
819
+ "jsonc/sort-array-values": [
820
+ ERROR,
821
+ {
822
+ order: { type: "asc" },
823
+ pathPattern: "^files$"
824
+ }
825
+ ],
826
+ "jsonc/sort-keys": [
827
+ ERROR,
828
+ {
829
+ order: [
830
+ "publisher",
831
+ "name",
832
+ "displayName",
833
+ "type",
834
+ "version",
835
+ "private",
836
+ "packageManager",
837
+ "description",
838
+ "author",
839
+ "license",
840
+ "funding",
841
+ "homepage",
842
+ "repository",
843
+ "bugs",
844
+ "keywords",
845
+ "categories",
846
+ "sideEffects",
847
+ "exports",
848
+ "main",
849
+ "module",
850
+ "unpkg",
851
+ "jsdelivr",
852
+ "types",
853
+ "typesVersions",
854
+ "bin",
855
+ "icon",
856
+ "files",
857
+ "engines",
858
+ "activationEvents",
859
+ "contributes",
860
+ "scripts",
861
+ "peerDependencies",
862
+ "peerDependenciesMeta",
863
+ "dependencies",
864
+ "optionalDependencies",
865
+ "devDependencies",
866
+ "pnpm",
867
+ "overrides",
868
+ "resolutions",
869
+ "husky",
870
+ "simple-git-hooks",
871
+ "lint-staged",
872
+ "eslintConfig"
873
+ ],
874
+ pathPattern: "^$"
875
+ },
876
+ {
877
+ order: { type: "asc" },
878
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
879
+ },
880
+ {
881
+ order: { type: "asc" },
882
+ pathPattern: "^resolutions$"
883
+ },
884
+ {
885
+ order: { type: "asc" },
886
+ pathPattern: "^pnpm.overrides$"
887
+ },
888
+ {
889
+ order: [
890
+ "types",
891
+ "import",
892
+ "require",
893
+ "default"
894
+ ],
895
+ pathPattern: "^exports.*$"
896
+ }
897
+ ]
898
+ }
745
899
  }
746
- }
747
- ];
748
- var sortTsconfig = [
749
- {
750
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
751
- rules: {
752
- "jsonc/sort-keys": [
753
- ERROR,
754
- {
755
- order: [
756
- "extends",
757
- "compilerOptions",
758
- "references",
759
- "files",
760
- "include",
761
- "exclude"
762
- ],
763
- pathPattern: "^$"
764
- },
765
- {
766
- order: [
767
- /* Projects */
768
- "incremental",
769
- "composite",
770
- "tsBuildInfoFile",
771
- "disableSourceOfProjectReferenceRedirect",
772
- "disableSolutionSearching",
773
- "disableReferencedProjectLoad",
774
- /* Language and Environment */
775
- "target",
776
- "lib",
777
- "jsx",
778
- "experimentalDecorators",
779
- "emitDecoratorMetadata",
780
- "jsxFactory",
781
- "jsxFragmentFactory",
782
- "jsxImportSource",
783
- "reactNamespace",
784
- "noLib",
785
- "useDefineForClassFields",
786
- "moduleDetection",
787
- /* Modules */
788
- "module",
789
- "rootDir",
790
- "moduleResolution",
791
- "baseUrl",
792
- "paths",
793
- "rootDirs",
794
- "typeRoots",
795
- "types",
796
- "allowUmdGlobalAccess",
797
- "moduleSuffixes",
798
- "allowImportingTsExtensions",
799
- "resolvePackageJsonExports",
800
- "resolvePackageJsonImports",
801
- "customConditions",
802
- "resolveJsonModule",
803
- "allowArbitraryExtensions",
804
- "noResolve",
805
- /* JavaScript Support */
806
- "allowJs",
807
- "checkJs",
808
- "maxNodeModuleJsDepth",
809
- /* Emit */
810
- "declaration",
811
- "declarationMap",
812
- "emitDeclarationOnly",
813
- "sourceMap",
814
- "inlineSourceMap",
815
- "outFile",
816
- "outDir",
817
- "removeComments",
818
- "noEmit",
819
- "importHelpers",
820
- "importsNotUsedAsValues",
821
- "downlevelIteration",
822
- "sourceRoot",
823
- "mapRoot",
824
- "inlineSources",
825
- "emitBOM",
826
- "newLine",
827
- "stripInternal",
828
- "noEmitHelpers",
829
- "noEmitOnError",
830
- "preserveConstEnums",
831
- "declarationDir",
832
- "preserveValueImports",
833
- /* Interop Constraints */
834
- "isolatedModules",
835
- "verbatimModuleSyntax",
836
- "allowSyntheticDefaultImports",
837
- "esModuleInterop",
838
- "preserveSymlinks",
839
- "forceConsistentCasingInFileNames",
840
- /* Type Checking */
841
- "strict",
842
- "strictBindCallApply",
843
- "strictFunctionTypes",
844
- "strictNullChecks",
845
- "strictPropertyInitialization",
846
- "allowUnreachableCode",
847
- "allowUnusedLabels",
848
- "alwaysStrict",
849
- "exactOptionalPropertyTypes",
850
- "noFallthroughCasesInSwitch",
851
- "noImplicitAny",
852
- "noImplicitOverride",
853
- "noImplicitReturns",
854
- "noImplicitThis",
855
- "noPropertyAccessFromIndexSignature",
856
- "noUncheckedIndexedAccess",
857
- "noUnusedLocals",
858
- "noUnusedParameters",
859
- "useUnknownInCatchVariables",
860
- /* Completeness */
861
- "skipDefaultLibCheck",
862
- "skipLibCheck"
863
- ],
864
- pathPattern: "^compilerOptions$"
865
- }
866
- ]
900
+ ];
901
+ }
902
+ function sortTsconfig() {
903
+ return [
904
+ {
905
+ name: "vinicunca:sort-tsconfig",
906
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
907
+ rules: {
908
+ "jsonc/sort-keys": [
909
+ ERROR,
910
+ {
911
+ order: [
912
+ "extends",
913
+ "compilerOptions",
914
+ "references",
915
+ "files",
916
+ "include",
917
+ "exclude"
918
+ ],
919
+ pathPattern: "^$"
920
+ },
921
+ {
922
+ order: [
923
+ /* Projects */
924
+ "incremental",
925
+ "composite",
926
+ "tsBuildInfoFile",
927
+ "disableSourceOfProjectReferenceRedirect",
928
+ "disableSolutionSearching",
929
+ "disableReferencedProjectLoad",
930
+ /* Language and Environment */
931
+ "target",
932
+ "jsx",
933
+ "jsxFactory",
934
+ "jsxFragmentFactory",
935
+ "jsxImportSource",
936
+ "lib",
937
+ "moduleDetection",
938
+ "noLib",
939
+ "reactNamespace",
940
+ "useDefineForClassFields",
941
+ "emitDecoratorMetadata",
942
+ "experimentalDecorators",
943
+ /* Modules */
944
+ "baseUrl",
945
+ "rootDir",
946
+ "rootDirs",
947
+ "customConditions",
948
+ "module",
949
+ "moduleResolution",
950
+ "moduleSuffixes",
951
+ "noResolve",
952
+ "paths",
953
+ "resolveJsonModule",
954
+ "resolvePackageJsonExports",
955
+ "resolvePackageJsonImports",
956
+ "typeRoots",
957
+ "types",
958
+ "allowArbitraryExtensions",
959
+ "allowImportingTsExtensions",
960
+ "allowUmdGlobalAccess",
961
+ /* JavaScript Support */
962
+ "allowJs",
963
+ "checkJs",
964
+ "maxNodeModuleJsDepth",
965
+ /* Type Checking */
966
+ "strict",
967
+ "strictBindCallApply",
968
+ "strictFunctionTypes",
969
+ "strictNullChecks",
970
+ "strictPropertyInitialization",
971
+ "allowUnreachableCode",
972
+ "allowUnusedLabels",
973
+ "alwaysStrict",
974
+ "exactOptionalPropertyTypes",
975
+ "noFallthroughCasesInSwitch",
976
+ "noImplicitAny",
977
+ "noImplicitOverride",
978
+ "noImplicitReturns",
979
+ "noImplicitThis",
980
+ "noPropertyAccessFromIndexSignature",
981
+ "noUncheckedIndexedAccess",
982
+ "noUnusedLocals",
983
+ "noUnusedParameters",
984
+ "useUnknownInCatchVariables",
985
+ /* Emit */
986
+ "declaration",
987
+ "declarationDir",
988
+ "declarationMap",
989
+ "downlevelIteration",
990
+ "emitBOM",
991
+ "emitDeclarationOnly",
992
+ "importHelpers",
993
+ "importsNotUsedAsValues",
994
+ "inlineSourceMap",
995
+ "inlineSources",
996
+ "mapRoot",
997
+ "newLine",
998
+ "noEmit",
999
+ "noEmitHelpers",
1000
+ "noEmitOnError",
1001
+ "outDir",
1002
+ "outFile",
1003
+ "preserveConstEnums",
1004
+ "preserveValueImports",
1005
+ "removeComments",
1006
+ "sourceMap",
1007
+ "sourceRoot",
1008
+ "stripInternal",
1009
+ /* Interop Constraints */
1010
+ "allowSyntheticDefaultImports",
1011
+ "esModuleInterop",
1012
+ "forceConsistentCasingInFileNames",
1013
+ "isolatedModules",
1014
+ "preserveSymlinks",
1015
+ "verbatimModuleSyntax",
1016
+ /* Completeness */
1017
+ "skipDefaultLibCheck",
1018
+ "skipLibCheck"
1019
+ ],
1020
+ pathPattern: "^compilerOptions$"
1021
+ }
1022
+ ]
1023
+ }
867
1024
  }
868
- }
869
- ];
1025
+ ];
1026
+ }
870
1027
 
871
1028
  // src/configs/stylistic.ts
872
- import { packages } from "@eslint-stylistic/metadata";
873
- var tsPackage = packages.find((i) => i.shortId === "ts");
874
- var javascriptStylistic = [
875
- {
876
- plugins: {
877
- style: default2
878
- },
879
- rules: {
880
- "comma-dangle": [ERROR, "always-multiline"],
881
- "style/array-bracket-newline": [ERROR, CONSISTENT],
882
- "style/array-bracket-spacing": [ERROR, NEVER],
883
- "style/array-element-newline": [ERROR, CONSISTENT],
884
- "style/arrow-spacing": [ERROR, { before: true, after: true }],
885
- "style/block-spacing": [ERROR, ALWAYS],
886
- "style/brace-style": [ERROR],
887
- "style/comma-spacing": [ERROR, { before: false, after: true }],
888
- "style/comma-style": [ERROR, "last"],
889
- "style/computed-property-spacing": [ERROR, NEVER, { enforceForClassMembers: true }],
890
- "style/dot-location": [ERROR, "property"],
891
- "style/func-call-spacing": [ERROR, NEVER],
892
- "style/indent": [ERROR, 2, {
893
- SwitchCase: 1,
894
- VariableDeclarator: 1,
895
- outerIIFEBody: 1,
896
- MemberExpression: 1,
897
- FunctionDeclaration: { parameters: 1, body: 1 },
898
- FunctionExpression: { parameters: 1, body: 1 },
899
- CallExpression: { arguments: 1 },
900
- ArrayExpression: 1,
901
- ObjectExpression: 1,
902
- ImportDeclaration: 1,
903
- flatTernaryExpressions: false,
904
- ignoreComments: false,
905
- ignoredNodes: ["TemplateLiteral *", "JSXElement", "JSXElement > *", "JSXAttribute", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", "JSXSpreadAttribute", "JSXExpressionContainer", "JSXOpeningElement", "JSXClosingElement", "JSXFragment", "JSXOpeningFragment", "JSXClosingFragment", "JSXText", "JSXEmptyExpression", "JSXSpreadChild"],
906
- offsetTernaryExpressions: true
907
- }],
908
- "style/key-spacing": [ERROR, { beforeColon: false, afterColon: true }],
909
- "style/keyword-spacing": [ERROR, { before: true, after: true }],
910
- "style/lines-between-class-members": [ERROR, ALWAYS, { exceptAfterSingleLine: true }],
911
- "style/multiline-ternary": [ERROR, "always-multiline"],
912
- "style/no-mixed-spaces-and-tabs": ERROR,
913
- "style/no-multi-spaces": ERROR,
914
- "style/no-multiple-empty-lines": [ERROR, { max: 1, maxBOF: 0, maxEOF: 1 }],
915
- "style/no-tabs": ERROR,
916
- "style/no-trailing-spaces": ERROR,
917
- "style/no-whitespace-before-property": ERROR,
918
- "style/object-curly-newline": [ERROR, { multiline: true, consistent: true }],
919
- "style/object-curly-spacing": [ERROR, ALWAYS],
920
- "style/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
921
- "style/operator-linebreak": [ERROR, "before"],
922
- "style/padded-blocks": [ERROR, { blocks: NEVER, switches: NEVER, classes: NEVER }],
923
- "style/rest-spread-spacing": [ERROR, NEVER],
924
- "style/semi-spacing": [ERROR, { before: false, after: true }],
925
- "style/space-before-blocks": [ERROR, ALWAYS],
926
- "style/space-before-function-paren": [ERROR, {
927
- anonymous: NEVER,
928
- named: NEVER,
929
- asyncArrow: ALWAYS
930
- }],
931
- "style/space-in-parens": [ERROR, NEVER],
932
- "style/space-infix-ops": ERROR,
933
- "style/space-unary-ops": [ERROR, { words: true, nonwords: false }],
934
- "style/spaced-comment": [ERROR, "always", {
935
- line: {
936
- markers: ["/"],
937
- exceptions: ["/", "#"]
938
- },
939
- block: {
940
- markers: ["!"],
941
- exceptions: ["*"],
942
- balanced: true
943
- }
944
- }],
945
- "style/template-curly-spacing": ERROR,
946
- "style/template-tag-spacing": [ERROR, NEVER],
947
- "style/yield-star-spacing": [ERROR, "both"]
948
- }
949
- }
950
- ];
951
- var typescriptStylistic = [
952
- {
953
- plugins: {
954
- "style-ts": default3,
955
- "ts": default4
956
- },
957
- rules: {
958
- ...stylisticJsToTS(javascriptStylistic[0].rules),
959
- "comma-dangle": OFF,
960
- "ts/comma-dangle": [ERROR, "always-multiline"],
961
- "quotes": OFF,
962
- "ts/quotes": [ERROR, "single"],
963
- "semi": OFF,
964
- "ts/semi": [ERROR, ALWAYS],
965
- "style-ts/member-delimiter-style": [ERROR],
966
- "style-ts/type-annotation-spacing": [ERROR, {}]
1029
+ function stylistic() {
1030
+ return [
1031
+ {
1032
+ name: "vinicunca:stylistic",
1033
+ plugins: {
1034
+ vinicunca: default3,
1035
+ style: default2
1036
+ },
1037
+ rules: {
1038
+ "curly": [ERROR, "all"],
1039
+ "style/array-bracket-newline": [ERROR, CONSISTENT],
1040
+ "style/array-bracket-spacing": [ERROR, NEVER],
1041
+ "style/array-element-newline": [ERROR, CONSISTENT],
1042
+ "style/arrow-spacing": [ERROR, { before: true, after: true }],
1043
+ "style/block-spacing": [ERROR, ALWAYS],
1044
+ "style/brace-style": [ERROR],
1045
+ "style/comma-spacing": [ERROR, { before: false, after: true }],
1046
+ "style/comma-style": [ERROR, "last"],
1047
+ "style/computed-property-spacing": [ERROR, NEVER, { enforceForClassMembers: true }],
1048
+ "style/dot-location": [ERROR, "property"],
1049
+ "style/eol-last": ERROR,
1050
+ "style/func-call-spacing": [ERROR, NEVER],
1051
+ "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
+ ArrayExpression: 1,
1060
+ ObjectExpression: 1,
1061
+ ImportDeclaration: 1,
1062
+ flatTernaryExpressions: false,
1063
+ ignoreComments: false,
1064
+ ignoredNodes: ["TemplateLiteral *", "JSXElement", "JSXElement > *", "JSXAttribute", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", "JSXSpreadAttribute", "JSXExpressionContainer", "JSXOpeningElement", "JSXClosingElement", "JSXFragment", "JSXOpeningFragment", "JSXClosingFragment", "JSXText", "JSXEmptyExpression", "JSXSpreadChild"],
1065
+ offsetTernaryExpressions: true
1066
+ }],
1067
+ "style/key-spacing": [ERROR, { beforeColon: false, afterColon: true }],
1068
+ "style/keyword-spacing": [ERROR, { before: true, after: true }],
1069
+ "style/lines-between-class-members": [ERROR, ALWAYS, { exceptAfterSingleLine: true }],
1070
+ "style/max-statements-per-line": [ERROR, { max: 1 }],
1071
+ "style/member-delimiter-style": [ERROR],
1072
+ "style/multiline-ternary": [ERROR, "always-multiline"],
1073
+ "style/new-parens": ERROR,
1074
+ "style/no-extra-parens": [ERROR, "functions"],
1075
+ "style/no-floating-decimal": ERROR,
1076
+ "style/no-mixed-operators": [ERROR, {
1077
+ groups: [
1078
+ ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
1079
+ ["&&", "||"],
1080
+ ["in", "instanceof"]
1081
+ ],
1082
+ allowSamePrecedence: true
1083
+ }],
1084
+ "style/no-mixed-spaces-and-tabs": ERROR,
1085
+ "style/no-multi-spaces": ERROR,
1086
+ "style/no-multiple-empty-lines": [ERROR, { max: 1, maxBOF: 0, maxEOF: 1 }],
1087
+ "style/no-tabs": ERROR,
1088
+ "style/no-trailing-spaces": ERROR,
1089
+ "style/no-whitespace-before-property": ERROR,
1090
+ "style/object-curly-newline": [ERROR, { multiline: true, consistent: true }],
1091
+ "style/object-curly-spacing": [ERROR, ALWAYS],
1092
+ "style/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
1093
+ "style/operator-linebreak": [ERROR, "before"],
1094
+ "style/padded-blocks": [ERROR, { blocks: NEVER, switches: NEVER, classes: NEVER }],
1095
+ "style/quote-props": [ERROR, "consistent-as-needed"],
1096
+ "style/quotes": [ERROR, "single"],
1097
+ "style/rest-spread-spacing": [ERROR, NEVER],
1098
+ "style/semi": [ERROR, ALWAYS],
1099
+ "style/semi-spacing": [ERROR, { before: false, after: true }],
1100
+ "style/space-before-blocks": [ERROR, ALWAYS],
1101
+ "style/space-before-function-paren": [ERROR, {
1102
+ anonymous: NEVER,
1103
+ named: NEVER,
1104
+ asyncArrow: ALWAYS
1105
+ }],
1106
+ "style/space-in-parens": [ERROR, NEVER],
1107
+ "style/space-infix-ops": ERROR,
1108
+ "style/space-unary-ops": [ERROR, { words: true, nonwords: false }],
1109
+ "style/spaced-comment": [ERROR, "always", {
1110
+ line: {
1111
+ markers: ["/"],
1112
+ exceptions: ["/", "#"]
1113
+ },
1114
+ block: {
1115
+ markers: ["!"],
1116
+ exceptions: ["*"],
1117
+ balanced: true
1118
+ }
1119
+ }],
1120
+ "style/template-curly-spacing": ERROR,
1121
+ "style/template-tag-spacing": [ERROR, NEVER],
1122
+ "style/type-annotation-spacing": [ERROR, {}],
1123
+ "style/wrap-iife": [ERROR, "any", {
1124
+ functionPrototypeMethods: true
1125
+ }],
1126
+ "style/yield-star-spacing": [ERROR, "both"],
1127
+ "style/comma-dangle": [ERROR, "always-multiline"],
1128
+ "vinicunca/consistent-list-newline": ERROR,
1129
+ "vinicunca/if-newline": ERROR,
1130
+ "vinicunca/top-level-function": ERROR
1131
+ }
967
1132
  }
968
- }
969
- ];
970
- function stylisticJsToTS(input) {
971
- return {
972
- // turn off all stylistic rules from style
973
- ...Object.fromEntries(
974
- Object.entries(input).map(([key]) => {
975
- if (!key.startsWith("style/")) {
976
- return null;
977
- }
978
- ;
979
- const basename = key.replace("style/", "");
980
- if (tsPackage.rules.find((i) => i.name === basename)) {
981
- return [key, OFF];
982
- }
983
- ;
984
- return null;
985
- }).filter(Boolean)
986
- ),
987
- // rename all stylistic rules from style to style/ts
988
- ...Object.fromEntries(
989
- Object.entries(input).map(([key, value]) => {
990
- if (!key.startsWith("style/")) {
991
- return null;
992
- }
993
- ;
994
- const basename = key.replace("style/", "");
995
- return tsPackage.rules.find((i) => i.name === basename) ? [`style-ts/${basename}`, value] : null;
996
- }).filter(Boolean)
997
- )
998
- };
1133
+ ];
999
1134
  }
1000
1135
 
1001
1136
  // src/configs/test.ts
1002
1137
  function test(options = {}) {
1138
+ const {
1139
+ isInEditor = false,
1140
+ overrides = {}
1141
+ } = options;
1003
1142
  return [
1004
1143
  {
1005
- files: GLOB_TESTS,
1144
+ name: "vinicunca:test:setup",
1006
1145
  plugins: {
1007
- "no-only-tests": default12
1008
- },
1146
+ test: {
1147
+ ...default15,
1148
+ rules: {
1149
+ ...default15.rules,
1150
+ // extend `test/no-only-tests` rule
1151
+ ...default9.rules
1152
+ }
1153
+ }
1154
+ }
1155
+ },
1156
+ {
1157
+ name: "vinicunca:test:rules",
1158
+ files: GLOB_TESTS,
1009
1159
  rules: {
1010
- "no-only-tests/no-only-tests": options.isInEditor ? OFF : ERROR
1160
+ "test/consistent-test-it": [ERROR, { fn: "it", withinDescribe: "it" }],
1161
+ "test/no-identical-title": ERROR,
1162
+ "test/no-only-tests": isInEditor ? OFF : ERROR,
1163
+ "test/prefer-hooks-in-order": ERROR,
1164
+ "test/prefer-lowercase-title": ERROR,
1165
+ ...overrides
1011
1166
  }
1012
1167
  }
1013
1168
  ];
@@ -1017,26 +1172,59 @@ function test(options = {}) {
1017
1172
  import process from "process";
1018
1173
  function typescript(options) {
1019
1174
  const {
1020
- componentExts = []
1175
+ componentExts = [],
1176
+ overrides = {},
1177
+ parserOptions = {},
1178
+ tsconfigPath
1021
1179
  } = options ?? {};
1180
+ const typeAwareRules = {
1181
+ "dot-notation": OFF,
1182
+ "no-implied-eval": OFF,
1183
+ "no-throw-literal": OFF,
1184
+ "ts/await-thenable": ERROR,
1185
+ "ts/dot-notation": [ERROR, { allowKeywords: true }],
1186
+ "ts/no-floating-promises": ERROR,
1187
+ "ts/no-for-in-array": ERROR,
1188
+ "ts/no-implied-eval": ERROR,
1189
+ "ts/no-misused-promises": ERROR,
1190
+ "ts/no-throw-literal": ERROR,
1191
+ "ts/no-unnecessary-type-assertion": ERROR,
1192
+ "ts/no-unsafe-argument": ERROR,
1193
+ "ts/no-unsafe-assignment": ERROR,
1194
+ "ts/no-unsafe-call": ERROR,
1195
+ "ts/no-unsafe-member-access": ERROR,
1196
+ "ts/no-unsafe-return": ERROR,
1197
+ "ts/restrict-plus-operands": ERROR,
1198
+ "ts/restrict-template-expressions": ERROR,
1199
+ "ts/unbound-method": ERROR
1200
+ };
1022
1201
  return [
1023
1202
  {
1203
+ // Install the plugins without globs, so they can be configured separately.
1204
+ name: "vinicunca:typescript:setup",
1205
+ plugins: {
1206
+ vinicunca: default3,
1207
+ import: pluginImport,
1208
+ ts: default4
1209
+ }
1210
+ },
1211
+ {
1212
+ name: "vinicunca:typescript:rules",
1024
1213
  files: [
1025
- GLOB_TS,
1026
- GLOB_TSX,
1214
+ GLOB_SRC,
1027
1215
  ...componentExts.map((ext) => `**/*.${ext}`)
1028
1216
  ],
1029
1217
  languageOptions: {
1030
- parser: default5,
1218
+ parser: parserTs,
1031
1219
  parserOptions: {
1032
- sourceType: "module"
1220
+ sourceType: "module",
1221
+ ...tsconfigPath ? {
1222
+ project: [tsconfigPath],
1223
+ tsconfigRootDir: process.cwd()
1224
+ } : {},
1225
+ ...parserOptions
1033
1226
  }
1034
1227
  },
1035
- plugins: {
1036
- // antfu: pluginAntfu,
1037
- import: default7,
1038
- ts: default4
1039
- },
1040
1228
  rules: {
1041
1229
  ...renameRules(
1042
1230
  default4.configs["eslint-recommended"].overrides[0].rules,
@@ -1050,8 +1238,6 @@ function typescript(options) {
1050
1238
  ),
1051
1239
  "no-dupe-class-members": OFF,
1052
1240
  "ts/no-dupe-class-members": ERROR,
1053
- "no-extra-parens": OFF,
1054
- "ts/no-extra-parens": [ERROR, "functions"],
1055
1241
  "no-invalid-this": OFF,
1056
1242
  "ts/no-invalid-this": ERROR,
1057
1243
  "no-loss-of-precision": OFF,
@@ -1062,8 +1248,7 @@ function typescript(options) {
1062
1248
  "ts/no-use-before-define": [ERROR, { functions: false, classes: false, variables: true }],
1063
1249
  "no-useless-constructor": OFF,
1064
1250
  "ts/ban-ts-comment": [ERROR, { "ts-ignore": "allow-with-description" }],
1065
- "ts/ban-ts-ignore": OFF,
1066
- "ts/consistent-indexed-object-style": OFF,
1251
+ "ts/ban-types": [ERROR, { types: { Function: false } }],
1067
1252
  "ts/consistent-type-definitions": [ERROR, "interface"],
1068
1253
  "ts/consistent-type-imports": [ERROR, { prefer: "type-imports", disallowTypeAnnotations: false }],
1069
1254
  "ts/explicit-function-return-type": OFF,
@@ -1084,10 +1269,19 @@ function typescript(options) {
1084
1269
  }],
1085
1270
  "ts/parameter-properties": OFF,
1086
1271
  "ts/prefer-ts-expect-error": ERROR,
1087
- "ts/triple-slash-reference": OFF
1272
+ "ts/triple-slash-reference": OFF,
1273
+ "vinicunca/generic-spacing": ERROR,
1274
+ "vinicunca/named-tuple-spacing": ERROR,
1275
+ "vinicunca/no-cjs-exports": ERROR,
1276
+ "vinicunca/no-const-enum": ERROR,
1277
+ "vinicunca/no-ts-export-equal": ERROR,
1278
+ "vinicunca/prefer-inline-type-import": ERROR,
1279
+ ...tsconfigPath ? typeAwareRules : {},
1280
+ ...overrides
1088
1281
  }
1089
1282
  },
1090
1283
  {
1284
+ name: "vinicunca:typescript:dts-overrides",
1091
1285
  files: ["**/*.d.ts"],
1092
1286
  rules: {
1093
1287
  "eslint-comments/no-unlimited-disable": OFF,
@@ -1096,12 +1290,14 @@ function typescript(options) {
1096
1290
  }
1097
1291
  },
1098
1292
  {
1293
+ name: "vinicunca:typescript:tests-overrides",
1099
1294
  files: ["**/*.{test,spec}.ts?(x)"],
1100
1295
  rules: {
1101
1296
  "no-unused-expressions": OFF
1102
1297
  }
1103
1298
  },
1104
1299
  {
1300
+ name: "vinicunca:typescript:javascript-overrides",
1105
1301
  files: ["**/*.js", "**/*.cjs"],
1106
1302
  rules: {
1107
1303
  "ts/no-require-imports": OFF,
@@ -1110,238 +1306,117 @@ function typescript(options) {
1110
1306
  }
1111
1307
  ];
1112
1308
  }
1113
- function typescriptWithLanguageServer(options) {
1309
+
1310
+ // src/configs/unicorn.ts
1311
+ function unicorn(options = {}) {
1114
1312
  const {
1115
- componentExts = [],
1116
- tsconfigPath,
1117
- tsconfigRootDir = process.cwd()
1313
+ overrides = {}
1118
1314
  } = options;
1119
1315
  return [
1120
1316
  {
1121
- files: [
1122
- GLOB_TS,
1123
- GLOB_TSX,
1124
- ...componentExts.map((ext) => `**/*.${ext}`)
1125
- ],
1126
- ignores: ["**/*.md/*.*"],
1127
- languageOptions: {
1128
- parser: default5,
1129
- parserOptions: {
1130
- project: [tsconfigPath],
1131
- tsconfigRootDir
1132
- }
1133
- },
1317
+ name: "vinicunca:unicorn",
1134
1318
  plugins: {
1135
- ts: default4
1319
+ unicorn: default10
1136
1320
  },
1137
1321
  rules: {
1138
- "dot-notation": OFF,
1139
- "ts/dot-notation": [ERROR, { allowKeywords: true }],
1140
- "no-implied-eval": OFF,
1141
- "ts/no-implied-eval": ERROR,
1142
- "no-throw-literal": OFF,
1143
- "ts/no-throw-literal": ERROR,
1144
- "require-await": OFF,
1145
- "ts/require-await": ERROR,
1146
- "ts/await-thenable": ERROR,
1147
- "ts/no-floating-promises": ERROR,
1148
- "ts/no-for-in-array": ERROR,
1149
- "ts/no-misused-promises": ERROR,
1150
- "ts/no-unnecessary-type-assertion": ERROR,
1151
- "ts/no-unsafe-argument": ERROR,
1152
- "ts/no-unsafe-assignment": ERROR,
1153
- "ts/no-unsafe-call": ERROR,
1154
- "ts/no-unsafe-member-access": ERROR,
1155
- "ts/no-unsafe-return": ERROR,
1156
- "ts/restrict-plus-operands": ERROR,
1157
- "ts/restrict-template-expressions": ERROR,
1158
- "ts/unbound-method": ERROR
1322
+ "unicorn/error-message": ERROR,
1323
+ "unicorn/escape-case": ERROR,
1324
+ "unicorn/no-instanceof-array": ERROR,
1325
+ "unicorn/no-new-array": ERROR,
1326
+ "unicorn/no-new-buffer": ERROR,
1327
+ "unicorn/number-literal-case": ERROR,
1328
+ "unicorn/prefer-includes": ERROR,
1329
+ "unicorn/prefer-node-protocol": ERROR,
1330
+ "unicorn/prefer-number-properties": ERROR,
1331
+ "unicorn/prefer-string-starts-ends-with": ERROR,
1332
+ "unicorn/prefer-dom-node-text-content": ERROR,
1333
+ "unicorn/prefer-type-error": ERROR,
1334
+ "unicorn/throw-new-error": ERROR,
1335
+ ...overrides
1159
1336
  }
1160
1337
  }
1161
1338
  ];
1162
1339
  }
1163
1340
 
1164
- // src/configs/unicorn.ts
1165
- var unicorn = [
1166
- {
1167
- plugins: {
1168
- unicorn: default13
1169
- },
1170
- rules: {
1171
- // Pass error message when throwing errors
1172
- "unicorn/error-message": ERROR,
1173
- // Uppercase regex escapes
1174
- "unicorn/escape-case": ERROR,
1175
- // Array.isArray instead of instanceof
1176
- "unicorn/no-instanceof-array": ERROR,
1177
- // Ban `new Array` as `Array` constructor's params are ambiguous
1178
- "unicorn/no-new-array": ERROR,
1179
- // Prevent deprecated `new Buffer()`
1180
- "unicorn/no-new-buffer": ERROR,
1181
- // Keep regex literals safe!
1182
- "unicorn/no-unsafe-regex": ERROR,
1183
- // Lowercase number formatting for octal, hex, binary (0x1ERROR instead of 0X1ERROR)
1184
- "unicorn/number-literal-case": ERROR,
1185
- // includes over indexOf when checking for existence
1186
- "unicorn/prefer-includes": ERROR,
1187
- // Prefer using the node: protocol
1188
- "unicorn/prefer-node-protocol": ERROR,
1189
- // Prefer using number properties like `Number.isNaN` rather than `isNaN`
1190
- "unicorn/prefer-number-properties": ERROR,
1191
- // String methods startsWith/endsWith instead of more complicated stuff
1192
- "unicorn/prefer-string-starts-ends-with": ERROR,
1193
- // textContent instead of innerText
1194
- "unicorn/prefer-text-content": ERROR,
1195
- // Enforce throwing type error when throwing error while checking typeof
1196
- "unicorn/prefer-type-error": ERROR,
1197
- // Use new when throwing error
1198
- "unicorn/throw-new-error": ERROR
1199
- }
1200
- }
1201
- ];
1202
-
1203
1341
  // src/configs/vue.ts
1204
1342
  function vue(options = {}) {
1343
+ const {
1344
+ overrides = {}
1345
+ } = options;
1205
1346
  return [
1206
1347
  {
1348
+ name: "vinicunca:vue:setup",
1349
+ plugins: {
1350
+ vue: default14
1351
+ }
1352
+ },
1353
+ {
1354
+ name: "vinicunca:vue:rules",
1207
1355
  files: [GLOB_VUE],
1208
1356
  languageOptions: {
1209
- parser: default20,
1357
+ parser: default17,
1210
1358
  parserOptions: {
1211
1359
  ecmaFeatures: {
1212
1360
  jsx: true
1213
1361
  },
1214
1362
  extraFileExtensions: [".vue"],
1215
- parser: options.typescript ? default5 : null,
1363
+ parser: options.typescript ? parserTs : null,
1216
1364
  sourceType: "module"
1217
1365
  }
1218
1366
  },
1219
- plugins: {
1220
- vue: default17
1221
- },
1222
- processor: default17.processors[".vue"],
1367
+ processor: default14.processors[".vue"],
1223
1368
  rules: {
1224
- ...default17.configs.base.rules,
1225
- ...default17.configs["vue3-essential"].rules,
1226
- ...default17.configs["vue3-strongly-recommended"].rules,
1227
- ...default17.configs["vue3-recommended"].rules,
1228
- "vue/array-bracket-spacing": [
1229
- ERROR,
1230
- NEVER
1231
- ],
1232
- "vue/arrow-spacing": [
1233
- ERROR,
1234
- {
1235
- after: true,
1236
- before: true
1237
- }
1238
- ],
1239
- "vue/block-order": [
1240
- ERROR,
1241
- {
1242
- order: [
1243
- "script",
1244
- "template",
1245
- "style"
1246
- ]
1247
- }
1248
- ],
1249
- "vue/block-spacing": [
1250
- ERROR,
1251
- ALWAYS
1252
- ],
1253
- "vue/block-tag-newline": [
1254
- ERROR,
1255
- {
1256
- multiline: ALWAYS,
1257
- singleline: ALWAYS
1258
- }
1259
- ],
1260
- "vue/brace-style": [
1261
- ERROR,
1262
- "stroustrup",
1263
- { allowSingleLine: true }
1264
- ],
1265
- "vue/comma-dangle": [
1266
- ERROR,
1267
- "always-multiline"
1268
- ],
1269
- "vue/comma-spacing": [
1270
- ERROR,
1271
- {
1272
- after: true,
1273
- before: false
1274
- }
1275
- ],
1276
- "vue/comma-style": [
1277
- ERROR,
1278
- "last"
1279
- ],
1280
- "vue/component-name-in-template-casing": [
1281
- ERROR,
1282
- "PascalCase"
1283
- ],
1284
- "vue/component-options-name-casing": [
1285
- ERROR,
1286
- "PascalCase"
1287
- ],
1288
- "vue/custom-event-name-casing": [
1289
- ERROR,
1290
- "camelCase"
1291
- ],
1292
- "vue/define-macros-order": [
1293
- ERROR,
1294
- {
1295
- order: [
1296
- "defineOptions",
1297
- "defineProps",
1298
- "defineEmits",
1299
- "defineSlots"
1300
- ]
1301
- }
1302
- ],
1303
- "vue/dot-location": [
1304
- ERROR,
1305
- "property"
1306
- ],
1307
- "vue/dot-notation": [
1308
- ERROR,
1309
- { allowKeywords: true }
1310
- ],
1311
- "vue/eqeqeq": [
1312
- ERROR,
1313
- "smart"
1314
- ],
1315
- "vue/html-comment-content-spacing": [
1316
- ERROR,
1317
- ALWAYS,
1318
- {
1319
- exceptions: ["-"]
1320
- }
1321
- ],
1322
- "vue/key-spacing": [
1323
- ERROR,
1324
- {
1325
- afterColon: true,
1326
- beforeColon: false
1327
- }
1328
- ],
1329
- "vue/keyword-spacing": [
1330
- ERROR,
1331
- {
1332
- after: true,
1333
- before: true
1334
- }
1335
- ],
1336
- "vue/max-attributes-per-line": OFF,
1369
+ ...default14.configs.base.rules,
1370
+ ...default14.configs["vue3-essential"].rules,
1371
+ ...default14.configs["vue3-strongly-recommended"].rules,
1372
+ ...default14.configs["vue3-recommended"].rules,
1373
+ "node/prefer-global/process": OFF,
1374
+ "vue/array-bracket-spacing": [ERROR, NEVER],
1375
+ "vue/arrow-spacing": [ERROR, {
1376
+ after: true,
1377
+ before: true
1378
+ }],
1379
+ "vue/block-order": [ERROR, {
1380
+ order: ["script", "template", "style"]
1381
+ }],
1382
+ "vue/block-spacing": [ERROR, ALWAYS],
1383
+ "vue/block-tag-newline": [ERROR, {
1384
+ multiline: ALWAYS,
1385
+ singleline: ALWAYS
1386
+ }],
1387
+ "vue/brace-style": [ERROR, "stroustrup", { allowSingleLine: true }],
1388
+ "vue/comma-dangle": [ERROR, "always-multiline"],
1389
+ "vue/comma-spacing": [ERROR, {
1390
+ after: true,
1391
+ before: false
1392
+ }],
1393
+ "vue/comma-style": [ERROR, "last"],
1394
+ "vue/component-name-in-template-casing": [ERROR, "PascalCase"],
1395
+ "vue/component-options-name-casing": [ERROR, "PascalCase"],
1396
+ "vue/custom-event-name-casing": [ERROR, "camelCase"],
1397
+ "vue/define-macros-order": [ERROR, {
1398
+ order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
1399
+ }],
1400
+ "vue/dot-location": [ERROR, "property"],
1401
+ "vue/dot-notation": [ERROR, { allowKeywords: true }],
1402
+ "vue/eqeqeq": [ERROR, "smart"],
1403
+ "vue/html-comment-content-spacing": [ERROR, ALWAYS, {
1404
+ exceptions: ["-"]
1405
+ }],
1406
+ "vue/key-spacing": [ERROR, {
1407
+ afterColon: true,
1408
+ beforeColon: false
1409
+ }],
1410
+ "vue/keyword-spacing": [ERROR, {
1411
+ after: true,
1412
+ before: true
1413
+ }],
1414
+ "vue/max-attributes-per-line": [ERROR],
1337
1415
  "vue/multi-word-component-names": OFF,
1338
1416
  "vue/no-constant-condition": WARN,
1339
1417
  "vue/no-dupe-keys": OFF,
1340
1418
  "vue/no-empty-pattern": ERROR,
1341
- "vue/no-extra-parens": [
1342
- ERROR,
1343
- "functions"
1344
- ],
1419
+ "vue/no-extra-parens": [ERROR, "functions"],
1345
1420
  "vue/no-irregular-whitespace": ERROR,
1346
1421
  "vue/no-loss-of-precision": ERROR,
1347
1422
  "vue/no-restricted-syntax": [
@@ -1350,149 +1425,173 @@ function vue(options = {}) {
1350
1425
  "LabeledStatement",
1351
1426
  "WithStatement"
1352
1427
  ],
1353
- "vue/no-restricted-v-bind": [
1354
- ERROR,
1355
- "/^v-/"
1356
- ],
1428
+ "vue/no-restricted-v-bind": [ERROR, "/^v-/"],
1357
1429
  // reactivity transform
1358
1430
  "vue/no-setup-props-reactivity-loss": OFF,
1359
1431
  "vue/no-sparse-arrays": ERROR,
1360
1432
  "vue/no-unused-refs": ERROR,
1361
1433
  "vue/no-useless-v-bind": ERROR,
1362
1434
  "vue/no-v-html": OFF,
1363
- "vue/no-v-text-v-html-on-component": "off",
1435
+ "vue/no-v-text-v-html-on-component": OFF,
1364
1436
  "vue/object-curly-newline": [ERROR, { multiline: true, consistent: true }],
1365
- "vue/object-curly-spacing": [
1366
- ERROR,
1367
- ALWAYS
1368
- ],
1369
- "vue/object-property-newline": [
1370
- ERROR,
1371
- { allowMultiplePropertiesPerLine: true }
1372
- ],
1373
- "vue/object-shorthand": [
1374
- ERROR,
1375
- ALWAYS,
1376
- {
1377
- avoidQuotes: true,
1378
- ignoreConstructors: false
1379
- }
1380
- ],
1381
- "vue/operator-linebreak": [
1382
- ERROR,
1383
- "before"
1384
- ],
1385
- "vue/padding-line-between-blocks": [
1386
- ERROR,
1387
- ALWAYS
1388
- ],
1437
+ "vue/object-curly-spacing": [ERROR, ALWAYS],
1438
+ "vue/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
1439
+ "vue/object-shorthand": [ERROR, ALWAYS, {
1440
+ avoidQuotes: true,
1441
+ ignoreConstructors: false
1442
+ }],
1443
+ "vue/operator-linebreak": [ERROR, "before"],
1444
+ "vue/padding-line-between-blocks": [ERROR, ALWAYS],
1389
1445
  "vue/prefer-import-from-vue": OFF,
1390
1446
  "vue/prefer-separate-static-class": ERROR,
1391
1447
  "vue/prefer-template": ERROR,
1392
- "vue/quote-props": [
1393
- ERROR,
1394
- "consistent-as-needed"
1395
- ],
1448
+ "vue/quote-props": [ERROR, "consistent-as-needed"],
1396
1449
  "vue/require-default-prop": OFF,
1397
1450
  "vue/require-prop-types": OFF,
1398
- "vue/space-in-parens": [
1399
- ERROR,
1400
- NEVER
1401
- ],
1451
+ "vue/space-in-parens": [ERROR, NEVER],
1402
1452
  "vue/space-infix-ops": ERROR,
1403
- "vue/space-unary-ops": [
1404
- ERROR,
1405
- {
1406
- nonwords: false,
1407
- words: true
1408
- }
1409
- ],
1410
- "vue/template-curly-spacing": ERROR
1453
+ "vue/space-unary-ops": [ERROR, {
1454
+ nonwords: false,
1455
+ words: true
1456
+ }],
1457
+ "vue/template-curly-spacing": ERROR,
1458
+ ...overrides
1411
1459
  }
1412
1460
  }
1413
1461
  ];
1414
1462
  }
1415
1463
 
1416
- // src/configs/yml.ts
1417
- var yml = [
1418
- {
1419
- files: [GLOB_YAML],
1420
- languageOptions: {
1421
- parser: default21
1422
- },
1423
- plugins: {
1424
- yml: default18
1464
+ // src/configs/yaml.ts
1465
+ function yaml(options = {}) {
1466
+ const {
1467
+ overrides = {}
1468
+ } = options;
1469
+ return [
1470
+ {
1471
+ name: "vinicunca:yaml:setup",
1472
+ plugins: {
1473
+ yaml: pluginYaml
1474
+ }
1425
1475
  },
1426
- rules: {
1427
- ...default18.configs.standard.rules,
1428
- "style/spaced-comment": OFF,
1429
- "yml/no-empty-document": OFF,
1430
- "yml/no-empty-mapping-value": OFF,
1431
- "yml/quotes": [ERROR, { avoidEscape: false, prefer: "single" }]
1476
+ {
1477
+ name: "vinicunca:yaml:rules",
1478
+ files: [GLOB_YAML],
1479
+ languageOptions: {
1480
+ parser: default18
1481
+ },
1482
+ rules: {
1483
+ "style/spaced-comment": OFF,
1484
+ "yaml/block-mapping": ERROR,
1485
+ "yaml/block-mapping-question-indicator-newline": ERROR,
1486
+ "yaml/block-sequence": ERROR,
1487
+ "yaml/block-sequence-hyphen-indicator-newline": ERROR,
1488
+ "yaml/flow-mapping-curly-newline": ERROR,
1489
+ "yaml/flow-mapping-curly-spacing": ERROR,
1490
+ "yaml/flow-sequence-bracket-newline": ERROR,
1491
+ "yaml/flow-sequence-bracket-spacing": ERROR,
1492
+ "yaml/indent": [ERROR, 2],
1493
+ "yaml/key-spacing": ERROR,
1494
+ "yaml/no-empty-key": ERROR,
1495
+ "yaml/no-empty-sequence-entry": ERROR,
1496
+ "yaml/no-irregular-whitespace": ERROR,
1497
+ "yaml/no-tab-indent": ERROR,
1498
+ "yaml/plain-scalar": ERROR,
1499
+ "yaml/quotes": [ERROR, { avoidEscape: false, prefer: "single" }],
1500
+ "yaml/spaced-comment": ERROR,
1501
+ "yaml/vue-custom-block/no-parsing-error": ERROR,
1502
+ ...overrides
1503
+ }
1432
1504
  }
1433
- }
1434
- ];
1505
+ ];
1506
+ }
1435
1507
 
1436
1508
  // src/base.ts
1437
- function vinicuncaESLint({ options = {}, userConfigs = [] }) {
1438
- const isInEditor = options.isInEditor ?? !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE) && !process2.env.CI);
1439
- const enableVue = options.vue ?? (isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli"));
1440
- const enableTypeScript = options.typescript ?? isPackageExists("typescript");
1441
- const enableStylistic = options.stylistic ?? true;
1442
- const configs = [
1443
- ignores,
1444
- javascript({ isInEditor }),
1445
- comments,
1446
- node,
1447
- jsdoc,
1448
- imports,
1449
- unicorn
1450
- ];
1451
- const componentExts = [];
1509
+ var VuePackages = [
1510
+ "vue",
1511
+ "nuxt",
1512
+ "vitepress",
1513
+ "@slidev/cli"
1514
+ ];
1515
+ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
1516
+ const {
1517
+ isInEditor = !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE) && !process2.env.CI),
1518
+ vue: enableVue = VuePackages.some((i) => isPackageExists(i)),
1519
+ typescript: enableTypeScript = isPackageExists("typescript"),
1520
+ stylistic: enableStylistic = true,
1521
+ test: enableTest = true,
1522
+ jsonc: enableJsonc = true,
1523
+ yaml: enableYaml = true,
1524
+ markdown: enableMarkdown = true,
1525
+ react: enableReact = false,
1526
+ overrides = {},
1527
+ componentExts = []
1528
+ } = options;
1529
+ const configs = [];
1530
+ configs.push(
1531
+ ignores(options.ignores),
1532
+ javascript({
1533
+ isInEditor,
1534
+ overrides: overrides.javascript
1535
+ }),
1536
+ comments(),
1537
+ node(),
1538
+ jsdoc(),
1539
+ imports(),
1540
+ unicorn()
1541
+ );
1452
1542
  if (enableVue) {
1453
1543
  componentExts.push("vue");
1454
1544
  }
1455
- if (enableStylistic) {
1456
- configs.push(javascriptStylistic);
1457
- }
1458
1545
  if (enableTypeScript) {
1459
- configs.push(typescript({ componentExts }));
1460
- if (!isBoolean(enableTypeScript)) {
1461
- configs.push(typescriptWithLanguageServer({
1462
- ...enableTypeScript,
1463
- componentExts
1464
- }));
1465
- }
1466
- if (enableStylistic) {
1467
- configs.push(typescriptStylistic);
1468
- }
1469
- ;
1546
+ configs.push(typescript({
1547
+ ...!isBoolean(enableTypeScript) ? enableTypeScript : {},
1548
+ componentExts,
1549
+ overrides: overrides.typescript
1550
+ }));
1551
+ }
1552
+ if (enableStylistic) {
1553
+ configs.push(stylistic());
1470
1554
  }
1471
- if (options.test ?? true) {
1472
- configs.push(test({ isInEditor }));
1555
+ if (enableTest) {
1556
+ configs.push(test({
1557
+ isInEditor,
1558
+ overrides: overrides.test
1559
+ }));
1473
1560
  }
1474
1561
  ;
1475
1562
  if (enableVue) {
1476
- configs.push(vue({ typescript: !!enableTypeScript }));
1563
+ configs.push(vue({
1564
+ typescript: !!enableTypeScript,
1565
+ overrides: overrides.vue
1566
+ }));
1477
1567
  }
1478
1568
  ;
1479
- if (options.jsonc ?? true) {
1569
+ if (enableJsonc) {
1480
1570
  configs.push(
1481
- jsonc,
1482
- sortPackageJson,
1483
- sortTsconfig
1571
+ jsonc({
1572
+ overrides: overrides.jsonc
1573
+ }),
1574
+ sortPackageJson(),
1575
+ sortTsconfig()
1484
1576
  );
1485
1577
  }
1486
- if (options.yaml ?? true) {
1487
- configs.push(yml);
1578
+ if (enableYaml) {
1579
+ configs.push(yaml({
1580
+ overrides: overrides.yaml
1581
+ }));
1488
1582
  }
1489
1583
  ;
1490
- if (options.markdown ?? true) {
1491
- configs.push(markdown({ componentExts }));
1584
+ if (enableMarkdown) {
1585
+ configs.push(markdown({
1586
+ componentExts,
1587
+ overrides: overrides.markdown
1588
+ }));
1492
1589
  }
1493
1590
  ;
1494
- if (options.react) {
1495
- configs.push(react);
1591
+ if (enableReact) {
1592
+ configs.push(react({
1593
+ overrides: overrides.react
1594
+ }));
1496
1595
  }
1497
1596
  return combineConfigs(
1498
1597
  ...configs,
@@ -1503,27 +1602,61 @@ function vinicuncaESLint({ options = {}, userConfigs = [] }) {
1503
1602
  // src/index.ts
1504
1603
  var src_default = vinicuncaESLint;
1505
1604
  export {
1605
+ GLOB_EXCLUDE,
1606
+ GLOB_JS,
1607
+ GLOB_JSON,
1608
+ GLOB_JSON5,
1609
+ GLOB_JSONC,
1610
+ GLOB_JSX,
1611
+ GLOB_MARKDOWN,
1612
+ GLOB_MARKDOWN_CODE,
1613
+ GLOB_SRC,
1614
+ GLOB_SRC_EXT,
1615
+ GLOB_TESTS,
1616
+ GLOB_TS,
1617
+ GLOB_TSX,
1618
+ GLOB_VUE,
1619
+ GLOB_YAML,
1506
1620
  combineConfigs,
1507
1621
  comments,
1508
1622
  src_default as default,
1509
1623
  ignores,
1510
1624
  imports,
1511
1625
  javascript,
1512
- javascriptStylistic,
1513
1626
  jsdoc,
1514
1627
  jsonc,
1515
1628
  markdown,
1516
1629
  node,
1630
+ default16 as parserJsonc,
1631
+ parserTs,
1632
+ default17 as parserVue,
1633
+ default18 as parserYaml,
1634
+ default5 as pluginComments,
1635
+ pluginImport,
1636
+ default6 as pluginJsdoc,
1637
+ pluginJsonc,
1638
+ default7 as pluginMarkdown,
1639
+ default9 as pluginNoOnlyTests,
1640
+ default8 as pluginNode,
1641
+ default12 as pluginReact,
1642
+ default13 as pluginReactHooks,
1643
+ default2 as pluginStylistic,
1644
+ default4 as pluginTs,
1645
+ default10 as pluginUnicorn,
1646
+ default11 as pluginUnusedImports,
1647
+ default3 as pluginVinicunca,
1648
+ default15 as pluginVitest,
1649
+ default14 as pluginVue,
1650
+ pluginYaml,
1517
1651
  react,
1518
1652
  renameRules,
1519
1653
  sortPackageJson,
1520
1654
  sortTsconfig,
1655
+ stylistic,
1521
1656
  test,
1522
1657
  typescript,
1523
- typescriptStylistic,
1524
- typescriptWithLanguageServer,
1525
1658
  unicorn,
1526
1659
  vinicuncaESLint,
1527
1660
  vue,
1528
- yml
1661
+ yaml
1529
1662
  };