|
| 1 | +const js = require("@eslint/js"); |
| 2 | +const globals = require("globals"); |
| 3 | +const prettier = require("eslint-plugin-prettier"); |
| 4 | +const react = require("eslint-plugin-react"); |
| 5 | +const reactHooks = require("eslint-plugin-react-hooks"); |
| 6 | +const reactIntl = require("@calm/eslint-plugin-react-intl"); |
| 7 | +const prettierConfig = require("eslint-config-prettier"); |
| 8 | + |
| 9 | +module.exports = [ |
| 10 | + js.configs.recommended, |
| 11 | + prettierConfig, |
| 12 | + { |
| 13 | + ignores: ["**/node_modules/", "dist/", "*.min.js"] |
| 14 | + }, |
| 15 | + { |
| 16 | + files: ["**/*.js", "**/*.jsx"], |
| 17 | + languageOptions: { |
| 18 | + ecmaVersion: "latest", |
| 19 | + sourceType: "module", |
| 20 | + parserOptions: { |
| 21 | + ecmaFeatures: { |
| 22 | + jsx: true |
| 23 | + } |
| 24 | + }, |
| 25 | + globals: { |
| 26 | + ...globals.browser, |
| 27 | + ...globals.node, |
| 28 | + THREE: true, |
| 29 | + AFRAME: true, |
| 30 | + NAF: true, |
| 31 | + APP: true |
| 32 | + } |
| 33 | + }, |
| 34 | + plugins: { |
| 35 | + prettier, |
| 36 | + react, |
| 37 | + "react-hooks": reactHooks, |
| 38 | + "@calm/react-intl": reactIntl |
| 39 | + }, |
| 40 | + settings: { |
| 41 | + react: { |
| 42 | + version: "detect" |
| 43 | + } |
| 44 | + }, |
| 45 | + rules: { |
| 46 | + "prettier/prettier": "error", |
| 47 | + "prefer-const": "error", |
| 48 | + "no-use-before-define": "error", |
| 49 | + "no-var": "error", |
| 50 | + "no-throw-literal": "error", |
| 51 | + "no-unused-vars": [ |
| 52 | + "error", |
| 53 | + { |
| 54 | + destructuredArrayIgnorePattern: "^_" |
| 55 | + } |
| 56 | + ], |
| 57 | + "no-console": "off", |
| 58 | + "react-hooks/rules-of-hooks": "error", |
| 59 | + "react-hooks/exhaustive-deps": "error", |
| 60 | + "react/prop-types": "error", |
| 61 | + "@calm/react-intl/missing-formatted-message": "error", |
| 62 | + "@calm/react-intl/missing-attribute": "error", |
| 63 | + "@calm/react-intl/missing-values": "error", |
| 64 | + // React recommended rules |
| 65 | + "react/display-name": "error", |
| 66 | + "react/jsx-key": "error", |
| 67 | + "react/jsx-no-comment-textnodes": "error", |
| 68 | + "react/jsx-no-duplicate-props": "error", |
| 69 | + "react/jsx-no-target-blank": "error", |
| 70 | + "react/jsx-no-undef": "error", |
| 71 | + "react/jsx-uses-react": "error", |
| 72 | + "react/jsx-uses-vars": "error", |
| 73 | + "react/no-children-prop": "error", |
| 74 | + "react/no-danger-with-children": "error", |
| 75 | + "react/no-deprecated": "error", |
| 76 | + "react/no-direct-mutation-state": "error", |
| 77 | + "react/no-find-dom-node": "error", |
| 78 | + "react/no-is-mounted": "error", |
| 79 | + "react/no-render-return-value": "error", |
| 80 | + "react/no-string-refs": "error", |
| 81 | + "react/no-unescaped-entities": "error", |
| 82 | + "react/no-unknown-property": "error", |
| 83 | + "react/no-unsafe": "off", |
| 84 | + "react/require-render-return": "error" |
| 85 | + } |
| 86 | + } |
| 87 | +]; |
0 commit comments