123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- /* eslint-env node */
- module.exports = {
- root: true,
- env: {
- browser: true,
- es2021: true,
- node: true,
- },
- parser: "vue-eslint-parser",
- extends: [
- "plugin:vue/vue3-recommended",
- 'eslint:recommended'
- ],
- parserOptions: {
- ecmaVersion: "latest",
- sourceType: "module",
- },
- globals: {},
- plugins: ['vue'],
- rules: {
- // Common
- 'semi': ['error', 'never'],
- 'curly': 'off',
- 'quotes': ['error', 'single'],
- 'quote-props': ['error', 'consistent-as-needed'],
- 'no-console': 'off',
- // best-practice
- 'array-callback-return': 'error',
- 'block-scoped-var': 'error',
- 'consistent-return': 'off',
- 'complexity': 'off',
- 'eqeqeq': ['error', 'smart'],
- 'no-alert': 'warn',
- 'no-case-declarations': 'error',
- 'no-multi-spaces': 'error',
- 'no-multi-str': 'error',
- 'no-with': 'error',
- 'no-void': 'error',
- 'no-useless-escape': 'off',
- 'vars-on-top': 'error',
- 'require-await': 'off',
- 'no-return-assign': 'off',
- 'operator-linebreak': ['error', 'before'],
- 'max-statements-per-line': ['error', {
- max: 1
- }],
- 'vue/singleline-html-element-content-newline': 'off',
- 'sort-imports': [
- 'error',
- {
- ignoreCase: false,
- ignoreDeclarationSort: true,
- ignoreMemberSort: false,
- memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
- allowSeparatedGroups: false,
- },
- ],
- // typescript
- 'import/named': 'off',
- // Override JS
- 'no-useless-constructor': 'off',
- 'indent': 'off',
- 'no-invalid-this': 'off',
- 'no-redeclare': 'off',
- "no-use-before-define": 'off',
- 'brace-style': 'error',
- 'comma-dangle': ['error', 'always-multiline'],
- 'object-curly-spacing': ['error', 'always'],
- 'space-before-blocks': ['error', 'always'],
- 'space-before-function-paren': [
- 'error',
- {
- anonymous: 'always',
- named: 'never',
- asyncArrow: 'always',
- },
- ],
- 'space-infix-ops': 'error',
- 'keyword-spacing': ['error', {
- before: true,
- after: true
- }],
- 'comma-spacing': ['error', {
- before: false,
- after: true
- }],
- 'no-extra-parens': ['error', 'functions'],
- 'no-dupe-class-members': 'error',
- 'no-loss-of-precision': 'error',
- 'lines-between-class-members': ['error', 'always', {
- exceptAfterSingleLine: true
- }],
- // vue
- "vue/html-indent": ["error", 4],
- 'vue/max-attributes-per-line': 'off',
- 'vue/no-v-html': 'off',
- 'vue/require-prop-types': 'off',
- 'vue/require-default-prop': 'off',
- 'vue/multi-word-component-names': 'off',
- 'vue/prefer-import-from-vue': 'off',
- 'vue/no-v-text-v-html-on-component': 'off',
- 'vue/no-dupe-keys': 'off',
- // reactivity transform
- 'vue/no-setup-props-destructure': 'off',
- 'vue/component-tags-order': ['error', {
- order: ['template', 'script', 'style'],
- }],
- 'vue/block-tag-newline': ['error', {
- singleline: 'always',
- multiline: 'always',
- }],
- 'vue/component-name-in-template-casing': ['error', 'PascalCase' || 'kebab-case'],
- 'vue/component-options-name-casing': ['error', 'PascalCase'],
- 'vue/custom-event-name-casing': ['error', 'camelCase'],
- 'vue/define-macros-order': ['error', {
- order: ['defineProps', 'defineEmits'],
- }],
- 'vue/html-comment-content-spacing': ['error', 'always', {
- exceptions: ['-'],
- }],
- 'vue/no-restricted-v-bind': ['error', '/^v-/'],
- 'vue/no-useless-v-bind': 'error',
- 'vue/no-unused-refs': 'error',
- 'vue/padding-line-between-blocks': ['error', 'always'],
- 'vue/prefer-separate-static-class': 'error',
- // extensions
- 'vue/array-bracket-spacing': ['error', 'never'],
- 'vue/arrow-spacing': ['error', {
- before: true,
- after: true
- }],
- 'vue/block-spacing': ['error', 'always'],
- 'vue/brace-style': ['error', 'stroustrup', {
- allowSingleLine: true
- }],
- 'vue/comma-dangle': ['error', 'always-multiline'],
- 'vue/comma-spacing': ['error', {
- before: false,
- after: true
- }],
- 'vue/comma-style': ['error', 'last'],
- 'vue/dot-location': ['error', 'property'],
- 'vue/dot-notation': ['error', {
- allowKeywords: true
- }],
- 'vue/eqeqeq': ['error', 'smart'],
- // 'vue/func-call-spacing': ['off', 'never'],
- 'vue/key-spacing': ['error', {
- beforeColon: false,
- afterColon: true
- }],
- 'vue/keyword-spacing': ['error', {
- before: true,
- after: true
- }],
- 'vue/no-constant-condition': 'warn',
- 'vue/no-empty-pattern': 'error',
- 'vue/no-extra-parens': ['error', 'functions'],
- 'vue/no-irregular-whitespace': 'error',
- 'vue/no-loss-of-precision': 'error',
- 'vue/no-restricted-syntax': ['error', 'DebuggerStatement', 'LabeledStatement', 'WithStatement'],
- 'vue/no-sparse-arrays': 'error',
- 'vue/object-curly-newline': ['error', {
- multiline: true,
- consistent: true
- }],
- 'vue/object-curly-spacing': ['error', 'always'],
- 'vue/object-property-newline': ['error', {
- allowMultiplePropertiesPerLine: true
- }],
- 'vue/object-shorthand': ['error', 'always', {
- ignoreConstructors: false,
- avoidQuotes: true,
- }],
- 'vue/operator-linebreak': ['error', 'before'],
- 'vue/prefer-template': 'error',
- 'vue/quote-props': ['error', 'consistent-as-needed'],
- 'vue/space-in-parens': ['error', 'never'],
- 'vue/space-infix-ops': 'error',
- 'vue/space-unary-ops': ['error', {
- words: true,
- nonwords: false
- }],
- 'vue/template-curly-spacing': 'error',
- },
- };
|