|
| 1 | +import globals from "globals"; |
| 2 | +import pluginJs from "@eslint/js"; |
| 3 | +import tseslint from "typescript-eslint"; |
| 4 | + |
| 5 | +export default tseslint.config( |
| 6 | + pluginJs.configs.recommended, |
| 7 | + ...tseslint.configs.recommended, |
| 8 | + { |
| 9 | + ignores: [ |
| 10 | + "*.js", |
| 11 | + "node_modules/", |
| 12 | + "release/", |
| 13 | + "docs/", |
| 14 | + "dist/" |
| 15 | + ] |
| 16 | + }, |
| 17 | + { |
| 18 | + files: ["src/**/*.ts"], |
| 19 | + languageOptions: { |
| 20 | + globals: { |
| 21 | + ...globals.browser, |
| 22 | + ...globals.node, |
| 23 | + ArrayBuffer: true, |
| 24 | + ArrayBufferView: true, |
| 25 | + Promise: true, |
| 26 | + NodeJS: true, |
| 27 | + Int8Array: true, |
| 28 | + Uint8Array: true, |
| 29 | + Int16Array: true, |
| 30 | + Uint16Array: true, |
| 31 | + Int32Array: true, |
| 32 | + Uint32Array: true, |
| 33 | + Float32Array: true, |
| 34 | + Float64Array: true |
| 35 | + }, |
| 36 | + parserOptions: { |
| 37 | + ecmaVersion: 2020 |
| 38 | + } |
| 39 | + }, |
| 40 | + rules: { |
| 41 | + "complexity": ["warn"], |
| 42 | + "max-statements": ["warn", 15], |
| 43 | + "no-debugger": 2, |
| 44 | + "no-console": [ |
| 45 | + 2, |
| 46 | + { |
| 47 | + allow: ["warn", "error"] |
| 48 | + } |
| 49 | + ], |
| 50 | + "no-bitwise": 2, |
| 51 | + "curly": 2, |
| 52 | + "eqeqeq": 2, |
| 53 | + "no-eval": 2, |
| 54 | + "no-loop-func": 0, |
| 55 | + "no-caller": 2, |
| 56 | + "no-script-url": 2, |
| 57 | + "@typescript-eslint/no-shadow": ["warn"], |
| 58 | + "no-shadow": "off", |
| 59 | + "no-new-func": 0, |
| 60 | + "no-new-wrappers": 0, |
| 61 | + "no-undef": "off", |
| 62 | + "new-cap": [ |
| 63 | + "error", { |
| 64 | + "capIsNewExceptions": [ "Authorize", "Discover" ] |
| 65 | + } |
| 66 | + ], |
| 67 | + "no-empty": 2, |
| 68 | + "no-new": 2, |
| 69 | + "no-useless-escape": 0, |
| 70 | + "block-spacing": 2, |
| 71 | + "indent": [ |
| 72 | + "error", |
| 73 | + 2, |
| 74 | + { |
| 75 | + "SwitchCase": 1, |
| 76 | + "VariableDeclarator": 2, |
| 77 | + "MemberExpression": "off", |
| 78 | + "CallExpression": { |
| 79 | + arguments: "off" |
| 80 | + } |
| 81 | + } |
| 82 | + ], |
| 83 | + "no-multi-str": 2, |
| 84 | + "semi": 2, |
| 85 | + "arrow-spacing": 2, |
| 86 | + "no-prototype-builtins": 1, |
| 87 | + "@typescript-eslint/no-explicit-any": 1, |
| 88 | + "@typescript-eslint/no-var-requires": 1, |
| 89 | + "@typescript-eslint/no-unsafe-declaration-merging": 1, |
| 90 | + "@typescript-eslint/no-unused-vars": 1, |
| 91 | + "@typescript-eslint/no-use-before-define": 1, |
| 92 | + "@typescript-eslint/no-empty-object-type": 1, |
| 93 | + "@typescript-eslint/no-unsafe-function-type": 1, |
| 94 | + "preserve-caught-error": 0 |
| 95 | + } |
| 96 | + }, |
| 97 | + { |
| 98 | + files: ["test/unit/**/*.mjs", "test/unit/**/*.js"], |
| 99 | + languageOptions: { |
| 100 | + globals: { |
| 101 | + ...globals.mocha, |
| 102 | + ...globals.node, |
| 103 | + ...globals.browser |
| 104 | + }, |
| 105 | + }, |
| 106 | + rules: { |
| 107 | + "max-statements": 0, |
| 108 | + "@typescript-eslint/no-empty-function": 0, |
| 109 | + "@typescript-eslint/no-unused-vars": 1, |
| 110 | + "@typescript-eslint/no-unused-expressions": 0, |
| 111 | + "no-unused-expressions": 0, |
| 112 | + "no-useless-escape": 0 |
| 113 | + } |
| 114 | + } |
| 115 | +); |
0 commit comments