Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. module.exports = {
  2. //此项是用来告诉eslint找当前配置文件不能往父级查找
  3. root: true,
  4.  
  5. //此项是用来指定javaScript语言类型和风格,sourceType用来指定js导入的方式,默认是script,此处设置为module,指某块导入方式
  6. parserOptions: {
  7. // 设置 script(默认) 或 module,如果代码是在ECMASCRIPT中的模块
  8. sourceType: 'module',
  9. "ecmaVersion": 6,
  10. //此项是用来指定eslint解析器的,解析器必须符合规则,babel-eslint解析器是对babel解析器的包装使其与ESLint解析
  11. parser: 'babel-eslint',
  12. },
  13.  
  14. // 此项指定环境的全局变量,下面的配置指定为浏览器环境
  15. env: {
  16. browser: true,
  17. },
  18.  
  19. // 此项是用来配置标准的js风格,就是说写代码的时候要规范的写,如果你使用vs-code我觉得应该可以避免出错
  20. extends: 'standard',
  21.  
  22. globals: {
  23. NODE_ENV: false
  24. },
  25.  
  26. // add your custom rules here
  27. 'rules': {
  28. 'genetator-start-spacing': 'off',
  29.  
  30. 'no-unused-expressions': ["error", { // 禁止无用的表达式
  31. "allowTernary": true,
  32. "allowShortCircuit": true
  33. }],
  34. 'no-bitwise': ["error", { //不允许使用位运算符
  35. "allow": ["~"]
  36. }],
  37. 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement