@@ -12,61 +12,31 @@ npm install --save-dev eslint-plugin-react-x
1212## Setup
1313
1414``` js
15- // @ts-check
15+ // eslint.config.js
1616
17+ // @ts-check
1718import js from " @eslint/js" ;
1819import reactx from " eslint-plugin-react-x" ;
19-
20- export default [
21- js .configs .recommended ,
22- {
23- files: [" **/*.{ts,tsx}" ],
24- plugins: {
25- " react-x" : reactx,
26- },
27- rules: {
28- // react-x recommended rules
29- " react-x/ensure-forward-ref-using-ref" : " warn" ,
30- " react-x/no-access-state-in-setstate" : " error" ,
31- " react-x/no-array-index-key" : " warn" ,
32- " react-x/no-children-count" : " warn" ,
33- " react-x/no-children-for-each" : " warn" ,
34- " react-x/no-children-map" : " warn" ,
35- " react-x/no-children-only" : " warn" ,
36- " react-x/no-children-to-array" : " warn" ,
37- " react-x/no-clone-element" : " warn" ,
38- " react-x/no-comment-textnodes" : " warn" ,
39- " react-x/no-component-will-mount" : " error" ,
40- " react-x/no-component-will-receive-props" : " error" ,
41- " react-x/no-component-will-update" : " error" ,
42- " react-x/no-context-provider" : " warn" ,
43- " react-x/no-create-ref" : " error" ,
44- " react-x/no-default-props" : " error" ,
45- " react-x/no-direct-mutation-state" : " error" ,
46- " react-x/no-duplicate-jsx-props" : " warn" ,
47- " react-x/no-duplicate-key" : " warn" ,
48- " react-x/no-forward-ref" : " warn" ,
49- " react-x/no-implicit-key" : " warn" ,
50- " react-x/no-missing-key" : " error" ,
51- " react-x/no-nested-components" : " error" ,
52- " react-x/no-prop-types" : " error" ,
53- " react-x/no-redundant-should-component-update" : " error" ,
54- " react-x/no-set-state-in-component-did-mount" : " warn" ,
55- " react-x/no-set-state-in-component-did-update" : " warn" ,
56- " react-x/no-set-state-in-component-will-update" : " warn" ,
57- " react-x/no-string-refs" : " error" ,
58- " react-x/no-unsafe-component-will-mount" : " warn" ,
59- " react-x/no-unsafe-component-will-receive-props" : " warn" ,
60- " react-x/no-unsafe-component-will-update" : " warn" ,
61- " react-x/no-unstable-context-value" : " warn" ,
62- " react-x/no-unstable-default-props" : " warn" ,
63- " react-x/no-unused-class-component-members" : " warn" ,
64- " react-x/no-unused-state" : " warn" ,
65- " react-x/no-use-context" : " warn" ,
66- " react-x/use-jsx-vars" : " warn" ,
20+ import tseslint from " typescript-eslint" ;
21+
22+ export default tseslint .config ({
23+ files: [" **/*.ts" , " **/*.tsx" ],
24+ extends: [
25+ js .configs .recommended ,
26+ tseslint .configs .recommended ,
27+ reactx .configs .recommended ,
28+ ],
29+ languageOptions: {
30+ parser: tseslint .parser ,
31+ parserOptions: {
32+ projectService: true ,
6733 },
6834 },
69- ];
35+ rules: {
36+ // Put rules you want to override here
37+ " react-x/prefer-shorthand-boolean" : " warn" ,
38+ },
39+ });
7040```
7141
7242## Rules
0 commit comments