@chanyuxi/eslint-waltz 0.0.0-alpha.1 → 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -0,0 +1,60 @@
1
+ # Introduction
2
+
3
+ 👋 A composable ESLint flat config for JavaScript, TypeScript, JSONC, imports, and React.
4
+
5
+ Inspired by [@antfu/eslint-config](https://github.com/antfu/eslint-config).
6
+
7
+ # Features
8
+
9
+ The following configuration modules are available:
10
+
11
+ - ✅ Javascript
12
+ - ✅ Typescript
13
+ - ✅ Stylistic
14
+ - ✅ Json
15
+ - ✅ Import
16
+ - ✅ React
17
+ - JSONC is enabled by default and can be disabled with `json: false`.
18
+ - TypeScript, imports, React, and gitignore support are opt-in.
19
+
20
+ # Usage
21
+
22
+ #### Install
23
+
24
+ Install the core package and its core ESLint peers:
25
+
26
+ ```bash
27
+ pnpm add -D @chanyuxi/eslint-waltz eslint @eslint/js @stylistic/eslint-plugin eslint-plugin-jsonc jsonc-eslint-parser globals
28
+ ```
29
+
30
+ Install the peer packages for any optional modules you enable, such as `typescript-eslint`, `eslint-plugin-import`, or the React ESLint plugins.
31
+
32
+ #### Configuration
33
+
34
+ Create a `eslint.config.ts` file in the project root directory and configure it as follows:
35
+
36
+ ```ts
37
+ import waltz from '@chanyuxi/eslint-waltz'
38
+
39
+ export default waltz({
40
+ // JSONC is enabled by default
41
+ json: true,
42
+ ts: true,
43
+ imports: true,
44
+ react: true,
45
+ js: { globals: ['browser'] },
46
+ })
47
+ ```
48
+
49
+ Every module accepts `files` and `overrides` where applicable. Custom flat configs can be appended after the options:
50
+
51
+ ```ts
52
+ export default waltz({}, {
53
+ files: ['src/**/*.js'],
54
+ rules: {
55
+ 'no-console': 'off',
56
+ },
57
+ })
58
+ ```
59
+
60
+ Run `pnpm run check` before committing. `pnpm pack` and `npm publish` build the package automatically through the `prepack` lifecycle.
package/dist/index.d.ts CHANGED
@@ -7,6 +7,536 @@ import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
7
7
 
8
8
 
9
9
  interface RuleOptions {
10
+ /**
11
+ * Enforces explicit boolean values for boolean attributes.
12
+ * @see https://eslint-react.xyz/docs/rules/avoid-shorthand-boolean
13
+ */
14
+ '@eslint-react/avoid-shorthand-boolean'?: Linter.RuleEntry<[]>
15
+ /**
16
+ * Enforces explicit `<Fragment>` components instead of the shorthand `<>` or `</>` syntax.
17
+ * @see https://eslint-react.xyz/docs/rules/avoid-shorthand-fragment
18
+ */
19
+ '@eslint-react/avoid-shorthand-fragment'?: Linter.RuleEntry<[]>
20
+ /**
21
+ * Reports all class components.
22
+ * @see https://eslint-react.xyz/docs/rules/debug-class-component
23
+ */
24
+ '@eslint-react/debug/class-component'?: Linter.RuleEntry<[]>
25
+ /**
26
+ * Reports all function components.
27
+ * @see https://eslint-react.xyz/docs/rules/debug-function-component
28
+ */
29
+ '@eslint-react/debug/function-component'?: Linter.RuleEntry<[]>
30
+ /**
31
+ * Reports all React Hooks.
32
+ * @see https://eslint-react.xyz/docs/rules/debug-hook
33
+ */
34
+ '@eslint-react/debug/hook'?: Linter.RuleEntry<[]>
35
+ /**
36
+ * Reports all identifiers that are initialized from React.
37
+ * @see https://eslint-react.xyz/docs/rules/debug-is-from-react
38
+ */
39
+ '@eslint-react/debug/is-from-react'?: Linter.RuleEntry<[]>
40
+ /**
41
+ * Reports all JSX elements and fragments.
42
+ * @see https://eslint-react.xyz/docs/rules/debug-jsx
43
+ */
44
+ '@eslint-react/debug/jsx'?: Linter.RuleEntry<[]>
45
+ /**
46
+ * Reports all React Hooks.
47
+ * @see https://eslint-react.xyz/docs/rules/debug-hook
48
+ */
49
+ '@eslint-react/debug/react-hooks'?: Linter.RuleEntry<[]>
50
+ /**
51
+ * Disallow `children` in void DOM elements.
52
+ * @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
53
+ */
54
+ '@eslint-react/dom/no-children-in-void-dom-elements'?: Linter.RuleEntry<[]>
55
+ /**
56
+ * Disallow `dangerouslySetInnerHTML`.
57
+ * @see https://eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml
58
+ */
59
+ '@eslint-react/dom/no-dangerously-set-innerhtml'?: Linter.RuleEntry<[]>
60
+ /**
61
+ * Disallow `dangerouslySetInnerHTML` and `children` at the same time.
62
+ * @see https://eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml-with-children
63
+ */
64
+ '@eslint-react/dom/no-dangerously-set-innerhtml-with-children'?: Linter.RuleEntry<[]>
65
+ /**
66
+ * Disallow `findDOMNode`.
67
+ * @see https://eslint-react.xyz/docs/rules/dom-no-find-dom-node
68
+ */
69
+ '@eslint-react/dom/no-find-dom-node'?: Linter.RuleEntry<[]>
70
+ /**
71
+ * Disallow `flushSync`.
72
+ * @see https://eslint-react.xyz/docs/rules/dom-no-flush-sync
73
+ */
74
+ '@eslint-react/dom/no-flush-sync'?: Linter.RuleEntry<[]>
75
+ /**
76
+ * Replaces usages of `ReactDom.hydrate()` with `hydrateRoot()`.
77
+ * @see https://eslint-react.xyz/docs/rules/dom-no-hydrate
78
+ */
79
+ '@eslint-react/dom/no-hydrate'?: Linter.RuleEntry<[]>
80
+ /**
81
+ * Enforces explicit `type` attribute for `button` elements.
82
+ * @see https://eslint-react.xyz/docs/rules/dom-no-missing-button-type
83
+ */
84
+ '@eslint-react/dom/no-missing-button-type'?: Linter.RuleEntry<[]>
85
+ /**
86
+ * Enforces explicit `sandbox` attribute for `iframe` elements.
87
+ * @see https://eslint-react.xyz/docs/rules/dom-no-missing-iframe-sandbox
88
+ */
89
+ '@eslint-react/dom/no-missing-iframe-sandbox'?: Linter.RuleEntry<[]>
90
+ /**
91
+ * Enforces the absence of a `namespace` in React elements.
92
+ * @see https://eslint-react.xyz/docs/rules/dom-no-namespace
93
+ */
94
+ '@eslint-react/dom/no-namespace'?: Linter.RuleEntry<[]>
95
+ /**
96
+ * Replaces usages of `ReactDom.render()` with `createRoot(node).render()`.
97
+ * @see https://eslint-react.xyz/docs/rules/dom-no-render
98
+ */
99
+ '@eslint-react/dom/no-render'?: Linter.RuleEntry<[]>
100
+ /**
101
+ * Disallow the return value of `ReactDOM.render`.
102
+ * @see https://eslint-react.xyz/docs/rules/dom-no-render-return-value
103
+ */
104
+ '@eslint-react/dom/no-render-return-value'?: Linter.RuleEntry<[]>
105
+ /**
106
+ * Disallow `javascript:` URLs as attribute values.
107
+ * @see https://eslint-react.xyz/docs/rules/dom-no-script-url
108
+ */
109
+ '@eslint-react/dom/no-script-url'?: Linter.RuleEntry<[]>
110
+ /**
111
+ * Disallow unknown `DOM` property.
112
+ * @see https://eslint-react.xyz/docs/rules/dom-no-unknown-property
113
+ */
114
+ '@eslint-react/dom/no-unknown-property'?: Linter.RuleEntry<EslintReactDomNoUnknownProperty>
115
+ /**
116
+ * Enforces `sandbox` attribute for `iframe` elements is not set to unsafe combinations.
117
+ * @see https://eslint-react.xyz/docs/rules/dom-no-unsafe-iframe-sandbox
118
+ */
119
+ '@eslint-react/dom/no-unsafe-iframe-sandbox'?: Linter.RuleEntry<[]>
120
+ /**
121
+ * Disallow `target="_blank"` without `rel="noreferrer noopener"`.
122
+ * @see https://eslint-react.xyz/docs/rules/dom-no-unsafe-target-blank
123
+ */
124
+ '@eslint-react/dom/no-unsafe-target-blank'?: Linter.RuleEntry<[]>
125
+ /**
126
+ * Replaces usages of `useFormState` with `useActionState`.
127
+ * @see https://eslint-react.xyz/docs/rules/dom-no-use-form-state
128
+ */
129
+ '@eslint-react/dom/no-use-form-state'?: Linter.RuleEntry<[]>
130
+ /**
131
+ * Disallow `children` in void DOM elements.
132
+ * @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
133
+ */
134
+ '@eslint-react/dom/no-void-elements-with-children'?: Linter.RuleEntry<[]>
135
+ /**
136
+ * Disallow useless `forwardRef` calls on components that don't use `ref`s.
137
+ * @see https://eslint-react.xyz/docs/rules/no-useless-forward-ref
138
+ */
139
+ '@eslint-react/ensure-forward-ref-using-ref'?: Linter.RuleEntry<[]>
140
+ /**
141
+ * Enforces that a function with the `use` prefix should use at least one Hook inside of it.
142
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-prefix
143
+ */
144
+ '@eslint-react/hooks-extra/ensure-custom-hooks-using-other-hooks'?: Linter.RuleEntry<[]>
145
+ /**
146
+ * Disallow unnecessary usage of `useCallback`.
147
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-callback
148
+ */
149
+ '@eslint-react/hooks-extra/ensure-use-callback-has-non-empty-deps'?: Linter.RuleEntry<[]>
150
+ /**
151
+ * Disallow unnecessary usage of `useMemo`.
152
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-memo
153
+ */
154
+ '@eslint-react/hooks-extra/ensure-use-memo-has-non-empty-deps'?: Linter.RuleEntry<[]>
155
+ /**
156
+ * Disallow direct calls to the `set` function of `useState` in `useEffect`.
157
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-direct-set-state-in-use-effect
158
+ */
159
+ '@eslint-react/hooks-extra/no-direct-set-state-in-use-effect'?: Linter.RuleEntry<[]>
160
+ /**
161
+ * Disallow direct calls to the `set` function of `useState` in `useLayoutEffect`.
162
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-direct-set-state-in-use-layout-effect
163
+ */
164
+ '@eslint-react/hooks-extra/no-direct-set-state-in-use-layout-effect'?: Linter.RuleEntry<[]>
165
+ /**
166
+ * Enforces that a function with the `use` prefix should use at least one Hook inside of it.
167
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-prefix
168
+ */
169
+ '@eslint-react/hooks-extra/no-redundant-custom-hook'?: Linter.RuleEntry<[]>
170
+ /**
171
+ * Disallow unnecessary usage of `useCallback`.
172
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-callback
173
+ */
174
+ '@eslint-react/hooks-extra/no-unnecessary-use-callback'?: Linter.RuleEntry<[]>
175
+ /**
176
+ * Disallow unnecessary usage of `useMemo`.
177
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-memo
178
+ */
179
+ '@eslint-react/hooks-extra/no-unnecessary-use-memo'?: Linter.RuleEntry<[]>
180
+ /**
181
+ * Enforces that a function with the `use` prefix should use at least one Hook inside of it.
182
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-prefix
183
+ */
184
+ '@eslint-react/hooks-extra/no-unnecessary-use-prefix'?: Linter.RuleEntry<[]>
185
+ /**
186
+ * Enforces that a function with the `use` prefix should use at least one Hook inside of it.
187
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-no-unnecessary-use-prefix
188
+ */
189
+ '@eslint-react/hooks-extra/no-useless-custom-hooks'?: Linter.RuleEntry<[]>
190
+ /**
191
+ * Enforces function calls made inside `useState` to be wrapped in an `initializer function`.
192
+ * @see https://eslint-react.xyz/docs/rules/hooks-extra-prefer-use-state-lazy-initialization
193
+ */
194
+ '@eslint-react/hooks-extra/prefer-use-state-lazy-initialization'?: Linter.RuleEntry<[]>
195
+ /**
196
+ * Enforces that the 'key' attribute is placed before the spread attribute in JSX elements.
197
+ * @see https://eslint-react.xyz/docs/rules/jsx-key-before-spread
198
+ */
199
+ '@eslint-react/jsx-key-before-spread'?: Linter.RuleEntry<[]>
200
+ /**
201
+ * Disallow duplicate props in JSX elements.
202
+ * @see https://eslint-react.xyz/docs/rules/jsx-no-duplicate-props
203
+ */
204
+ '@eslint-react/jsx-no-duplicate-props'?: Linter.RuleEntry<[]>
205
+ /**
206
+ * Disallows 'IIFE' in JSX elements.
207
+ * @see https://eslint-react.xyz/docs/rules/jsx-no-iife
208
+ */
209
+ '@eslint-react/jsx-no-iife'?: Linter.RuleEntry<[]>
210
+ /**
211
+ * Disallow undefined variables in JSX.
212
+ * @see https://eslint-react.xyz/docs/rules/jsx-no-undef
213
+ */
214
+ '@eslint-react/jsx-no-undef'?: Linter.RuleEntry<[]>
215
+ /**
216
+ * Marks React variables as used when JSX is used.
217
+ * @see https://eslint-react.xyz/docs/rules/jsx-uses-react
218
+ */
219
+ '@eslint-react/jsx-uses-react'?: Linter.RuleEntry<[]>
220
+ /**
221
+ * Marks variables used in JSX elements as used.
222
+ * @see https://eslint-react.xyz/docs/rules/jsx-uses-vars
223
+ */
224
+ '@eslint-react/jsx-uses-vars'?: Linter.RuleEntry<[]>
225
+ /**
226
+ * Enforces naming conventions for components.
227
+ * @see https://eslint-react.xyz/docs/rules/naming-convention-component-name
228
+ */
229
+ '@eslint-react/naming-convention/component-name'?: Linter.RuleEntry<EslintReactNamingConventionComponentName>
230
+ /**
231
+ * Enforces context name to be a valid component name with the suffix `Context`.
232
+ * @see https://eslint-react.xyz/docs/rules/naming-convention-context-name
233
+ */
234
+ '@eslint-react/naming-convention/context-name'?: Linter.RuleEntry<[]>
235
+ /**
236
+ * Enforces consistent file naming conventions.
237
+ * @see https://eslint-react.xyz/docs/rules/naming-convention-filename
238
+ */
239
+ '@eslint-react/naming-convention/filename'?: Linter.RuleEntry<EslintReactNamingConventionFilename>
240
+ /**
241
+ * Enforces consistent file naming conventions.
242
+ * @see https://eslint-react.xyz/docs/rules/naming-convention-filename-extension
243
+ */
244
+ '@eslint-react/naming-convention/filename-extension'?: Linter.RuleEntry<EslintReactNamingConventionFilenameExtension>
245
+ /**
246
+ * Enforces destructuring and symmetric naming of `useState` hook value and setter.
247
+ * @see https://eslint-react.xyz/docs/rules/naming-convention-use-state
248
+ */
249
+ '@eslint-react/naming-convention/use-state'?: Linter.RuleEntry<[]>
250
+ /**
251
+ * Disallow accessing `this.state` inside `setState` calls.
252
+ * @see https://eslint-react.xyz/docs/rules/no-access-state-in-setstate
253
+ */
254
+ '@eslint-react/no-access-state-in-setstate'?: Linter.RuleEntry<[]>
255
+ /**
256
+ * Disallow an item's index in the array as its key.
257
+ * @see https://eslint-react.xyz/docs/rules/no-array-index-key
258
+ */
259
+ '@eslint-react/no-array-index-key'?: Linter.RuleEntry<[]>
260
+ /**
261
+ * Disallow `Children.count`.
262
+ * @see https://eslint-react.xyz/docs/rules/no-children-count
263
+ */
264
+ '@eslint-react/no-children-count'?: Linter.RuleEntry<[]>
265
+ /**
266
+ * Disallow 'Children.forEach'.
267
+ * @see https://eslint-react.xyz/docs/rules/no-children-for-each
268
+ */
269
+ '@eslint-react/no-children-for-each'?: Linter.RuleEntry<[]>
270
+ /**
271
+ * Disallow `Children.map`.
272
+ * @see https://eslint-react.xyz/docs/rules/no-children-map
273
+ */
274
+ '@eslint-react/no-children-map'?: Linter.RuleEntry<[]>
275
+ /**
276
+ * Disallow `Children.only`.
277
+ * @see https://eslint-react.xyz/docs/rules/no-children-only
278
+ */
279
+ '@eslint-react/no-children-only'?: Linter.RuleEntry<[]>
280
+ /**
281
+ * Disallow passing `children` as a prop.
282
+ * @see https://eslint-react.xyz/docs/rules/no-children-prop
283
+ */
284
+ '@eslint-react/no-children-prop'?: Linter.RuleEntry<[]>
285
+ /**
286
+ * Disallow `Children.toArray`.
287
+ * @see https://eslint-react.xyz/docs/rules/no-children-to-array
288
+ */
289
+ '@eslint-react/no-children-to-array'?: Linter.RuleEntry<[]>
290
+ /**
291
+ * Disallow class components except for error boundaries.
292
+ * @see https://eslint-react.xyz/docs/rules/no-class-component
293
+ */
294
+ '@eslint-react/no-class-component'?: Linter.RuleEntry<[]>
295
+ /**
296
+ * Disallow `cloneElement`.
297
+ * @see https://eslint-react.xyz/docs/rules/no-clone-element
298
+ */
299
+ '@eslint-react/no-clone-element'?: Linter.RuleEntry<[]>
300
+ /**
301
+ * Prevents comments from being inserted as text nodes.
302
+ * @see https://eslint-react.xyz/docs/rules/no-comment-textnodes
303
+ */
304
+ '@eslint-react/no-comment-textnodes'?: Linter.RuleEntry<[]>
305
+ /**
306
+ * Disallow complex conditional rendering in JSX expressions.
307
+ * @see https://eslint-react.xyz/docs/rules/no-complex-conditional-rendering
308
+ */
309
+ '@eslint-react/no-complex-conditional-rendering'?: Linter.RuleEntry<[]>
310
+ /**
311
+ * Disallow complex conditional rendering in JSX expressions.
312
+ * @see https://eslint-react.xyz/docs/rules/no-complex-conditional-rendering
313
+ */
314
+ '@eslint-react/no-complicated-conditional-rendering'?: Linter.RuleEntry<[]>
315
+ /**
316
+ * Replace usages of `componentWillMount` with `UNSAFE_componentWillMount`.
317
+ * @see https://eslint-react.xyz/docs/rules/no-component-will-mount
318
+ */
319
+ '@eslint-react/no-component-will-mount'?: Linter.RuleEntry<[]>
320
+ /**
321
+ * Replace usages of `componentWillReceiveProps` with `UNSAFE_componentWillReceiveProps`.
322
+ * @see https://eslint-react.xyz/docs/rules/no-component-will-receive-props
323
+ */
324
+ '@eslint-react/no-component-will-receive-props'?: Linter.RuleEntry<[]>
325
+ /**
326
+ * Replace usages of `componentWillUpdate` with `UNSAFE_componentWillUpdate`.
327
+ * @see https://eslint-react.xyz/docs/rules/no-component-will-update
328
+ */
329
+ '@eslint-react/no-component-will-update'?: Linter.RuleEntry<[]>
330
+ /**
331
+ * Replace usages of `<Context.Provider>` with `<Context>`.
332
+ * @see https://eslint-react.xyz/docs/rules/no-context-provider
333
+ */
334
+ '@eslint-react/no-context-provider'?: Linter.RuleEntry<[]>
335
+ /**
336
+ * Disallow `createRef` in function components.
337
+ * @see https://eslint-react.xyz/docs/rules/no-create-ref
338
+ */
339
+ '@eslint-react/no-create-ref'?: Linter.RuleEntry<[]>
340
+ /**
341
+ * Disallow `defaultProps` property in favor of ES6 default parameters.
342
+ * @see https://eslint-react.xyz/docs/rules/no-default-props
343
+ */
344
+ '@eslint-react/no-default-props'?: Linter.RuleEntry<[]>
345
+ /**
346
+ * Disallow direct mutation of `this.state`.
347
+ * @see https://eslint-react.xyz/docs/rules/no-direct-mutation-state
348
+ */
349
+ '@eslint-react/no-direct-mutation-state'?: Linter.RuleEntry<[]>
350
+ /**
351
+ * Disallow duplicate props in JSX elements.
352
+ * @see https://eslint-react.xyz/docs/rules/jsx-no-duplicate-props
353
+ */
354
+ '@eslint-react/no-duplicate-jsx-props'?: Linter.RuleEntry<[]>
355
+ /**
356
+ * Disallow duplicate `key` on elements in the same array or a list of `children`.
357
+ * @see https://eslint-react.xyz/docs/rules/no-duplicate-key
358
+ */
359
+ '@eslint-react/no-duplicate-key'?: Linter.RuleEntry<[]>
360
+ /**
361
+ * Replaces usages of `forwardRef` with passing `ref` as a prop.
362
+ * @see https://eslint-react.xyz/docs/rules/no-forward-ref
363
+ */
364
+ '@eslint-react/no-forward-ref'?: Linter.RuleEntry<[]>
365
+ /**
366
+ * Prevents `key` from not being explicitly specified (e.g. spreading `key` from objects).
367
+ * @see https://eslint-react.xyz/docs/rules/no-implicit-key
368
+ */
369
+ '@eslint-react/no-implicit-key'?: Linter.RuleEntry<[]>
370
+ /**
371
+ * Prevents problematic leaked values from being rendered.
372
+ * @see https://eslint-react.xyz/docs/rules/no-leaked-conditional-rendering
373
+ */
374
+ '@eslint-react/no-leaked-conditional-rendering'?: Linter.RuleEntry<[]>
375
+ /**
376
+ * Enforces that all components have a `displayName` which can be used in devtools.
377
+ * @see https://eslint-react.xyz/docs/rules/no-missing-component-display-name
378
+ */
379
+ '@eslint-react/no-missing-component-display-name'?: Linter.RuleEntry<[]>
380
+ /**
381
+ * Enforces that all contexts have a `displayName` which can be used in devtools.
382
+ * @see https://eslint-react.xyz/docs/rules/no-missing-context-display-name
383
+ */
384
+ '@eslint-react/no-missing-context-display-name'?: Linter.RuleEntry<[]>
385
+ /**
386
+ * Disallow missing `key` on items in list rendering.
387
+ * @see https://eslint-react.xyz/docs/rules/no-missing-key
388
+ */
389
+ '@eslint-react/no-missing-key'?: Linter.RuleEntry<[]>
390
+ /**
391
+ * Prevents incorrect usage of `captureOwnerStack`.
392
+ * @see https://eslint-react.xyz/docs/rules/no-misused-capture-owner-stack
393
+ */
394
+ '@eslint-react/no-misused-capture-owner-stack'?: Linter.RuleEntry<[]>
395
+ /**
396
+ * Disallow nesting component definitions inside other components.
397
+ * @see https://eslint-react.xyz/docs/rules/no-nested-component-definitions
398
+ */
399
+ '@eslint-react/no-nested-component-definitions'?: Linter.RuleEntry<[]>
400
+ /**
401
+ * Disallow nesting component definitions inside other components.
402
+ * @see https://eslint-react.xyz/docs/rules/no-nested-component-definitions
403
+ */
404
+ '@eslint-react/no-nested-components'?: Linter.RuleEntry<[]>
405
+ /**
406
+ * Disallow nesting lazy component declarations inside other components.
407
+ * @see https://eslint-react.xyz/docs/rules/no-nested-component-definitions
408
+ */
409
+ '@eslint-react/no-nested-lazy-component-declarations'?: Linter.RuleEntry<[]>
410
+ /**
411
+ * Disallow `propTypes` in favor of TypeScript or another type-checking solution.
412
+ * @see https://eslint-react.xyz/docs/rules/no-prop-types
413
+ */
414
+ '@eslint-react/no-prop-types'?: Linter.RuleEntry<[]>
415
+ /**
416
+ * Disallow `shouldComponentUpdate` when extending `React.PureComponent`.
417
+ * @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
418
+ */
419
+ '@eslint-react/no-redundant-should-component-update'?: Linter.RuleEntry<[]>
420
+ /**
421
+ * Disallow calling `this.setState` in `componentDidMount` outside of functions, such as callbacks.
422
+ * @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
423
+ */
424
+ '@eslint-react/no-set-state-in-component-did-mount'?: Linter.RuleEntry<[]>
425
+ /**
426
+ * Disallow calling `this.setState` in `componentDidUpdate` outside of functions, such as callbacks.
427
+ * @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-update
428
+ */
429
+ '@eslint-react/no-set-state-in-component-did-update'?: Linter.RuleEntry<[]>
430
+ /**
431
+ * Disallows calling `this.setState` in `componentWillUpdate` outside of functions, such as callbacks.
432
+ * @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
433
+ */
434
+ '@eslint-react/no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>
435
+ /**
436
+ * Replaces string refs with callback refs.
437
+ * @see https://eslint-react.xyz/docs/rules/no-string-refs
438
+ */
439
+ '@eslint-react/no-string-refs'?: Linter.RuleEntry<[]>
440
+ /**
441
+ * Warns the usage of `UNSAFE_componentWillMount` in class components.
442
+ * @see https://eslint-react.xyz/docs/rules/no-unsafe-component-will-mount
443
+ */
444
+ '@eslint-react/no-unsafe-component-will-mount'?: Linter.RuleEntry<[]>
445
+ /**
446
+ * Warns the usage of `UNSAFE_componentWillReceiveProps` in class components.
447
+ * @see https://eslint-react.xyz/docs/rules/no-unsafe-component-will-receive-props
448
+ */
449
+ '@eslint-react/no-unsafe-component-will-receive-props'?: Linter.RuleEntry<[]>
450
+ /**
451
+ * Warns the usage of `UNSAFE_componentWillUpdate` in class components.
452
+ * @see https://eslint-react.xyz/docs/rules/no-unsafe-component-will-update
453
+ */
454
+ '@eslint-react/no-unsafe-component-will-update'?: Linter.RuleEntry<[]>
455
+ /**
456
+ * Prevents non-stable values (i.e. object literals) from being used as a value for `Context.Provider`.
457
+ * @see https://eslint-react.xyz/docs/rules/no-unstable-context-value
458
+ */
459
+ '@eslint-react/no-unstable-context-value'?: Linter.RuleEntry<[]>
460
+ /**
461
+ * Prevents using referential-type values as default props in object destructuring.
462
+ * @see https://eslint-react.xyz/docs/rules/no-unstable-default-props
463
+ */
464
+ '@eslint-react/no-unstable-default-props'?: Linter.RuleEntry<[]>
465
+ /**
466
+ * Warns unused class component methods and properties.
467
+ * @see https://eslint-react.xyz/docs/rules/no-unused-class-component-members
468
+ */
469
+ '@eslint-react/no-unused-class-component-members'?: Linter.RuleEntry<[]>
470
+ /**
471
+ * Warns unused class component state.
472
+ * @see https://eslint-react.xyz/docs/rules/no-unused-state
473
+ */
474
+ '@eslint-react/no-unused-state'?: Linter.RuleEntry<[]>
475
+ /**
476
+ * Replaces usages of `useContext` with `use`.
477
+ * @see https://eslint-react.xyz/docs/rules/no-use-context
478
+ */
479
+ '@eslint-react/no-use-context'?: Linter.RuleEntry<[]>
480
+ /**
481
+ * Disallow useless `forwardRef` calls on components that don't use `ref`s.
482
+ * @see https://eslint-react.xyz/docs/rules/no-useless-forward-ref
483
+ */
484
+ '@eslint-react/no-useless-forward-ref'?: Linter.RuleEntry<[]>
485
+ /**
486
+ * Disallow useless fragment elements.
487
+ * @see https://eslint-react.xyz/docs/rules/no-useless-fragment
488
+ */
489
+ '@eslint-react/no-useless-fragment'?: Linter.RuleEntry<EslintReactNoUselessFragment>
490
+ /**
491
+ * Enforces destructuring assignment for component props and context.
492
+ * @see https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
493
+ */
494
+ '@eslint-react/prefer-destructuring-assignment'?: Linter.RuleEntry<[]>
495
+ /**
496
+ * Enforces React is imported via a namespace import.
497
+ * @see https://eslint-react.xyz/docs/rules/prefer-react-namespace-import
498
+ */
499
+ '@eslint-react/prefer-react-namespace-import'?: Linter.RuleEntry<[]>
500
+ /**
501
+ * Enforces read-only props in components.
502
+ * @see https://eslint-react.xyz/docs/rules/prefer-read-only-props
503
+ */
504
+ '@eslint-react/prefer-read-only-props'?: Linter.RuleEntry<[]>
505
+ /**
506
+ * Enforces shorthand syntax for boolean attributes.
507
+ * @see https://eslint-react.xyz/docs/rules/prefer-shorthand-boolean
508
+ */
509
+ '@eslint-react/prefer-shorthand-boolean'?: Linter.RuleEntry<[]>
510
+ /**
511
+ * Enforces shorthand syntax for fragments.
512
+ * @see https://eslint-react.xyz/docs/rules/prefer-shorthand-fragment
513
+ */
514
+ '@eslint-react/prefer-shorthand-fragment'?: Linter.RuleEntry<[]>
515
+ /**
516
+ * Marks variables used in JSX elements as used.
517
+ * @see https://eslint-react.xyz/docs/rules/jsx-uses-vars
518
+ */
519
+ '@eslint-react/use-jsx-vars'?: Linter.RuleEntry<[]>
520
+ /**
521
+ * Prevents leaked `addEventListener` in a component or custom Hook.
522
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
523
+ */
524
+ '@eslint-react/web-api/no-leaked-event-listener'?: Linter.RuleEntry<[]>
525
+ /**
526
+ * Prevents leaked `setInterval` in a component or custom Hook.
527
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
528
+ */
529
+ '@eslint-react/web-api/no-leaked-interval'?: Linter.RuleEntry<[]>
530
+ /**
531
+ * Prevents leaked `ResizeObserver` in a component or custom Hook.
532
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-resize-observer
533
+ */
534
+ '@eslint-react/web-api/no-leaked-resize-observer'?: Linter.RuleEntry<[]>
535
+ /**
536
+ * Prevents leaked `setTimeout` in a component or custom Hook.
537
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
538
+ */
539
+ '@eslint-react/web-api/no-leaked-timeout'?: Linter.RuleEntry<[]>
10
540
  /**
11
541
  * Enforce linebreaks after opening and before closing array brackets
12
542
  * @see https://eslint.style/rules/array-bracket-newline
@@ -1598,6 +2128,36 @@ interface RuleOptions {
1598
2128
  }
1599
2129
 
1600
2130
  /* ======= Declarations ======= */
2131
+ // ----- @eslint-react/dom/no-unknown-property -----
2132
+ type EslintReactDomNoUnknownProperty = []|[{
2133
+ ignore?: string[]
2134
+ requireDataLowercase?: boolean
2135
+ }]
2136
+ // ----- @eslint-react/naming-convention/component-name -----
2137
+ type EslintReactNamingConventionComponentName = []|[(("PascalCase" | "CONSTANT_CASE") | {
2138
+ allowAllCaps?: boolean
2139
+ allowLeadingUnderscore?: boolean
2140
+ allowNamespace?: boolean
2141
+ excepts?: string[]
2142
+ rule?: ("PascalCase" | "CONSTANT_CASE")
2143
+ })]
2144
+ // ----- @eslint-react/naming-convention/filename -----
2145
+ type EslintReactNamingConventionFilename = []|[(("PascalCase" | "camelCase" | "kebab-case" | "snake_case") | {
2146
+ excepts?: string[]
2147
+ extensions?: string[]
2148
+ rule?: ("PascalCase" | "camelCase" | "kebab-case" | "snake_case")
2149
+ })]
2150
+ // ----- @eslint-react/naming-convention/filename-extension -----
2151
+ type EslintReactNamingConventionFilenameExtension = []|[(("always" | "as-needed") | {
2152
+ allow?: ("always" | "as-needed")
2153
+ extensions?: string[]
2154
+ ignoreFilesWithoutCode?: boolean
2155
+ })]
2156
+ // ----- @eslint-react/no-useless-fragment -----
2157
+ type EslintReactNoUselessFragment = []|[{
2158
+
2159
+ allowExpressions?: boolean
2160
+ }]
1601
2161
  // ----- @stylistic/array-bracket-newline -----
1602
2162
  type StylisticArrayBracketNewline = []|[(("always" | "never" | "consistent") | {
1603
2163
  multiline?: boolean
@@ -4467,6 +5027,8 @@ type Rules = Record<string, Linter.RuleEntry | undefined> & RuleOptions;
4467
5027
  interface LinterConfig extends Omit<Linter.Config, 'rules'> {
4468
5028
  rules?: Rules;
4469
5029
  }
5030
+ type Arraiable<T> = T | Array<T>;
5031
+ type UnresolvedLinterConfig = Arraiable<LinterConfig> | Promise<Arraiable<LinterConfig>>;
4470
5032
  interface SharedOptions {
4471
5033
  /**
4472
5034
  * Each configuration automatically lints all corresponding files, this option is used to override
@@ -4474,7 +5036,7 @@ interface SharedOptions {
4474
5036
  files?: Linter.Config['files'];
4475
5037
  /**
4476
5038
  * Rewrite rules
4477
- */
5039
+ */
4478
5040
  overrides?: LinterConfig['rules'];
4479
5041
  }
4480
5042
  interface JsOptions extends SharedOptions {
@@ -4483,6 +5045,8 @@ interface JsOptions extends SharedOptions {
4483
5045
  type TsOptions = SharedOptions;
4484
5046
  type StylisticOptions = SharedOptions;
4485
5047
  type JsoncOptions = SharedOptions;
5048
+ type ImportsOptions = SharedOptions;
5049
+ type ReactOptions = SharedOptions;
4486
5050
  interface WaltzOptions {
4487
5051
  /**
4488
5052
  * Treat the .gitignore file as a global ignore
@@ -4512,15 +5076,24 @@ interface WaltzOptions {
4512
5076
  */
4513
5077
  stylistic?: StylisticOptions;
4514
5078
  /**
5079
+ * Enable JSON/JSONC rules
4515
5080
  *
5081
+ * @default true
4516
5082
  */
4517
5083
  json?: boolean | JsoncOptions;
4518
5084
  /**
5085
+ * Enable import rules
4519
5086
  *
5087
+ * @default false
5088
+ */
5089
+ imports?: boolean | ImportsOptions;
5090
+ /**
5091
+ * @default false
4520
5092
  */
4521
- imports?: boolean;
5093
+ react?: boolean | ReactOptions;
4522
5094
  }
4523
5095
 
4524
5096
  declare function waltz(options?: WaltzOptions, ...orders: LinterConfig[]): Promise<LinterConfig[]>;
4525
5097
 
4526
5098
  export { waltz as default };
5099
+ export type { ImportsOptions, JsOptions, JsoncOptions, LinterConfig, ReactOptions, SharedOptions, StylisticOptions, TsOptions, UnresolvedLinterConfig, WaltzOptions };