UNPKG

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