12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- // ESLint 检查 .vue 文件需要单独配置编辑器:
- // https://eslint.vuejs.org/user-guide/#editor-integrations
- module.exports = {
- root: true,
- env: {
- browser: true,
- commonjs: true,
- es6: true,
- jest: true,
- jquery: true,
- node: true,
- },
- 'extends': [
- 'eslint:recommended',
- // "plugin:vue/base",
- 'plugin:vue/recommended',
- ],
- parserOptions: {
- parser: 'babel-eslint'
- // "parser": "@babel/eslint-parser"
- },
- rules: {
- 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
- 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
- 'semi': ['error', 'never'],
- "no-unused-vars": ["warn", {
- "vars": "all",
- "args": "after-used",
- "ignoreRestSiblings": false
- }],
- "keyword-spacing": ["error", { "before": true, "after": true }],
- "object-curly-spacing": ["error", "always"],
- "space-infix-ops": ["error"],
- 'key-spacing': ["error", {
- "mode": "strict"
- }],
- "comma-spacing": ["error", { "before": false, "after": true }],
- "func-call-spacing": ["error", "never"],
- "semi-spacing": ["error", { "before": false, "after": true }],
- "space-before-blocks": ["error", "always"],
- 'no-trailing-spaces': 'error',
- 'no-multi-spaces': 'error',
- "indent": ["error", 2],
- 'no-empty': 'off',
- // 默认不启用:为了避免细微的 bug,最好直接从 Object.prototype 调用挂载于prototype上的方法方法。例如,foo.hasOwnProperty("bar") 应该替换为 Object.prototype.hasOwnProperty.call(foo, "bar")。
- 'no-prototype-builtins': "off",
- },
- globals: {
- globalConfig: true,
- globalApi: true,
- globalUtils: true,
- globalMapState: true,
- globalMapGetters: true,
- globalMapMutations: true,
- store: true,
- utils: true,
- }
- }
|