|
| 1 | +import jest from "eslint-plugin-jest" |
| 2 | +import js from "@eslint/js" |
| 3 | +import stylisticJs from "@stylistic/eslint-plugin-js" |
| 4 | + |
| 5 | +export default [ |
| 6 | + { |
| 7 | + // eslint config is very unintuitive; they will match an js file in any |
| 8 | + // directory by default and you can only expand this; |
| 9 | + // moreover, to have a global ignore, it must be specified without |
| 10 | + // any other key as a separate object... |
| 11 | + ignores: [ |
| 12 | + "integration_test/", |
| 13 | + "installer/", |
| 14 | + "doc/", |
| 15 | + "deps/", |
| 16 | + "coverage/", |
| 17 | + "priv/", |
| 18 | + "tmp/", |
| 19 | + "test/" |
| 20 | + ], |
| 21 | + }, |
| 22 | + { |
| 23 | + ...js.configs.recommended, |
| 24 | + |
| 25 | + plugins: { |
| 26 | + jest, |
| 27 | + "@stylistic/js": stylisticJs |
| 28 | + }, |
| 29 | + |
| 30 | + languageOptions: { |
| 31 | + globals: { |
| 32 | + ...jest.environments.globals.globals, |
| 33 | + global: "writable", |
| 34 | + }, |
| 35 | + |
| 36 | + ecmaVersion: 12, |
| 37 | + sourceType: "module", |
| 38 | + }, |
| 39 | + |
| 40 | + rules: { |
| 41 | + "@stylistic/js/indent": ["error", 2, { |
| 42 | + SwitchCase: 1, |
| 43 | + }], |
| 44 | + |
| 45 | + "@stylistic/js/linebreak-style": ["error", "unix"], |
| 46 | + "@stylistic/js/quotes": ["error", "double"], |
| 47 | + "@stylistic/js/semi": ["error", "never"], |
| 48 | + |
| 49 | + "@stylistic/js/object-curly-spacing": ["error", "never", { |
| 50 | + objectsInObjects: false, |
| 51 | + arraysInObjects: false, |
| 52 | + }], |
| 53 | + |
| 54 | + "@stylistic/js/array-bracket-spacing": ["error", "never"], |
| 55 | + |
| 56 | + "@stylistic/js/comma-spacing": ["error", { |
| 57 | + before: false, |
| 58 | + after: true, |
| 59 | + }], |
| 60 | + |
| 61 | + "@stylistic/js/computed-property-spacing": ["error", "never"], |
| 62 | + |
| 63 | + "@stylistic/js/space-before-blocks": ["error", { |
| 64 | + functions: "never", |
| 65 | + keywords: "never", |
| 66 | + classes: "always", |
| 67 | + }], |
| 68 | + |
| 69 | + "@stylistic/js/keyword-spacing": ["error", { |
| 70 | + overrides: { |
| 71 | + if: { |
| 72 | + after: false, |
| 73 | + }, |
| 74 | + |
| 75 | + for: { |
| 76 | + after: false, |
| 77 | + }, |
| 78 | + |
| 79 | + while: { |
| 80 | + after: false, |
| 81 | + }, |
| 82 | + |
| 83 | + switch: { |
| 84 | + after: false, |
| 85 | + }, |
| 86 | + }, |
| 87 | + }], |
| 88 | + |
| 89 | + "@stylistic/js/eol-last": ["error", "always"], |
| 90 | + |
| 91 | + "no-unused-vars": ["error", { |
| 92 | + argsIgnorePattern: "^_", |
| 93 | + varsIgnorePattern: "^_", |
| 94 | + }], |
| 95 | + |
| 96 | + "no-useless-escape": "off", |
| 97 | + "no-cond-assign": "off", |
| 98 | + "no-case-declarations": "off", |
| 99 | + }, |
| 100 | + }] |
0 commit comments