-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.eslintrc
27 lines (27 loc) · 1.2 KB
/
.eslintrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
"extends": ["taro/react"],
"parser": "@babel/eslint-parser", // eslint解析器
"rules": {
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"no-unused-vars": ["error", { "varsIgnorePattern": "Taro|wx" }],
"no-mixed-spaces-and-tabs": 2, // 禁止空格和 tab 的混合缩进
"no-debugger": 2, //禁止有debugger
"space-infix-ops": 2, // 要求操作符周围有空格
"space-before-blocks": 2, // 要求语句块之前有空格
"indent": ["error", 2, { "SwitchCase": 1 }], // 缩进使用两个空格
"jsx-quotes": ["error", "prefer-double"], // JSX属性使用双引号
"import/first": 0 // 消除绝对路径必须要在相对路径前引入的问题
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"legacyDecorators": true, // 允许使用修饰符
"globalReturn": false // 设置为 true,当 sourceType 为 script 时,允许全局 return
},
"requireConfigFile": true, // 是否需要 babel 配置文件
"allowImportExportEverywhere": false // 设置为 true,import 和 export 声明 可以出现在文件的任务位置,否则只能出现在顶部
}
}