UNPKG

4.1 kBJavaScriptView Raw
1module.exports = {
2 extends: ["prettier", "prettier/react"],
3 env: { browser: true },
4 parserOptions: {
5 ecmaFeatures: {
6 jsx: true,
7 },
8 },
9 plugins: ["react", "react-hooks"],
10 rules: {
11 "react/boolean-prop-naming": [
12 "error",
13 { rule: "^(is|has)[A-Z]([A-Za-z0-9]?)+" },
14 ],
15 "react/button-has-type": "error",
16 "react/default-props-match-prop-types": "off", // PropTypesはもう使わない
17 "react/destructuring-assignment": ["error", "never"],
18 "react/display-name": "error",
19 "react/forbid-component-props": [
20 "error",
21 { forbid: ["style", "className"] },
22 ],
23 "react/forbid-dom-props": "off", // 厳しすぎる
24 "react/forbid-elements": "off",
25 "react/forbid-foreign-prop-types": "off",
26 "react/forbid-prop-types": "off",
27 "react/jsx-boolean-value": "error",
28 "react/jsx-curly-brace-presence": "off",
29 "react/jsx-filename-extension": "off",
30 "react/jsx-fragments": ["error", "syntax"],
31 "react/jsx-handler-names": "error",
32 "react/jsx-key": "error",
33 "react/jsx-max-depth": "off",
34 "react/jsx-no-bind": [
35 "error",
36 {
37 ignoreDOMComponents: false,
38 ignoreRefs: false,
39 allowArrowFunctions: true, // hooks
40 allowFunctions: false,
41 allowBind: false,
42 },
43 ],
44 "react/jsx-no-comment-textnodes": "error",
45 "react/jsx-no-duplicate-props": "error",
46 "react/jsx-no-literals": "off",
47 "react/jsx-no-target-blank": "error",
48 "react/jsx-no-undef": "error",
49 "react/jsx-no-useless-fragment": "error",
50 "react/jsx-pascal-case": "error",
51 "react/jsx-props-no-spreading": "off",
52 "react/jsx-sort-default-props": "off",
53 "react/jsx-sort-props": [
54 "error",
55 {
56 callbacksLast: false,
57 shorthandFirst: false,
58 shorthandLast: false,
59 ignoreCase: true,
60 noSortAlphabetically: true,
61 reservedFirst: true,
62 },
63 ],
64 "react/jsx-uses-react": "error",
65 "react/jsx-uses-vars": "error",
66 "react/no-access-state-in-setstate": "error",
67 "react/no-array-index-key": "warn",
68 "react/no-children-prop": "error",
69 "react/no-danger": "off", // 使うときはそもそも覚悟してる
70 "react/no-danger-with-children": "error",
71 "react/no-deprecated": "error",
72 "react/no-did-mount-set-state": "error",
73 "react/no-did-update-set-state": "error",
74 "react/no-direct-mutation-state": "error",
75 "react/no-find-dom-node": "error",
76 "react/no-is-mounted": "error",
77 "react/no-multi-comp": ["warn", { ignoreStateless: true }],
78 "react/no-redundant-should-component-update": "error",
79 "react/no-render-return-value": "error",
80 "react/no-set-state": "off", // ストイックすぎる
81 "react/no-string-refs": "error",
82 "react/no-this-in-sfc": "error",
83 "react/no-typos": "error",
84 "react/no-unescaped-entities": "error",
85 "react/no-unknown-property": "error",
86 "react/no-unsafe": "error",
87 "react/no-unused-prop-types": "off",
88 "react/no-unused-state": "error",
89 "react/no-will-update-set-state": "error",
90 "react/prefer-es6-class": ["error", "always"],
91 "react/prefer-read-only-props": "error",
92 "react/prefer-stateless-function": "off",
93 "react/prop-types": "off",
94 "react/react-in-jsx-scope": "error",
95 "react/require-default-props": "off", // PropTypesに依存
96 "react/require-optimization": "off",
97 "react/require-render-return": "error",
98 "react/self-closing-comp": [
99 "error",
100 {
101 component: true,
102 html: false,
103 },
104 ],
105 "react/sort-comp": [
106 "error",
107 {
108 order: [
109 "static-methods",
110 "lifecycle",
111 "/^on.+$/",
112 "everything-else",
113 "render",
114 ],
115 },
116 ],
117 "react/sort-prop-types": "off",
118 "react/state-in-constructor": "off",
119 "react/static-property-placement": "error",
120 "react/style-prop-object": "error",
121 "react/void-dom-elements-no-children": "error",
122 "react-hooks/rules-of-hooks": "error",
123 "react-hooks/exhaustive-deps": "warn",
124 },
125};