@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/javascript.cjs ADDED
@@ -0,0 +1,390 @@
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/javascript.ts
20
+ var javascript_exports = {};
21
+ __export(javascript_exports, {
22
+ default: () => javascript_default
23
+ });
24
+ module.exports = __toCommonJS(javascript_exports);
25
+
26
+ // packages/eslint/src/rules/import.ts
27
+ var config = {
28
+ /**
29
+ * Disallow non-import statements appearing before import statements.
30
+ *
31
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
32
+ */
33
+ "import/first": "error",
34
+ /**
35
+ * Require a newline after the last import/require.
36
+ *
37
+ * 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
38
+ */
39
+ "import/newline-after-import": "warn",
40
+ /**
41
+ * Disallow import of modules using absolute paths.
42
+ *
43
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-absolute-path.md
44
+ */
45
+ "import/no-absolute-path": "error",
46
+ /**
47
+ * Disallow cyclical dependencies between modules.
48
+ *
49
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md
50
+ */
51
+ "import/no-cycle": "error",
52
+ /**
53
+ * Disallow default exports.
54
+ *
55
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
56
+ */
57
+ "import/no-default-export": "error",
58
+ /**
59
+ * Disallow the use of extraneous packages.
60
+ *
61
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
62
+ */
63
+ "import/no-extraneous-dependencies": [
64
+ "error",
65
+ { includeInternal: true, includeTypes: true }
66
+ ],
67
+ /**
68
+ * Disallow mutable exports.
69
+ *
70
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-mutable-exports.md
71
+ */
72
+ "import/no-mutable-exports": "error",
73
+ /**
74
+ * Disallow importing packages through relative paths.
75
+ *
76
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-packages.md
77
+ */
78
+ "import/no-relative-packages": "warn",
79
+ /**
80
+ * Disallow a module from importing itself.
81
+ *
82
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-self-import.md
83
+ */
84
+ "import/no-self-import": "error",
85
+ /**
86
+ * Ensures that there are no useless path segments.
87
+ *
88
+ * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md
89
+ */
90
+ "import/no-useless-path-segments": ["error"],
91
+ /**
92
+ * Enforce a module import order convention.
93
+ *
94
+ * 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
95
+ */
96
+ "import/order": [
97
+ "warn",
98
+ {
99
+ groups: [
100
+ "builtin",
101
+ // Node.js built-in modules
102
+ "external",
103
+ // Packages
104
+ "internal",
105
+ // Aliased modules
106
+ "parent",
107
+ // Relative parent
108
+ "sibling",
109
+ // Relative sibling
110
+ "index"
111
+ // Relative index
112
+ ],
113
+ "newlines-between": "never"
114
+ }
115
+ ]
116
+ };
117
+ var import_default = config;
118
+
119
+ // packages/eslint/src/rules/storm.ts
120
+ var config2 = {
121
+ /**
122
+ * Require return statements in array methods callbacks.
123
+ *
124
+ * 🚫 Not fixable -https://eslint.org/docs/rules/array-callback-return
125
+ */
126
+ "array-callback-return": ["error", { allowImplicit: true }],
127
+ /**
128
+ * Treat `var` statements as if they were block scoped.
129
+ *
130
+ * 🚫 Not fixable - https://eslint.org/docs/rules/block-scoped-var
131
+ */
132
+ "block-scoped-var": "error",
133
+ /**
134
+ * Require curly braces for multiline blocks.
135
+ *
136
+ * 🔧 Fixable - https://eslint.org/docs/rules/curly
137
+ */
138
+ curly: ["warn", "multi-line"],
139
+ /**
140
+ * Require default clauses in switch statements to be last (if used).
141
+ *
142
+ * 🚫 Not fixable - https://eslint.org/docs/rules/default-case-last
143
+ */
144
+ "default-case-last": "error",
145
+ /**
146
+ * Require triple equals (`===` and `!==`).
147
+ *
148
+ * 🔧 Fixable - https://eslint.org/docs/rules/eqeqeq
149
+ */
150
+ eqeqeq: "error",
151
+ /**
152
+ * Require grouped accessor pairs in object literals and classes.
153
+ *
154
+ * 🚫 Not fixable - https://eslint.org/docs/rules/grouped-accessor-pairs
155
+ */
156
+ "grouped-accessor-pairs": "error",
157
+ /**
158
+ * Disallow use of `alert()`.
159
+ *
160
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-alert
161
+ */
162
+ "no-alert": "error",
163
+ /**
164
+ * Disallow use of `caller`/`callee`.
165
+ *
166
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-caller
167
+ */
168
+ "no-caller": "error",
169
+ /**
170
+ * Disallow returning value in constructor.
171
+ *
172
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-constructor-return
173
+ */
174
+ "no-constructor-return": "error",
175
+ /**
176
+ * Disallow using an `else` if the `if` block contains a return.
177
+ *
178
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-else-return
179
+ */
180
+ "no-else-return": "warn",
181
+ /**
182
+ * Disallow `eval()`.
183
+ *
184
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-eval
185
+ */
186
+ "no-eval": "error",
187
+ /**
188
+ * Disallow extending native objects.
189
+ *
190
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-extend-native
191
+ */
192
+ "no-extend-native": "error",
193
+ /**
194
+ * Disallow unnecessary function binding.
195
+ *
196
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-extra-bind
197
+ */
198
+ "no-extra-bind": "error",
199
+ /**
200
+ * Disallow unnecessary labels.
201
+ *
202
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-extra-label
203
+ */
204
+ "no-extra-label": "error",
205
+ /**
206
+ * Disallow floating decimals.
207
+ *
208
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-floating-decimal
209
+ */
210
+ "no-floating-decimal": "error",
211
+ /**
212
+ * Make people convert types explicitly e.g. `Boolean(foo)` instead of `!!foo`.
213
+ *
214
+ * 🔧 Partially Fixable - https://eslint.org/docs/rules/no-implicit-coercion
215
+ */
216
+ "no-implicit-coercion": "error",
217
+ /**
218
+ * Disallow use of `eval()`-like methods.
219
+ *
220
+ * https://eslint.org/docs/rules/no-implied-eval
221
+ */
222
+ "no-implied-eval": "error",
223
+ /**
224
+ * Disallow usage of `__iterator__` property.
225
+ *
226
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-iterator
227
+ */
228
+ "no-iterator": "error",
229
+ /**
230
+ * Disallow use of labels for anything other than loops and switches.
231
+ *
232
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-labels
233
+ */
234
+ "no-labels": ["error"],
235
+ /**
236
+ * Disallow unnecessary nested blocks.
237
+ *
238
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-lone-blocks
239
+ */
240
+ "no-lone-blocks": "error",
241
+ /**
242
+ * Disallow `new` for side effects.
243
+ *
244
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-new
245
+ */
246
+ "no-new": "error",
247
+ /**
248
+ * Disallow function constructors.
249
+ *
250
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-new-func
251
+ */
252
+ "no-new-func": "error",
253
+ /**
254
+ * Disallow base types wrapper instances, such as `new String('foo')`.
255
+ *
256
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-new-wrappers
257
+ */
258
+ "no-new-wrappers": "error",
259
+ /**
260
+ * Disallow use of octal escape sequences in string literals.
261
+ *
262
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-octal-escape
263
+ */
264
+ "no-octal-escape": "error",
265
+ /**
266
+ * Disallow reassignment of function parameters.
267
+ *
268
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-param-reassign
269
+ */
270
+ "no-param-reassign": "error",
271
+ /**
272
+ * Disallow usage of the deprecated `__proto__` property.
273
+ *
274
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-proto
275
+ */
276
+ "no-proto": "error",
277
+ /**
278
+ * Disallow assignment in `return` statement.
279
+ *
280
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-return-assign
281
+ */
282
+ "no-return-assign": "error",
283
+ /**
284
+ * Disallows unnecessary `return await`.
285
+ *
286
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-return-await
287
+ */
288
+ "no-return-await": "error",
289
+ /**
290
+ * Disallow use of `javascript:` urls.
291
+ *
292
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-script-url
293
+ */
294
+ "no-script-url": "error",
295
+ /**
296
+ * Disallow comparisons where both sides are exactly the same.
297
+ *
298
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-self-compare
299
+ */
300
+ "no-self-compare": "error",
301
+ /**
302
+ * Disallow use of comma operator.
303
+ *
304
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-sequences
305
+ */
306
+ "no-sequences": "error",
307
+ /**
308
+ * Disallow unnecessary `.call()` and `.apply()`.
309
+ *
310
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-call
311
+ */
312
+ "no-useless-call": "error",
313
+ /**
314
+ * Disallow unnecessary concatenation of strings.
315
+ *
316
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-concat
317
+ */
318
+ "no-useless-concat": "error",
319
+ /**
320
+ * Disallow redundant return statements.
321
+ *
322
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-useless-return
323
+ */
324
+ "no-useless-return": "warn",
325
+ /**
326
+ * Require using named capture groups in regular expressions.
327
+ *
328
+ * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-named-capture-group
329
+ */
330
+ "prefer-named-capture-group": "error",
331
+ /**
332
+ * Require using Error objects as Promise rejection reasons.
333
+ *
334
+ * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-promise-reject-errors
335
+ */
336
+ "prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
337
+ /**
338
+ * Disallow use of the RegExp constructor in favor of regular expression
339
+ * literals.
340
+ *
341
+ * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-regex-literals
342
+ */
343
+ "prefer-regex-literals": "error",
344
+ /**
345
+ * Disallow "Yoda conditions", ensuring the comparison.
346
+ *
347
+ * 🔧 Fixable - https://eslint.org/docs/rules/yoda
348
+ */
349
+ yoda: "warn"
350
+ };
351
+ var storm_default = config2;
352
+
353
+ // packages/eslint/src/rules/unicorn.ts
354
+ var config3 = {
355
+ /**
356
+ * Require consistent filename case for all linted files.
357
+ *
358
+ * 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
359
+ */
360
+ "unicorn/filename-case": [
361
+ "error",
362
+ {
363
+ case: "kebabCase"
364
+ }
365
+ ],
366
+ /**
367
+ * Require using the `node:` protocol when importing Node.js built-in modules.
368
+ *
369
+ * 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
370
+ */
371
+ "unicorn/prefer-node-protocol": "warn"
372
+ };
373
+ var unicorn_default = config3;
374
+
375
+ // packages/eslint/src/javascript.ts
376
+ var config4 = {
377
+ overrides: [
378
+ {
379
+ files: ["*.js", "*.jsx"],
380
+ extends: ["plugin:@nx/javascript"],
381
+ plugins: ["unicorn", "import"],
382
+ rules: {
383
+ ...import_default,
384
+ ...unicorn_default,
385
+ ...storm_default
386
+ }
387
+ }
388
+ ]
389
+ };
390
+ var javascript_default = config4;
package/jest.cjs ADDED
@@ -0,0 +1,36 @@
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/jest.ts
20
+ var jest_exports = {};
21
+ __export(jest_exports, {
22
+ default: () => jest_default
23
+ });
24
+ module.exports = __toCommonJS(jest_exports);
25
+ var config = {
26
+ overrides: [
27
+ {
28
+ files: ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
29
+ env: {
30
+ jest: true
31
+ },
32
+ rules: {}
33
+ }
34
+ ]
35
+ };
36
+ var jest_default = config;
package/json.cjs ADDED
@@ -0,0 +1,122 @@
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/json.ts
20
+ var json_exports = {};
21
+ __export(json_exports, {
22
+ default: () => json_default
23
+ });
24
+ module.exports = __toCommonJS(json_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/json.ts
83
+ var JSONC_FILES = [
84
+ "tsconfig.json",
85
+ "tsconfig.base.json",
86
+ "nx.json",
87
+ ".vscode/launch.json"
88
+ ];
89
+ var config = {
90
+ root: true,
91
+ overrides: [
92
+ {
93
+ files: "*.json",
94
+ excludedFiles: JSONC_FILES,
95
+ extends: "plugin:jsonc/recommended-with-json"
96
+ },
97
+ {
98
+ "files": ["**/executors/**/schema.json", "**/generators/**/schema.json"],
99
+ "parser": "jsonc-eslint-parser",
100
+ "rules": {
101
+ "@nx/workspace/valid-schema-description": "error"
102
+ }
103
+ },
104
+ {
105
+ files: ["*.jsonc", ...JSONC_FILES],
106
+ extends: "plugin:jsonc/recommended-with-jsonc"
107
+ },
108
+ {
109
+ files: "*.json5",
110
+ extends: "plugin:jsonc/recommended-with-json5"
111
+ },
112
+ {
113
+ files: "*.json{,c,5}",
114
+ excludedFiles: CODE_BLOCK,
115
+ plugins: ["unicorn"],
116
+ rules: {
117
+ "unicorn/filename-case": "error"
118
+ }
119
+ }
120
+ ]
121
+ };
122
+ var json_default = config;
package/mdx.cjs ADDED
@@ -0,0 +1,144 @@
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/mdx.ts
20
+ var mdx_exports = {};
21
+ __export(mdx_exports, {
22
+ default: () => mdx_default
23
+ });
24
+ module.exports = __toCommonJS(mdx_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/mdx.ts
83
+ var config = {
84
+ overrides: [
85
+ {
86
+ files: "*.md{,x}",
87
+ parser: "eslint-mdx",
88
+ processor: "mdx/remark",
89
+ plugins: ["mdx"],
90
+ extends: ["./base", "./react-base"],
91
+ parserOptions: {
92
+ ecmaVersion: 13
93
+ },
94
+ rules: {
95
+ "react/self-closing-comp": "off",
96
+ // TODO: false positive https://github.com/mdx-js/eslint-mdx/issues/437
97
+ "mdx/remark": "error",
98
+ "import/no-default-export": "off",
99
+ "@typescript-eslint/prefer-optional-chain": "off",
100
+ // throws "parserOptions.project" error
101
+ "react/jsx-filename-extension": "off"
102
+ // fixes JSX not allowed in files with extension '.mdx'
103
+ },
104
+ settings: {
105
+ "mdx/code-blocks": true
106
+ }
107
+ },
108
+ // Disable filename check
109
+ {
110
+ files: [
111
+ CODE_BLOCK,
112
+ ".changeset/*.md",
113
+ "CHANGELOG.md",
114
+ ".github/**/PULL_REQUEST_TEMPLATE.md",
115
+ ".github/ISSUE_TEMPLATE/bug_report.md",
116
+ "SECURITY.md",
117
+ "CODE_OF_CONDUCT.md",
118
+ "README.md"
119
+ ],
120
+ rules: {
121
+ "unicorn/filename-case": "off"
122
+ }
123
+ },
124
+ // Disable rules for code blocks
125
+ {
126
+ files: [CODE_BLOCK],
127
+ rules: {
128
+ "no-console": "off",
129
+ "@typescript-eslint/no-unused-vars": "off",
130
+ "no-undef": "off",
131
+ "import/extensions": "off"
132
+ }
133
+ },
134
+ // Disable rules that requires types information
135
+ {
136
+ files: ["*.md{,x}", "**/*.md{,x}/*"],
137
+ rules: {
138
+ "@typescript-eslint/require-await": "off",
139
+ "@typescript-eslint/return-await": "off"
140
+ }
141
+ }
142
+ ]
143
+ };
144
+ var mdx_default = config;