|
| 1 | +const { |
| 2 | + defineConfig, |
| 3 | +} = require("eslint/config"); |
| 4 | + |
| 5 | +const globals = require("globals"); |
| 6 | +const babelParser = require("@babel/eslint-parser"); |
| 7 | +const react = require("eslint-plugin-react"); |
| 8 | +const js = require("@eslint/js"); |
| 9 | + |
| 10 | +const { |
| 11 | + FlatCompat, |
| 12 | +} = require("@eslint/eslintrc"); |
| 13 | + |
| 14 | +const compat = new FlatCompat({ |
| 15 | + baseDirectory: __dirname, |
| 16 | + recommendedConfig: js.configs.recommended, |
| 17 | + allConfig: js.configs.all |
| 18 | +}); |
| 19 | + |
| 20 | +module.exports = defineConfig([{ |
| 21 | + ignores: [ |
| 22 | + "node_modules/**", |
| 23 | + "**/*.test.js", |
| 24 | + "src/utils/**", |
| 25 | + ".cache/**", |
| 26 | + ".github/**", |
| 27 | + "assets/**", |
| 28 | + "public/**", |
| 29 | + ".babelrc", |
| 30 | + ".env.development", |
| 31 | + "CNAME", |
| 32 | + "CODE_OF_CONDUCT.md", |
| 33 | + "CODEOWNERS", |
| 34 | + "font-preload-cache.json", |
| 35 | + "LICENSE", |
| 36 | + "Makefile", |
| 37 | + "README.md", |
| 38 | + "package.json", |
| 39 | + "package-lock.json", |
| 40 | + "static/**", |
| 41 | + ] |
| 42 | +}, |
| 43 | +{ |
| 44 | + languageOptions: { |
| 45 | + globals: { |
| 46 | + ...globals.browser, |
| 47 | + ...globals.node, |
| 48 | + ...globals.amd, |
| 49 | + }, |
| 50 | + |
| 51 | + parser: babelParser, |
| 52 | + "ecmaVersion": 2018, |
| 53 | + "sourceType": "module", |
| 54 | + |
| 55 | + parserOptions: { |
| 56 | + "ecmaFeatures": { |
| 57 | + "jsx": true, |
| 58 | + }, |
| 59 | + }, |
| 60 | + }, |
| 61 | + |
| 62 | + "settings": { |
| 63 | + "react": { |
| 64 | + "version": "detect", |
| 65 | + }, |
| 66 | + }, |
| 67 | + |
| 68 | + extends: compat.extends("eslint:recommended", "plugin:react/recommended"), |
| 69 | + |
| 70 | + plugins: { |
| 71 | + react, |
| 72 | + }, |
| 73 | + |
| 74 | + "rules": { |
| 75 | + "array-bracket-spacing": ["error", "never"], |
| 76 | + "comma-style": ["error"], |
| 77 | + |
| 78 | + "arrow-spacing": ["error", { |
| 79 | + "after": true, |
| 80 | + "before": true, |
| 81 | + }], |
| 82 | + |
| 83 | + "block-scoped-var": "error", |
| 84 | + "block-spacing": "error", |
| 85 | + "brace-style": ["error", "1tbs"], |
| 86 | + "jsx-quotes": ["error", "prefer-double"], |
| 87 | + "keyword-spacing": "error", |
| 88 | + |
| 89 | + "key-spacing": ["error", { |
| 90 | + "beforeColon": false, |
| 91 | + "afterColon": true, |
| 92 | + }], |
| 93 | + |
| 94 | + "no-unused-vars": ["warn", { |
| 95 | + "varsIgnorePattern": "React", |
| 96 | + }], |
| 97 | + |
| 98 | + "no-trailing-spaces": "error", |
| 99 | + "object-curly-spacing": ["error", "always"], |
| 100 | + "react/display-name": 0, |
| 101 | + "react/prop-types": 0, |
| 102 | + "react/no-unescaped-entities": [0], |
| 103 | + "react/jsx-no-duplicate-props": [0], |
| 104 | + |
| 105 | + "indent": ["error", 2, { |
| 106 | + "FunctionExpression": { |
| 107 | + "parameters": "first", |
| 108 | + }, |
| 109 | + |
| 110 | + "FunctionDeclaration": { |
| 111 | + "parameters": "first", |
| 112 | + }, |
| 113 | + |
| 114 | + "MemberExpression": 1, |
| 115 | + "SwitchCase": 1, |
| 116 | + "outerIIFEBody": 0, |
| 117 | + |
| 118 | + "VariableDeclarator": { |
| 119 | + "var": 2, |
| 120 | + "let": 2, |
| 121 | + "const": 3, |
| 122 | + }, |
| 123 | + |
| 124 | + ignoredNodes: ["TemplateLiteral"], |
| 125 | + }], |
| 126 | + |
| 127 | + "linebreak-style": ["error", "unix"], |
| 128 | + "quotes": ["error", "double"], |
| 129 | + "semi": ["error", "always"], |
| 130 | + "strict": 0, |
| 131 | + "valid-typeof": 0, |
| 132 | + |
| 133 | + "space-unary-ops": [1, { |
| 134 | + "words": true, |
| 135 | + "nonwords": false, |
| 136 | + }], |
| 137 | + |
| 138 | + "space-infix-ops": ["error"], |
| 139 | + }, |
| 140 | +} |
| 141 | +]); |
0 commit comments