|
1 | 1 | {
|
| 2 | + "root": true, |
| 3 | + "env": { |
| 4 | + "browser": true, |
| 5 | + "es6": true, |
| 6 | + "node": true, |
| 7 | + "jest": true |
| 8 | + }, |
2 | 9 | "extends": [
|
3 | 10 | "airbnb",
|
4 | 11 | "airbnb/hooks",
|
|
7 | 14 | "plugin:react-hooks/recommended",
|
8 | 15 | "plugin:jsx-a11y/recommended",
|
9 | 16 | "plugin:import/recommended"
|
10 |
| - // "plugin:node/recommended" |
11 | 17 | ],
|
12 |
| - "plugins": ["prettier", "react", "import"], |
| 18 | + "plugins": ["prettier", "react", "import", "simple-import-sort", "sort-exports"], |
13 | 19 | "parserOptions": {
|
14 | 20 | "ecmaFeatures": {
|
15 | 21 | "jsx": true
|
16 |
| - } |
| 22 | + }, |
| 23 | + "ecmaVersion": "latest", |
| 24 | + "sourceType": "module" |
17 | 25 | },
|
18 | 26 | "rules": {
|
19 | 27 | "prettier/prettier": ["error"],
|
20 | 28 |
|
21 | 29 | "react-hooks/exhaustive-deps": "warn",
|
22 | 30 | "react-hooks/rules-of-hooks": "error",
|
23 | 31 | "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
|
24 |
| - "react/jsx-indent-props": [2, 4], |
25 |
| - "react/jsx-indent": [2, 4], |
| 32 | + "react/jsx-indent-props": [2, 2], |
| 33 | + "react/jsx-indent": [2, 2], |
26 | 34 | "react/jsx-one-expression-per-line": [0],
|
27 | 35 | "react/prefer-stateless-function": [1],
|
28 | 36 | "react/static-property-placement": [1, "property assignment"],
|
29 | 37 | "react/no-multi-comp": ["error", { "ignoreStateless": true }],
|
| 38 | + "react/prop-types": "warn", |
30 | 39 |
|
31 | 40 | "semi": 2,
|
32 | 41 | "comma-dangle": "error",
|
|
38 | 47 | "prefer-template": "warn",
|
39 | 48 | "template-curly-spacing": ["error", "never"],
|
40 | 49 | "jsx-quotes": ["warn", "prefer-double"],
|
41 |
| - "camelcase": ["error", { "properties": "always" }], |
| 50 | + "camelcase": ["warn", { "properties": "always" }], |
42 | 51 | "no-unused-vars": ["warn"],
|
43 | 52 |
|
44 | 53 | "import/prefer-default-export": ["warn", { "target": "any" }],
|
45 | 54 | "import/no-duplicates": ["error", { "considerQueryString": true }],
|
46 |
| - "import/order": [ |
47 |
| - "error", |
48 |
| - { |
49 |
| - "groups": ["builtin", "external", "internal"], |
50 |
| - "pathGroups": [ |
| 55 | + "simple-import-sort/imports": "error", |
| 56 | + "simple-import-sort/exports": "error", |
| 57 | + "import/first": "error", |
| 58 | + "import/newline-after-import": "error", |
| 59 | + |
| 60 | + "sort-exports/sort-exports": ["error", { "sortDir": "asc" }] |
| 61 | + }, |
| 62 | + "overrides": [ |
| 63 | + // Exceptions for ESLint related files |
| 64 | + { |
| 65 | + "env": { |
| 66 | + "node": true |
| 67 | + }, |
| 68 | + "files": [".eslintrc.{js,cjs}"], |
| 69 | + "parserOptions": { |
| 70 | + "sourceType": "script" |
| 71 | + } |
| 72 | + }, |
| 73 | + // Override "simple-import-sort" config |
| 74 | + { |
| 75 | + "files": ["*.js", "*.jsx", "*.ts", "*.tsx"], |
| 76 | + "rules": { |
| 77 | + "simple-import-sort/imports": [ |
| 78 | + "error", |
51 | 79 | {
|
52 |
| - "pattern": "react", |
53 |
| - "group": "external", |
54 |
| - "position": "before" |
| 80 | + "groups": [ |
| 81 | + // Packages `react` related packages come first. |
| 82 | + ["^react", "^@?\\w"], |
| 83 | + // Internal packages. |
| 84 | + ["^(@|components)(/.*|$)"], |
| 85 | + // Side effect imports. |
| 86 | + ["^\\u0000"], |
| 87 | + // Parent imports. Put `..` last. |
| 88 | + ["^\\.\\.(?!/?$)", "^\\.\\./?$"], |
| 89 | + // Other relative imports. Put same-folder imports and `.` last. |
| 90 | + ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"], |
| 91 | + // Style imports. |
| 92 | + ["^.+\\.?(css)$"] |
| 93 | + ] |
55 | 94 | }
|
56 | 95 | ],
|
57 |
| - "pathGroupsExcludedImportTypes": ["react"], |
58 |
| - "newlines-between": "always", |
59 |
| - "alphabetize": { |
60 |
| - "order": "asc", |
61 |
| - "caseInsensitive": true |
62 |
| - } |
| 96 | + "simple-import-sort/exports": "error" |
63 | 97 | }
|
64 |
| - ] |
65 |
| - } |
| 98 | + }, |
| 99 | + // Exception rules for specific packages |
| 100 | + { |
| 101 | + "files": ["*.js", "*.jsx", "*.ts", "*.tsx"], |
| 102 | + "rules": { |
| 103 | + "no-underscore-dangle": [ |
| 104 | + "error", |
| 105 | + { |
| 106 | + // Rewire methods |
| 107 | + "allow": ["__get__", "__set__", "__reset__"] |
| 108 | + } |
| 109 | + ] |
| 110 | + } |
| 111 | + } |
| 112 | + ] |
66 | 113 | }
|
0 commit comments