| 错误 | 解决 |
|---|---|
| error Unexpected tab character | “no-tabs”: 0 |
| Newline required at end of file but not found | eol-last: 0 |
| Missing space before function parentheses | “space-before-function-paren”: 0, |
| Expected indentation of 2 spaces but found 1 tab | “indent”: “off” |
| ‘require’ and ‘process’ is not defined | node: true |
| upgrade es version | ecmaVersion: 2020 |
warning Delete ␍ |
‘prettier/prettier’: [ ‘error’, { endOfLine:’auto’, }, ], |
env: {browser: true,es6: true,node: true},rules: {'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off','no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',"no-tabs": 0,"eol-last":0,"space-before-function-paren": 0,"indent": "off"},parserOptions: {ecmaVersion: 2020,sourceType: 'module'},
同时废除多个规则
,号隔开
// eslint-disable-next-line no-multi-assign,new-capconst widget = new (window as any).TradingView.widget({ ...config, datafeed })
禁用 min.js 报错
- 禁入导入报错
- 禁用文件报错
// eslint-disable-next-line import/extensionsimport 'lib/charting_library/charting_library.min.js'
/* eslint-disable */
Eslint-prettier
在 eslint 中重写 prettierrules: {'prettier/prettier': ['error',{endOfLine: 'auto',quoteProps: 'as-needed',},],}
