@storm-software/eslint 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/typescript.cjs ADDED
@@ -0,0 +1,592 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/eslint/src/typescript.ts
20
+ var typescript_exports = {};
21
+ __export(typescript_exports, {
22
+ default: () => typescript_default
23
+ });
24
+ module.exports = __toCommonJS(typescript_exports);
25
+
26
+ // packages/eslint/src/constants.ts
27
+ var RESTRICTED_SYNTAX = [
28
+ {
29
+ // ❌ readFile(…, { encoding: … })
30
+ selector: "CallExpression[callee.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=1] Property[key.name=encoding]",
31
+ message: "Specify encoding as last argument instead of object with encoding key"
32
+ },
33
+ {
34
+ // ❌ readFile(…, {})
35
+ selector: "CallExpression[callee.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=0]",
36
+ message: "Specify encoding as last argument"
37
+ },
38
+ {
39
+ // ❌ readFileSync(…).toString(…)
40
+ selector: "CallExpression[callee.name=readFileSync][parent.property.name=toString]",
41
+ message: "toString is redundant, specify encoding as last argument"
42
+ },
43
+ {
44
+ // ❌ ….readFile(…, { encoding: … })
45
+ selector: "CallExpression[callee.type=MemberExpression][callee.property.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=1] Property[key.name=encoding]",
46
+ message: "Specify encoding as last argument instead of object with encoding key"
47
+ },
48
+ {
49
+ // ❌ ….readFile(…, {})
50
+ selector: "CallExpression[callee.type=MemberExpression][callee.property.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=0]",
51
+ message: "Specify encoding as last argument"
52
+ },
53
+ {
54
+ // ❌ Boolean(…)
55
+ selector: "CallExpression[callee.name=Boolean][arguments.1.elements.length!=0]",
56
+ message: "Prefer `!!\u2026` over `Boolean(\u2026)` because TypeScript infers a narrow literal boolean `type: true` instead of `type: boolean`."
57
+ },
58
+ {
59
+ // ❌ process.browser
60
+ selector: "ExpressionStatement[expression.object.name=process][expression.property.name=browser]",
61
+ message: "`process.browser` is deprecated, use `!!globalThis.window`"
62
+ }
63
+ // {
64
+ // // ❌ let { foo: { bar } } = baz
65
+ // // ✅ let { bar } = baz.foo
66
+ // // ✅ let { foo: { bar } } = await baz
67
+ // selector:
68
+ // 'VariableDeclarator[init.type!=AwaitExpression] > ObjectPattern[properties.length=1][properties.0.value.type=ObjectPattern]',
69
+ // message: 'Do not use nested destructuring.',
70
+ // },
71
+ ];
72
+ var REACT_RESTRICTED_SYNTAX = [
73
+ ...RESTRICTED_SYNTAX,
74
+ {
75
+ // ❌ useMemo(…, [])
76
+ selector: "CallExpression[callee.name=useMemo][arguments.1.type=ArrayExpression][arguments.1.elements.length=0]",
77
+ message: "`useMemo` with an empty dependency array can't provide a stable reference, use `useRef` instead."
78
+ }
79
+ ];
80
+ var RESTRICTED_GLOBALS = [
81
+ "stop",
82
+ { name: "isNaN", message: "Use Number.isNaN instead" }
83
+ ];
84
+ var RESTRICTED_MODULES = [
85
+ { name: "axios", message: "Use `fetch/node-fetch` instead." },
86
+ { name: "moment", message: "Use `dayjs/date-fns` instead." },
87
+ { name: "classnames", message: "Use `clsx` instead because it is faster." },
88
+ {
89
+ name: "lodash/isString.js",
90
+ message: "Use `typeof yourVar === 'string'` instead."
91
+ },
92
+ { name: "lodash/isArray.js", message: "Use `Array.isArray` instead." },
93
+ { name: "lodash/flatten.js", message: "Use `Array#flat()` instead." },
94
+ {
95
+ name: "lodash/compact.js",
96
+ message: "Use `Array#filter(Boolean)` instead."
97
+ },
98
+ { name: "lodash/identity.js", message: "Use `(value) => value` instead." }
99
+ ];
100
+
101
+ // packages/eslint/src/rules/import.ts
102
+ var config = {
103
+ /**
104
+ * Disallow non-import statements appearing before import statements.
105
+ *
106
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
107
+ */
108
+ "import/first": "error",
109
+ /**
110
+ * Require a newline after the last import/require.
111
+ *
112
+ * 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
113
+ */
114
+ "import/newline-after-import": "warn",
115
+ /**
116
+ * Disallow import of modules using absolute paths.
117
+ *
118
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-absolute-path.md
119
+ */
120
+ "import/no-absolute-path": "error",
121
+ /**
122
+ * Disallow cyclical dependencies between modules.
123
+ *
124
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md
125
+ */
126
+ "import/no-cycle": "error",
127
+ /**
128
+ * Disallow default exports.
129
+ *
130
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
131
+ */
132
+ "import/no-default-export": "error",
133
+ /**
134
+ * Disallow the use of extraneous packages.
135
+ *
136
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
137
+ */
138
+ "import/no-extraneous-dependencies": [
139
+ "error",
140
+ { includeInternal: true, includeTypes: true }
141
+ ],
142
+ /**
143
+ * Disallow mutable exports.
144
+ *
145
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-mutable-exports.md
146
+ */
147
+ "import/no-mutable-exports": "error",
148
+ /**
149
+ * Disallow importing packages through relative paths.
150
+ *
151
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-packages.md
152
+ */
153
+ "import/no-relative-packages": "warn",
154
+ /**
155
+ * Disallow a module from importing itself.
156
+ *
157
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-self-import.md
158
+ */
159
+ "import/no-self-import": "error",
160
+ /**
161
+ * Ensures that there are no useless path segments.
162
+ *
163
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md
164
+ */
165
+ "import/no-useless-path-segments": ["error"],
166
+ /**
167
+ * Enforce a module import order convention.
168
+ *
169
+ * 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
170
+ */
171
+ "import/order": [
172
+ "warn",
173
+ {
174
+ groups: [
175
+ "builtin",
176
+ // Node.js built-in modules
177
+ "external",
178
+ // Packages
179
+ "internal",
180
+ // Aliased modules
181
+ "parent",
182
+ // Relative parent
183
+ "sibling",
184
+ // Relative sibling
185
+ "index"
186
+ // Relative index
187
+ ],
188
+ "newlines-between": "never"
189
+ }
190
+ ]
191
+ };
192
+ var import_default = config;
193
+
194
+ // packages/eslint/src/rules/storm.ts
195
+ var config2 = {
196
+ /**
197
+ * Require return statements in array methods callbacks.
198
+ *
199
+ * 🚫 Not fixable -https://eslint.org/docs/rules/array-callback-return
200
+ */
201
+ "array-callback-return": ["error", { allowImplicit: true }],
202
+ /**
203
+ * Treat `var` statements as if they were block scoped.
204
+ *
205
+ * 🚫 Not fixable - https://eslint.org/docs/rules/block-scoped-var
206
+ */
207
+ "block-scoped-var": "error",
208
+ /**
209
+ * Require curly braces for multiline blocks.
210
+ *
211
+ * 🔧 Fixable - https://eslint.org/docs/rules/curly
212
+ */
213
+ curly: ["warn", "multi-line"],
214
+ /**
215
+ * Require default clauses in switch statements to be last (if used).
216
+ *
217
+ * 🚫 Not fixable - https://eslint.org/docs/rules/default-case-last
218
+ */
219
+ "default-case-last": "error",
220
+ /**
221
+ * Require triple equals (`===` and `!==`).
222
+ *
223
+ * 🔧 Fixable - https://eslint.org/docs/rules/eqeqeq
224
+ */
225
+ eqeqeq: "error",
226
+ /**
227
+ * Require grouped accessor pairs in object literals and classes.
228
+ *
229
+ * 🚫 Not fixable - https://eslint.org/docs/rules/grouped-accessor-pairs
230
+ */
231
+ "grouped-accessor-pairs": "error",
232
+ /**
233
+ * Disallow use of `alert()`.
234
+ *
235
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-alert
236
+ */
237
+ "no-alert": "error",
238
+ /**
239
+ * Disallow use of `caller`/`callee`.
240
+ *
241
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-caller
242
+ */
243
+ "no-caller": "error",
244
+ /**
245
+ * Disallow returning value in constructor.
246
+ *
247
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-constructor-return
248
+ */
249
+ "no-constructor-return": "error",
250
+ /**
251
+ * Disallow using an `else` if the `if` block contains a return.
252
+ *
253
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-else-return
254
+ */
255
+ "no-else-return": "warn",
256
+ /**
257
+ * Disallow `eval()`.
258
+ *
259
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-eval
260
+ */
261
+ "no-eval": "error",
262
+ /**
263
+ * Disallow extending native objects.
264
+ *
265
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-extend-native
266
+ */
267
+ "no-extend-native": "error",
268
+ /**
269
+ * Disallow unnecessary function binding.
270
+ *
271
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-extra-bind
272
+ */
273
+ "no-extra-bind": "error",
274
+ /**
275
+ * Disallow unnecessary labels.
276
+ *
277
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-extra-label
278
+ */
279
+ "no-extra-label": "error",
280
+ /**
281
+ * Disallow floating decimals.
282
+ *
283
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-floating-decimal
284
+ */
285
+ "no-floating-decimal": "error",
286
+ /**
287
+ * Make people convert types explicitly e.g. `Boolean(foo)` instead of `!!foo`.
288
+ *
289
+ * 🔧 Partially Fixable - https://eslint.org/docs/rules/no-implicit-coercion
290
+ */
291
+ "no-implicit-coercion": "error",
292
+ /**
293
+ * Disallow use of `eval()`-like methods.
294
+ *
295
+ * https://eslint.org/docs/rules/no-implied-eval
296
+ */
297
+ "no-implied-eval": "error",
298
+ /**
299
+ * Disallow usage of `__iterator__` property.
300
+ *
301
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-iterator
302
+ */
303
+ "no-iterator": "error",
304
+ /**
305
+ * Disallow use of labels for anything other than loops and switches.
306
+ *
307
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-labels
308
+ */
309
+ "no-labels": ["error"],
310
+ /**
311
+ * Disallow unnecessary nested blocks.
312
+ *
313
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-lone-blocks
314
+ */
315
+ "no-lone-blocks": "error",
316
+ /**
317
+ * Disallow `new` for side effects.
318
+ *
319
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-new
320
+ */
321
+ "no-new": "error",
322
+ /**
323
+ * Disallow function constructors.
324
+ *
325
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-new-func
326
+ */
327
+ "no-new-func": "error",
328
+ /**
329
+ * Disallow base types wrapper instances, such as `new String('foo')`.
330
+ *
331
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-new-wrappers
332
+ */
333
+ "no-new-wrappers": "error",
334
+ /**
335
+ * Disallow use of octal escape sequences in string literals.
336
+ *
337
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-octal-escape
338
+ */
339
+ "no-octal-escape": "error",
340
+ /**
341
+ * Disallow reassignment of function parameters.
342
+ *
343
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-param-reassign
344
+ */
345
+ "no-param-reassign": "error",
346
+ /**
347
+ * Disallow usage of the deprecated `__proto__` property.
348
+ *
349
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-proto
350
+ */
351
+ "no-proto": "error",
352
+ /**
353
+ * Disallow assignment in `return` statement.
354
+ *
355
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-return-assign
356
+ */
357
+ "no-return-assign": "error",
358
+ /**
359
+ * Disallows unnecessary `return await`.
360
+ *
361
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-return-await
362
+ */
363
+ "no-return-await": "error",
364
+ /**
365
+ * Disallow use of `javascript:` urls.
366
+ *
367
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-script-url
368
+ */
369
+ "no-script-url": "error",
370
+ /**
371
+ * Disallow comparisons where both sides are exactly the same.
372
+ *
373
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-self-compare
374
+ */
375
+ "no-self-compare": "error",
376
+ /**
377
+ * Disallow use of comma operator.
378
+ *
379
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-sequences
380
+ */
381
+ "no-sequences": "error",
382
+ /**
383
+ * Disallow unnecessary `.call()` and `.apply()`.
384
+ *
385
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-call
386
+ */
387
+ "no-useless-call": "error",
388
+ /**
389
+ * Disallow unnecessary concatenation of strings.
390
+ *
391
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-concat
392
+ */
393
+ "no-useless-concat": "error",
394
+ /**
395
+ * Disallow redundant return statements.
396
+ *
397
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-useless-return
398
+ */
399
+ "no-useless-return": "warn",
400
+ /**
401
+ * Require using named capture groups in regular expressions.
402
+ *
403
+ * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-named-capture-group
404
+ */
405
+ "prefer-named-capture-group": "error",
406
+ /**
407
+ * Require using Error objects as Promise rejection reasons.
408
+ *
409
+ * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-promise-reject-errors
410
+ */
411
+ "prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
412
+ /**
413
+ * Disallow use of the RegExp constructor in favor of regular expression
414
+ * literals.
415
+ *
416
+ * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-regex-literals
417
+ */
418
+ "prefer-regex-literals": "error",
419
+ /**
420
+ * Disallow "Yoda conditions", ensuring the comparison.
421
+ *
422
+ * 🔧 Fixable - https://eslint.org/docs/rules/yoda
423
+ */
424
+ yoda: "warn"
425
+ };
426
+ var storm_default = config2;
427
+
428
+ // packages/eslint/src/rules/ts-docs.ts
429
+ var config3 = {
430
+ /**
431
+ * Require TSDoc comments conform to the TSDoc specification.
432
+ *
433
+ * 🚫 Not fixable - https://github.com/microsoft/tsdoc/tree/master/eslint-plugin
434
+ */
435
+ "tsdoc/syntax": "error"
436
+ };
437
+ var ts_docs_default = config3;
438
+
439
+ // packages/eslint/src/rules/unicorn.ts
440
+ var config4 = {
441
+ /**
442
+ * Require consistent filename case for all linted files.
443
+ *
444
+ * 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
445
+ */
446
+ "unicorn/filename-case": [
447
+ "error",
448
+ {
449
+ case: "kebabCase"
450
+ }
451
+ ],
452
+ /**
453
+ * Require using the `node:` protocol when importing Node.js built-in modules.
454
+ *
455
+ * 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
456
+ */
457
+ "unicorn/prefer-node-protocol": "warn"
458
+ };
459
+ var unicorn_default = config4;
460
+
461
+ // packages/eslint/src/typescript.ts
462
+ var config5 = {
463
+ root: true,
464
+ overrides: [
465
+ {
466
+ files: ["*.ts", "*.tsx"],
467
+ extends: ["plugin:@nx/typescript"],
468
+ rules: {}
469
+ }
470
+ ],
471
+ parser: "@typescript-eslint/parser",
472
+ extends: [
473
+ "eslint:recommended",
474
+ "plugin:@typescript-eslint/recommended",
475
+ "prettier"
476
+ ],
477
+ plugins: ["sonarjs", "unicorn", "promise", "import", "eslint-plugin-tsdoc"],
478
+ rules: {
479
+ // Disallows if statements as the only statement in else blocks
480
+ // https://eslint.org/docs/rules/no-lonely-if
481
+ "no-lonely-if": "error",
482
+ // Disallows the use of console
483
+ // https://eslint.org/docs/rules/no-console
484
+ "no-console": "error",
485
+ // Requires method and property shorthand syntax for object literals
486
+ // https://eslint.org/docs/rules/object-shorthand
487
+ "object-shorthand": ["error", "always"],
488
+ // Disallows loops with a body that allows only one iteration
489
+ // https://eslint.org/docs/rules/no-unreachable-loop
490
+ "no-unreachable-loop": "error",
491
+ "sonarjs/no-one-iteration-loop": "off",
492
+ // similar to 'no-unreachable-loop' but reports less cases
493
+ "prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
494
+ "sonarjs/no-unused-collection": "error",
495
+ "sonarjs/no-identical-conditions": "error",
496
+ "sonarjs/no-inverted-boolean-check": "error",
497
+ "sonarjs/no-use-of-empty-return-value": "error",
498
+ "sonarjs/no-gratuitous-expressions": "error",
499
+ "sonarjs/no-nested-switch": "error",
500
+ "unicorn/no-lonely-if": "error",
501
+ "sonarjs/no-collapsible-if": "off",
502
+ // same as 'unicorn/no-lonely-if'
503
+ "unicorn/no-array-push-push": "error",
504
+ "unicorn/no-instanceof-array": "error",
505
+ "unicorn/no-empty-file": "error",
506
+ "unicorn/no-useless-fallback-in-spread": "error",
507
+ "unicorn/prefer-array-find": "error",
508
+ "unicorn/no-useless-spread": "error",
509
+ "unicorn/prefer-includes": "error",
510
+ // Disallows specified syntax
511
+ // https://eslint.org/docs/rules/no-restricted-syntax
512
+ "no-restricted-syntax": ["error", ...RESTRICTED_SYNTAX],
513
+ "no-else-return": ["error", { allowElseIf: false }],
514
+ "promise/no-nesting": "error",
515
+ "import/extensions": ["error", "ignorePackages"],
516
+ // Bob when bundling requires to have `.js` extension
517
+ "import/no-default-export": "error",
518
+ "import/prefer-default-export": "off",
519
+ // disable opposite of 'import/no-default-export'
520
+ "unicorn/filename-case": "error",
521
+ "@typescript-eslint/no-unused-vars": [
522
+ "error",
523
+ {
524
+ argsIgnorePattern: "^_",
525
+ varsIgnorePattern: "^_"
526
+ // allow underscores in destructuring
527
+ }
528
+ ],
529
+ // Enforce the style of numeric separators by correctly grouping digits
530
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/numeric-separators-style.md
531
+ "unicorn/numeric-separators-style": "error",
532
+ // Prefer using the node: protocol when importing Node.js builtin modules
533
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
534
+ "unicorn/prefer-node-protocol": "error",
535
+ // Reports any imports that come after non-import statements
536
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
537
+ "import/first": "error",
538
+ // Disallow shorthand type conversions
539
+ // https://eslint.org/docs/latest/rules/no-implicit-coercion
540
+ "no-implicit-coercion": [
541
+ "error",
542
+ {
543
+ disallowTemplateShorthand: true,
544
+ // in TypeScript `!!` is preferable https://www.typescriptlang.org/docs/handbook/2/narrowing.html#truthiness-narrowing
545
+ boolean: false
546
+ }
547
+ ],
548
+ // Disallow specified modules when loaded by `import` declarations
549
+ // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-import.md
550
+ "n/no-restricted-import": ["error", RESTRICTED_MODULES],
551
+ // Disallow specified modules when loaded by require
552
+ // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-require.md
553
+ "n/no-restricted-require": ["error", RESTRICTED_MODULES],
554
+ "no-restricted-modules": "off",
555
+ // deprecated in favor of corresponding rules from `eslint-plugin-n`
556
+ // Disallow specified global variables
557
+ // https://eslint.org/docs/latest/rules/no-restricted-globals
558
+ "no-restricted-globals": ["error", ...RESTRICTED_GLOBALS],
559
+ "@typescript-eslint/no-explicit-any": "error",
560
+ "prefer-const": ["error", { destructuring: "all" }],
561
+ "import/no-duplicates": "error",
562
+ "import/newline-after-import": "off",
563
+ // prettified by prettier-plugin-sort-imports
564
+ "prefer-object-has-own": "error",
565
+ "logical-assignment-operators": [
566
+ "error",
567
+ "always",
568
+ { enforceForIfStatements: true }
569
+ ],
570
+ "@typescript-eslint/prefer-optional-chain": "error",
571
+ yoda: "error",
572
+ "unicorn/prefer-export-from": ["error", { ignoreUsedVariables: true }],
573
+ "promise/no-multiple-resolved": "error",
574
+ "unicorn/prefer-logical-operator-over-ternary": "error",
575
+ "no-unused-expressions": "off",
576
+ "@typescript-eslint/no-unused-expressions": "error",
577
+ "no-negated-condition": "off",
578
+ "unicorn/no-negated-condition": "error",
579
+ "unicorn/no-array-for-each": "error",
580
+ "unicorn/prefer-string-trim-start-end": "error",
581
+ "no-self-compare": "error",
582
+ eqeqeq: ["error", "always", { null: "ignore" }],
583
+ "import/no-useless-path-segments": "error",
584
+ "require-await": "off",
585
+ "no-return-await": "off",
586
+ ...import_default,
587
+ ...unicorn_default,
588
+ ...ts_docs_default,
589
+ ...storm_default
590
+ }
591
+ };
592
+ var typescript_default = config5;
package/yml.cjs ADDED
@@ -0,0 +1,97 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/eslint/src/yml.ts
20
+ var yml_exports = {};
21
+ __export(yml_exports, {
22
+ default: () => yml_default
23
+ });
24
+ module.exports = __toCommonJS(yml_exports);
25
+
26
+ // packages/eslint/src/constants.ts
27
+ var RESTRICTED_SYNTAX = [
28
+ {
29
+ // ❌ readFile(…, { encoding: … })
30
+ selector: "CallExpression[callee.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=1] Property[key.name=encoding]",
31
+ message: "Specify encoding as last argument instead of object with encoding key"
32
+ },
33
+ {
34
+ // ❌ readFile(…, {})
35
+ selector: "CallExpression[callee.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=0]",
36
+ message: "Specify encoding as last argument"
37
+ },
38
+ {
39
+ // ❌ readFileSync(…).toString(…)
40
+ selector: "CallExpression[callee.name=readFileSync][parent.property.name=toString]",
41
+ message: "toString is redundant, specify encoding as last argument"
42
+ },
43
+ {
44
+ // ❌ ….readFile(…, { encoding: … })
45
+ selector: "CallExpression[callee.type=MemberExpression][callee.property.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=1] Property[key.name=encoding]",
46
+ message: "Specify encoding as last argument instead of object with encoding key"
47
+ },
48
+ {
49
+ // ❌ ….readFile(…, {})
50
+ selector: "CallExpression[callee.type=MemberExpression][callee.property.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=0]",
51
+ message: "Specify encoding as last argument"
52
+ },
53
+ {
54
+ // ❌ Boolean(…)
55
+ selector: "CallExpression[callee.name=Boolean][arguments.1.elements.length!=0]",
56
+ message: "Prefer `!!\u2026` over `Boolean(\u2026)` because TypeScript infers a narrow literal boolean `type: true` instead of `type: boolean`."
57
+ },
58
+ {
59
+ // ❌ process.browser
60
+ selector: "ExpressionStatement[expression.object.name=process][expression.property.name=browser]",
61
+ message: "`process.browser` is deprecated, use `!!globalThis.window`"
62
+ }
63
+ // {
64
+ // // ❌ let { foo: { bar } } = baz
65
+ // // ✅ let { bar } = baz.foo
66
+ // // ✅ let { foo: { bar } } = await baz
67
+ // selector:
68
+ // 'VariableDeclarator[init.type!=AwaitExpression] > ObjectPattern[properties.length=1][properties.0.value.type=ObjectPattern]',
69
+ // message: 'Do not use nested destructuring.',
70
+ // },
71
+ ];
72
+ var REACT_RESTRICTED_SYNTAX = [
73
+ ...RESTRICTED_SYNTAX,
74
+ {
75
+ // ❌ useMemo(…, [])
76
+ selector: "CallExpression[callee.name=useMemo][arguments.1.type=ArrayExpression][arguments.1.elements.length=0]",
77
+ message: "`useMemo` with an empty dependency array can't provide a stable reference, use `useRef` instead."
78
+ }
79
+ ];
80
+ var CODE_BLOCK = "**/*.md{,x}/*";
81
+
82
+ // packages/eslint/src/yml.ts
83
+ var config = {
84
+ ignorePatterns: ["pnpm-lock.yaml"],
85
+ overrides: [
86
+ {
87
+ files: "*.y{,a}ml",
88
+ excludedFiles: [CODE_BLOCK, ".github/FUNDING.yml"],
89
+ extends: ["plugin:yml/standard", "plugin:yml/prettier"],
90
+ plugins: ["unicorn"],
91
+ rules: {
92
+ "unicorn/filename-case": "error"
93
+ }
94
+ }
95
+ ]
96
+ };
97
+ var yml_default = config;