| | |
| | | module.exports = { |
| | | root: true, |
| | | parserOptions: { |
| | | parser: 'babel-eslint', |
| | | sourceType: 'module' |
| | | }, |
| | | env: { |
| | | browser: true, |
| | | node: true, |
| | | es6: true, |
| | | es2021: true |
| | | }, |
| | | extends: ['plugin:vue/recommended', 'eslint:recommended'], |
| | | |
| | | // add your custom rules here |
| | | //it is base on https://github.com/vuejs/eslint-config-vue |
| | | extends: ['eslint:recommended', 'standard'], |
| | | overrides: [ |
| | | { |
| | | env: { |
| | | node: true |
| | | }, |
| | | files: ['.eslintrc.{js,cjs}'], |
| | | parserOptions: { |
| | | sourceType: 'script' |
| | | } |
| | | } |
| | | ], |
| | | parserOptions: { |
| | | ecmaVersion: '12', |
| | | sourceType: 'module' |
| | | }, |
| | | plugins: ['vue'], |
| | | rules: { |
| | | 'eqeqeq': ['error', 'always'], // 强制使用三个等于号 |
| | | 'semi': 2, // 语句可以不需要分号结尾 |
| | | eqeqeq: ['error', 'always'], // 强制使用三个等于号 |
| | | semi: 2, // 语句可以不需要分号结尾 |
| | | 'no-use-before-define': [1, 'nofunc'], // 未定义前不能使用 |
| | | 'max-lines': ['error', { 'max': 2000, 'skipBlankLines': true }], |
| | | 'max-lines': ['error', { max: 2000, skipBlankLines: true }], |
| | | 'no-mixed-spaces-and-tabs': 'warn', // 禁止使用空格和tab混合缩进 |
| | | 'newline-per-chained-call': ['error', { ignoreChainWithDepth: 1 }], // promise 以及 数组的链式操作需要另起一行 |
| | | 'vue/attribute-hyphenation': ['error', 'always'], // prop变量使用破折号,而不是驼峰。这里做统一,不然以后全局修改prop有可能碰到要修改不全的情况 |
| | |
| | | alignAttributesVertically: true |
| | | } |
| | | ], |
| | | 'curly': 2, // 必须使用 if(){} 中的{} |
| | | curly: 2, // 必须使用 if(){} 中的{} |
| | | 'vue/prop-name-casing': ['warn', 'camelCase'], //建议使用驼峰命名 |
| | | 'vue/this-in-template': ['error', 'never'], //不允许在template里面使用this |
| | | 'no-trailing-spaces': 1, //一行结束后面不要有空格 |
| | | 'vue/max-attributes-per-line': [ // template里面写的一行多少个prop属性,单行3个,多余3个的必须每行写一个prop,不然不容易看 |
| | | 'vue/max-attributes-per-line': [ |
| | | // template里面写的一行多少个prop属性,单行3个,多余3个的必须每行写一个prop,不然不容易看 |
| | | 'warn', |
| | | { |
| | | singleline: 3, |
| | |
| | | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', |
| | | 'no-unused-vars': 0, // 禁止出现未使用过的变量 |
| | | 'spaced-comment': 0 // 强制在注释中 // 或 /* 使用一致的空格 |
| | | }, |
| | | globals: { |
| | | 'AMap': false, |
| | | 'AMapUI': false |
| | | }, |
| | | } |
| | | } |