|
| 1 | + |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 3 | +# or more contributor license agreements. See the NOTICE file |
| 4 | +# distributed with this work for additional information |
| 5 | +# regarding copyright ownership. The ASF licenses this file |
| 6 | +# to you under the Apache License, Version 2.0 (the |
| 7 | +# "License"); you may not use this file except in compliance |
| 8 | +# with the License. You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, |
| 13 | +# software distributed under the License is distributed on an |
| 14 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | +# KIND, either express or implied. See the License for the |
| 16 | +# specific language governing permissions and limitations |
| 17 | +# under the License. |
| 18 | + |
| 19 | +extends: './.eslintrc-common.yaml' |
| 20 | +parser: "@typescript-eslint/parser" |
| 21 | +parserOptions: |
| 22 | + ecmaVersion: 6 |
| 23 | + sourceType: module |
| 24 | + ecmaFeatures: |
| 25 | + modules: true |
| 26 | + project: "tsconfig.json" |
| 27 | +plugins: |
| 28 | + - "@typescript-eslint" |
| 29 | + - '@echarts-x/ec' |
| 30 | +env: |
| 31 | + # Do not set `browser: true, node: true`, which introduces some global variables |
| 32 | + # (e.g., "require", "global"), which bypasses checks and may lead to errors. |
| 33 | + es6: false |
| 34 | +globals: |
| 35 | + console: false |
| 36 | + setTimeout: true |
| 37 | + clearTimeout: true |
| 38 | + navigator: false |
| 39 | + __DEV__: true |
| 40 | +rules: |
| 41 | + "no-restricted-syntax": |
| 42 | + - 2 |
| 43 | + - |
| 44 | + "selector": "SpreadElement" |
| 45 | + "message": "Spread syntax is unnecessary; it introduces verbose code after compilation." |
| 46 | + - |
| 47 | + "selector": "AssignmentPattern" |
| 48 | + "message": "Default parameters only apply to undefined, but echarts treats undefined and null the same." |
| 49 | + - |
| 50 | + "selector": "FunctionDeclaration[async=true]" |
| 51 | + "message": "No need to use async/await yet; it introduces verbose code after compilation." |
| 52 | + - |
| 53 | + "selector": "ArrowFunctionExpression[async=true]" |
| 54 | + "message": "No need to use async/await yet; it introduces verbose code after compilation." |
| 55 | + - |
| 56 | + "selector": "AwaitExpression" |
| 57 | + "message": "No need to use async/await yet; it introduces verbose code after compilation." |
| 58 | + "@echarts-x/ec/no-props-polyfill-uncertain": |
| 59 | + # Currently, echarts does not officially discard legacy platforms. The following methods are |
| 60 | + # not polyfilled, and alternatives are widely used in this codebase by convention, which also |
| 61 | + # benefits compression. |
| 62 | + - 2 |
| 63 | + - {"receiver": "Array.prototype", "method": "map", "message": "Use `map` in `zrender/src/core/util.ts` instead."} |
| 64 | + - {"receiver": "Array.prototype", "method": "forEach", "message": "Use `each` in `zrender/src/core/util.ts` instead."} |
| 65 | + - {"receiver": "Array.prototype", "method": "reduce", "message": "Use `reduce` or `each` in `zrender/src/core/util.ts` instead."} |
| 66 | + - {"receiver": "Array.prototype", "method": "reduceRight", "message": "Use `reduce` or `each` in `zrender/src/core/util.ts` instead."} |
| 67 | + - {"receiver": "Array.prototype", "method": "filter", "message": "Use `filter` in `zrender/src/core/util.ts` instead."} |
| 68 | + - {"receiver": "Array.prototype", "method": "indexOf", "message": "Use `indexOf` in `zrender/src/core/util.ts` instead."} |
| 69 | + - {"receiver": "Array.prototype", "method": "find", "message": "Use `find` in `zrender/src/core/util.ts` instead."} |
| 70 | + - {"receiver": "Array.prototype", "method": "findIndex", "message": "Use `find` in `zrender/src/core/util.ts` instead."} |
| 71 | + - {"receiver": "Array.prototype", "method": "findLast", "message": "Use `find` in `zrender/src/core/util.ts` instead."} |
| 72 | + - {"receiver": "Array.prototype", "method": "findLastIndex", "message": "Use `find` in `zrender/src/core/util.ts` instead."} |
| 73 | + - {"receiver": "Array.prototype", "method": "includes", "message": "Use `indexOf` in `zrender/src/core/util.ts` instead."} |
| 74 | + - {"receiver": "Array.prototype", "method": "some", "message": "Use `find` in `zrender/src/core/util.ts` instead."} |
| 75 | + - {"receiver": "Array.prototype", "method": "flat"} |
| 76 | + - {"receiver": "Array.prototype", "method": "flatMap"} |
| 77 | + - {"receiver": "Array.prototype", "method": "at"} |
| 78 | + - {"receiver": "Array.prototype", "method": "every"} |
| 79 | + - {"receiver": "Array.prototype", "method": "fill"} |
| 80 | + - {"receiver": "String.prototype", "method": "startsWith", "message": "Use `String.prototype.indexOf` instead."} |
| 81 | + - {"receiver": "String.prototype", "method": "endsWith", "message": "Use `String.prototype.indexOf` instead."} |
| 82 | + - {"receiver": "String.prototype", "method": "includes", "message": "Use `String.prototype.indexOf` instead."} |
| 83 | + - {"receiver": "String.prototype", "method": "repeat"} |
| 84 | + - {"receiver": "String.prototype", "method": "padStart"} |
| 85 | + - {"receiver": "String.prototype", "method": "padEnd"} |
| 86 | + - {"receiver": "String.prototype", "method": "matchAll"} |
| 87 | + - {"receiver": "String.prototype", "method": "replaceAll"} |
| 88 | + - {"receiver": "Array", "method": "isArray", "message": "Use `isArray` in `zrender/src/core/util.ts` instead."} |
| 89 | + - {"receiver": "Function", "method": "bind", "message": "Use `bind` in `zrender/src/core/util.ts` instead."} |
| 90 | + - {"receiver": "Function.prototype", "method": "bind", "message": "Use `bind` in `zrender/src/core/util.ts` instead."} |
| 91 | + - {"receiver": "Date", "method": "now", "message": "Use `+(new Date())` instead."} |
| 92 | + - {"receiver": "Date.prototype", "method": "toJSON"} |
| 93 | + - {"receiver": "Object", "method": "assign", "message": "Use `extend` or `defaults` in `zrender/src/core/util.ts` instead."} |
| 94 | + - {"receiver": "Object", "method": "keys", "message": "Use `keys` in `zrender/src/core/util.ts` instead."} |
| 95 | + - {"receiver": "Object", "method": "seal", "message": "Typically not necessary in production code."} |
| 96 | + - {"receiver": "Object", "method": "isSealed", "message": "Typically not necessary in production code."} |
| 97 | + - {"receiver": "Object", "method": "freeze", "message": "Typically not necessary in production code."} |
| 98 | + - {"receiver": "Object", "method": "isFrozen", "message": "Typically not necessary in production code."} |
| 99 | + - {"receiver": "Object", "method": "isExtensible", "message": "Typically not necessary in production code."} |
| 100 | + - {"receiver": "Object", "method": "preventExtensions", "message": "Typically not necessary in production code."} |
| 101 | + - {"receiver": "Object", "method": "create", "message": "Typically not necessary in production code."} |
| 102 | + - {"receiver": "Object", "method": "defineProperty", "message": "Typically not necessary in production code."} |
| 103 | + - {"receiver": "Object", "method": "defineProperties", "message": "Typically not necessary in production code."} |
| 104 | + - {"receiver": "Object", "method": "getOwnPropertyDescriptor", "message": "Typically not necessary in production code."} |
| 105 | + - {"receiver": "Object", "method": "getOwnPropertyNames", "message": "Typically not necessary in production code."} |
| 106 | + - {"receiver": "Object", "method": "is", "message": "Typically not necessary in production code."} |
| 107 | + - {"receiver": "Object", "method": "entries", "message": "Typically not necessary in production code."} |
| 108 | + - {"receiver": "Object", "method": "values", "message": "Typically not necessary in production code."} |
| 109 | + - {"receiver": "Object", "method": "fromEntries", "message": "Typically not necessary in production code."} |
| 110 | + - {"receiver": "Object", "method": "hasOwn", "message": "Typically not necessary in production code."} |
| 111 | + "no-restricted-globals": |
| 112 | + - 2 |
| 113 | + # Avoid dangerous usage of globals for production code. |
| 114 | + - "event" |
| 115 | + - "name" |
| 116 | + - "length" |
| 117 | + - "orientation" |
| 118 | + - "top" |
| 119 | + - "parent" |
| 120 | + - "location" |
| 121 | + - "closed" |
| 122 | + - "jQuery" |
| 123 | + - "$" |
| 124 | + # No need to use them yet. |
| 125 | + - "Promise" |
| 126 | + # Currently, echarts does not officially discard legacy platforms. The following methods are |
| 127 | + # not polyfilled, and alternatives are widely used in this codebase by convention, which also |
| 128 | + # benefits compression. |
| 129 | + - {name: "Map", message: "Use `HashMap` in `zrender/src/core/util.ts` instead."} |
| 130 | + - {name: "Set", message: "Use `HashMap` in `zrender/src/core/util.ts` instead."} |
| 131 | + - {name: "WeakMap", message: "No polyfill for it. Typically it is not necessary. Use `makeInner` or `src/util/cycleCache` instead."} |
| 132 | + - {name: "WeakSet", message: "No polyfill for it. Typically it is not necessary. Use `makeInner` or `src/util/cycleCache` instead."} |
| 133 | + - {name: "Symbol", message: "No polyfill for it. Typically it is not necessary."} |
| 134 | + - {name: "Proxy", message: "No polyfill for it. Typically it is not necessary."} |
| 135 | + - {name: "Reflect", message: "No polyfill for it. Typically it is not necessary."} |
| 136 | + - {name: "Intl", message: "No polyfill for it. Typically it is not necessary."} |
| 137 | + - {name: "Atomics", message: "No polyfill for it. Typically it is not necessary."} |
0 commit comments