|
| 1 | +import babelParser from "@babel/eslint-parser"; |
| 2 | +import jsdoc from "eslint-plugin-jsdoc"; |
| 3 | +import js from "@eslint/js"; |
| 4 | +import globals from "globals"; |
| 5 | + |
| 6 | +export default [ |
| 7 | + js.configs.recommended, |
| 8 | + { |
| 9 | + languageOptions: { |
| 10 | + ecmaVersion: 2022, |
| 11 | + parser: babelParser, |
| 12 | + parserOptions: { |
| 13 | + ecmaVersion: 2022, |
| 14 | + ecmaFeatures: { |
| 15 | + impliedStrict: true |
| 16 | + }, |
| 17 | + sourceType: "module", |
| 18 | + allowImportExportEverywhere: true |
| 19 | + }, |
| 20 | + globals: { |
| 21 | + ...globals.browser, |
| 22 | + ...globals.node, |
| 23 | + ...globals.es6, |
| 24 | + "$": false, |
| 25 | + "jQuery": false, |
| 26 | + "log": false, |
| 27 | + "app": false, |
| 28 | + |
| 29 | + "COMPILE_TIME": false, |
| 30 | + "COMPILE_MSG": false, |
| 31 | + "PKG_VERSION": false |
| 32 | + }, |
| 33 | + }, |
| 34 | + ignores: ["src/core/vendor/**"], |
| 35 | + plugins: { |
| 36 | + jsdoc |
| 37 | + }, |
| 38 | + rules: { |
| 39 | + // enable additional rules |
| 40 | + "no-eval": "error", |
| 41 | + "no-implied-eval": "error", |
| 42 | + "dot-notation": "error", |
| 43 | + "eqeqeq": ["error", "smart"], |
| 44 | + "no-caller": "error", |
| 45 | + "no-extra-bind": "error", |
| 46 | + "no-unused-expressions": "error", |
| 47 | + "no-useless-call": "error", |
| 48 | + "no-useless-return": "error", |
| 49 | + "radix": "warn", |
| 50 | + |
| 51 | + // modify rules from base configurations |
| 52 | + "no-unused-vars": ["error", { |
| 53 | + "args": "none", |
| 54 | + "vars": "all", |
| 55 | + "caughtErrors": "none" |
| 56 | + }], |
| 57 | + "no-empty": ["error", { |
| 58 | + "allowEmptyCatch": true |
| 59 | + }], |
| 60 | + |
| 61 | + // disable rules from base configurations |
| 62 | + "no-control-regex": "off", |
| 63 | + "require-atomic-updates": "off", |
| 64 | + "no-async-promise-executor": "off", |
| 65 | + |
| 66 | + // stylistic conventions |
| 67 | + "brace-style": ["error", "1tbs"], |
| 68 | + "space-before-blocks": ["error", "always"], |
| 69 | + "block-spacing": "error", |
| 70 | + "array-bracket-spacing": "error", |
| 71 | + "comma-spacing": "error", |
| 72 | + "spaced-comment": ["error", "always", { "exceptions": ["/"] }], |
| 73 | + "comma-style": "error", |
| 74 | + "computed-property-spacing": "error", |
| 75 | + "no-trailing-spaces": "warn", |
| 76 | + "eol-last": "error", |
| 77 | + "func-call-spacing": "error", |
| 78 | + "key-spacing": ["warn", { |
| 79 | + "mode": "minimum" |
| 80 | + }], |
| 81 | + "indent": ["error", 4, { |
| 82 | + "ignoreComments": true, |
| 83 | + "ArrayExpression": "first", |
| 84 | + "SwitchCase": 1 |
| 85 | + }], |
| 86 | + "linebreak-style": ["error", "unix"], |
| 87 | + "quotes": ["error", "double", { |
| 88 | + "avoidEscape": true, |
| 89 | + "allowTemplateLiterals": true |
| 90 | + }], |
| 91 | + "camelcase": ["error", { |
| 92 | + "properties": "always" |
| 93 | + }], |
| 94 | + "semi": ["error", "always"], |
| 95 | + "unicode-bom": "error", |
| 96 | + "jsdoc/require-jsdoc": ["error", { |
| 97 | + "require": { |
| 98 | + "FunctionDeclaration": true, |
| 99 | + "MethodDefinition": true, |
| 100 | + "ClassDeclaration": true, |
| 101 | + "ArrowFunctionExpression": false |
| 102 | + } |
| 103 | + }], |
| 104 | + "keyword-spacing": ["error", { |
| 105 | + "before": true, |
| 106 | + "after": true |
| 107 | + }], |
| 108 | + "no-multiple-empty-lines": ["warn", { |
| 109 | + "max": 2, |
| 110 | + "maxEOF": 1, |
| 111 | + "maxBOF": 0 |
| 112 | + }], |
| 113 | + "no-whitespace-before-property": "error", |
| 114 | + "operator-linebreak": ["error", "after"], |
| 115 | + "space-in-parens": "error", |
| 116 | + "no-var": "error", |
| 117 | + "prefer-const": "error", |
| 118 | + "no-console": "error" |
| 119 | + }, |
| 120 | + }, |
| 121 | + // File-pattern specific overrides |
| 122 | + { |
| 123 | + files: ["tests/**/*"], |
| 124 | + rules: { |
| 125 | + "no-unused-expressions": "off", |
| 126 | + "no-console": "off" |
| 127 | + } |
| 128 | + }, |
| 129 | +]; |
0 commit comments