|
13 | 13 | "parser": "babel-eslint",
|
14 | 14 | "rules": {
|
15 | 15 | "arrow-parens": ["error", "always"],
|
16 |
| - "import/no-unresolved": "off", |
| 16 | + // This makes sure imported modules exist. |
| 17 | + "import/no-unresolved": ["error"], |
| 18 | + // This makes sure imported names exist. |
| 19 | + "import/named": ["error"], |
| 20 | + // This will catch accidental default imports when no default is defined. |
| 21 | + "import/default": ["error"], |
| 22 | + // This makes sure `*' imports are dereferenced to real exports. |
| 23 | + "import/namespace": ["error"], |
| 24 | + // This catches any export mistakes. |
| 25 | + "import/export": ["error"], |
| 26 | + // This catches default names that conflict with actual exported names. |
| 27 | + // For example, this was probably a typo: |
| 28 | + // import foo from 'bar'; |
| 29 | + // that should be corrected as: |
| 30 | + // import { foo } from 'bar'; |
| 31 | + "import/no-named-as-default": ["error"], |
| 32 | + // This catches possible typos like trying to access a real export on a |
| 33 | + // default import. |
| 34 | + "import/no-named-as-default-member": ["error"], |
| 35 | + // This prevents exporting a mutable variable. |
| 36 | + "import/no-mutable-exports": ["error"], |
| 37 | + // This makes sure package.json defines dev vs. prod dependencies correctly. |
| 38 | + "import/no-extraneous-dependencies": ["error", { |
| 39 | + // The following are not allowed to be imported. See .eslintrc in other |
| 40 | + // directories (like ./test) for where this gets overidden. |
| 41 | + "devDependencies": false, "optionalDependencies": false, "peerDependencies": false |
| 42 | + }], |
| 43 | + // This ensures imports are at the top of the file. |
| 44 | + "import/imports-first": ["error"], |
| 45 | + // This catches duplicate exports. |
| 46 | + "import/no-duplicates": ["error"], |
| 47 | + // This ensures import statements never provide a file extension in the path. |
| 48 | + "import/extensions": ["error", "never"], |
| 49 | + // This ensures imports are organized by type and that groups are separated |
| 50 | + // by a new line. |
| 51 | + "import/order": ["error", { |
| 52 | + "groups": [ |
| 53 | + "builtin", "external", "internal", ["parent", "sibling"], "index" |
| 54 | + ], |
| 55 | + "newlines-between": "always" |
| 56 | + }], |
| 57 | + // This ensures a new line after all import statements. |
| 58 | + "import/newline-after-import": ["error"], |
17 | 59 | "no-underscore-dangle": "off",
|
18 | 60 | "space-before-function-paren": ["error", "never"],
|
19 | 61 | "react/prefer-stateless-function": "off",
|
20 | 62 | "react/jsx-indent-props": "off",
|
21 | 63 | "react/jsx-closing-bracket-location": "off",
|
22 | 64 | "react/jsx-first-prop-new-line": "off"
|
| 65 | + }, |
| 66 | + "settings": { |
| 67 | + "import/ignore": [ |
| 68 | + // Because of CommonJS incompatibility, we can't |
| 69 | + // check for bad imports in node_modules. |
| 70 | + "node_modules", |
| 71 | + // Ignore non-JS imports. |
| 72 | + "\\.scss$", |
| 73 | + "\\.jpg$", |
| 74 | + "\\.mp4$", |
| 75 | + "\\.webm$" |
| 76 | + ], |
| 77 | + "import/resolver": { |
| 78 | + "node": { |
| 79 | + // This adds ./src for relative imports. |
| 80 | + "moduleDirectory": ["node_modules", "src"] |
| 81 | + } |
| 82 | + } |
23 | 83 | }
|
24 | 84 | }
|
0 commit comments