|
| 1 | +module.exports = { |
| 2 | + env: { |
| 3 | + browser: true, |
| 4 | + es6: true, |
| 5 | + node: true |
| 6 | + }, |
| 7 | + extends: [ |
| 8 | + 'airbnb-base', |
| 9 | + 'plugin:vue/recommended', |
| 10 | + 'plugin:promise/recommended' |
| 11 | + ], |
| 12 | + parserOptions: { |
| 13 | + ecmaVersion: 2018, |
| 14 | + sourceType: 'module', |
| 15 | + parser: 'babel-eslint' |
| 16 | + }, |
| 17 | + globals: { |
| 18 | + process: false |
| 19 | + }, |
| 20 | + rules: { |
| 21 | + 'quotes': ['error', 'single'], |
| 22 | + 'no-unused-vars': ['error', { |
| 23 | + args: 'none' |
| 24 | + }], |
| 25 | + 'comma-dangle': ['error', 'never'], |
| 26 | + 'object-curly-spacing': ['error', 'never'], |
| 27 | + 'max-len': ['error', { |
| 28 | + code: 119, |
| 29 | + ignoreRegExpLiterals: true |
| 30 | + }], |
| 31 | + 'no-param-reassign': ['error', { |
| 32 | + props: false |
| 33 | + }], |
| 34 | + 'no-unused-expressions': ['error', { |
| 35 | + allowShortCircuit: true, allowTernary: true |
| 36 | + }], |
| 37 | + 'arrow-parens': ['error', 'always'], |
| 38 | + 'import/no-extraneous-dependencies': ['error', { |
| 39 | + devDependencies: true, |
| 40 | + optionalDependencies: false |
| 41 | + }], |
| 42 | + 'no-restricted-syntax': [ |
| 43 | + 'error', |
| 44 | + { |
| 45 | + selector: 'ForInStatement', |
| 46 | + message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.' |
| 47 | + }, |
| 48 | + { |
| 49 | + selector: 'LabeledStatement', |
| 50 | + message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.' |
| 51 | + }, |
| 52 | + { |
| 53 | + selector: 'WithStatement', |
| 54 | + message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.' |
| 55 | + } |
| 56 | + ], |
| 57 | + |
| 58 | + // Vue |
| 59 | + 'vue/html-self-closing': ['error', { |
| 60 | + html: { |
| 61 | + normal: 'never', |
| 62 | + void: 'always' |
| 63 | + } |
| 64 | + }], |
| 65 | + 'vue/script-indent': ['warn', 2, { |
| 66 | + baseIndent: 1, |
| 67 | + switchCase: 1 |
| 68 | + }], |
| 69 | + 'vue/html-closing-bracket-newline': ['error', { |
| 70 | + singleline: 'never', |
| 71 | + multiline: 'never' |
| 72 | + }], |
| 73 | + 'vue/html-closing-bracket-spacing': ['error', { |
| 74 | + startTag: 'never', |
| 75 | + endTag: 'never', |
| 76 | + selfClosingTag: 'never' |
| 77 | + }], |
| 78 | + // TODO: 'vue/attributes-order': |
| 79 | + 'vue/order-in-components': ['warn', { |
| 80 | + order: [ |
| 81 | + 'el', |
| 82 | + 'name', |
| 83 | + 'parent', |
| 84 | + 'functional', |
| 85 | + 'inheritAttrs', |
| 86 | + 'model', |
| 87 | + 'extends', |
| 88 | + 'mixins', |
| 89 | + ['props', 'propsData'], |
| 90 | + 'data', |
| 91 | + 'computed', |
| 92 | + 'methods', |
| 93 | + 'watch', |
| 94 | + 'LIFECYCLE_HOOKS', |
| 95 | + ['components', 'directives', 'filters'], |
| 96 | + ['delimiters', 'comments'], |
| 97 | + ['template', 'render'], |
| 98 | + 'renderError' |
| 99 | + ] |
| 100 | + }], |
| 101 | + |
| 102 | + // off |
| 103 | + 'no-new': 'off', |
| 104 | + 'no-shadow': 'off', |
| 105 | + 'func-names': 'off', |
| 106 | + 'no-console': 'off', |
| 107 | + 'no-plusplus': 'off', |
| 108 | + 'arrow-body-style': 'off', |
| 109 | + 'no-prototype-builtins': 'off', |
| 110 | + 'prefer-deconstructing': 'off', |
| 111 | + 'promise/catch-or-return': 'off', |
| 112 | + 'vue/max-attributes-per-line': 'off', |
| 113 | + 'vue/singleline-html-element-content-newline': 'off' |
| 114 | + }, |
| 115 | + overrides: [ |
| 116 | + { |
| 117 | + files: ['*.vue'], |
| 118 | + rules: { |
| 119 | + indent: 'off' |
| 120 | + } |
| 121 | + }, |
| 122 | + { |
| 123 | + files: ['*.js'], |
| 124 | + rules: { |
| 125 | + 'vue/script-indent': 'off' |
| 126 | + } |
| 127 | + } |
| 128 | + ], |
| 129 | + settings: { |
| 130 | + 'import/resolver': 'webpack' |
| 131 | + } |
| 132 | +}; |
0 commit comments