@kalimahapps/eslint-config
Version:
Comprehensive and configurable ESLint config for Vue 3 projects with TypeScript support
207 lines (203 loc) • 4.68 kB
JavaScript
const error = {
'accessor-pairs': {
setWithoutGet: true,
enforceForClassMembers: true,
},
'array-callback-return': {
allowImplicit: false,
checkForEach: false,
},
'brace-style': [
'1tbs',
{ allowSingleLine: true },
],
'comma-spacing': {
before: false,
after: true,
},
'indent': ['tab', { SwitchCase: 1 }],
'function-paren-newline': 'consistent',
'quote-props': 'consistent-as-needed',
'quotes': [
'single', {
avoidEscape: true,
allowTemplateLiterals: false,
},
],
'comma-dangle': {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'never',
exports: 'never',
functions: 'never',
},
'no-self-compare': 'error',
'no-template-curly-in-string': 'error',
'no-unreachable-loop': 'error',
'consistent-return': { treatUndefinedAsUnspecified: true },
'curly': 'all',
'default-case': 'error',
'default-case-last': 'error',
'no-alert': 'error',
'no-else-return': 'error',
'no-sequences': 'error',
'no-var': 'error',
'prefer-const': {
destructuring: 'all',
},
'func-call-spacing': 'never',
'no-whitespace-before-property': 'error',
'rest-spread-spacing': 'never',
'semi': 'always',
'semi-spacing': {
before: false,
after: true,
},
'semi-style': 'last',
};
const warn = {
'no-var': 'warn',
'object-shorthand': 'properties',
'no-unmodified-loop-condition': 'warn',
'no-use-before-define': {
functions: true,
classes: true,
variables: true,
allowNamedExports: false,
},
'arrow-body-style': 'always',
'block-scoped-var': 'warn',
'camelcase': { properties: 'never' },
'complexity': { max: 6 },
'default-param-last': 'warn',
'dot-notation': 'warn',
'eqeqeq': 'smart',
'func-style': 'expression',
'guard-for-in': 'warn',
'id-length': {
min: 2,
max: 30,
exceptions: [
// a and b are common in sort function
'a',
'b',
// x and y are common in math functions
'x',
'y',
],
},
'max-depth': { max: 3 },
'max-lines': {
max: 700,
skipBlankLines: true,
skipComments: true,
},
'max-lines-per-function': 100,
'max-nested-callbacks': { max: 3 },
'max-params': { max: 6 },
'no-empty-function': 'warn',
'no-floating-decimal': 'warn',
'no-implicit-coercion': 'warn',
'no-inline-comments': 'warn',
'no-lone-blocks': 'warn',
'no-lonely-if': 'warn',
'no-loop-func': 'warn',
'no-mixed-operators': 'warn',
'no-multi-str': 'warn',
'no-negated-condition': 'warn',
'no-nested-ternary': 'warn',
'no-octal-escape': 'warn',
'no-param-reassign': 'warn',
'no-script-url': 'warn',
'no-throw-literal': 'warn',
'no-underscore-dangle': 'warn',
'no-unneeded-ternary': 'warn',
'no-useless-call': 'warn',
'no-useless-return': 'warn',
'prefer-destructuring': 'warn',
'prefer-named-capture-group': 'warn',
'prefer-object-spread': 'warn',
'prefer-promise-reject-errors': 'warn',
'prefer-regex-literals': 'warn',
'prefer-rest-params': 'warn',
'prefer-spread': 'warn',
'prefer-template': 'warn',
'require-await': 'warn',
'require-unicode-regexp': 'warn',
'yoda': 'never',
'array-bracket-newline': { multiline: true },
'array-bracket-spacing': 'never',
'array-element-newline': 'consistent',
'arrow-parens': 'always',
'arrow-spacing': {
before: true,
after: true,
},
'block-spacing': 'always',
'dot-location': 'property',
'function-call-argument-newline': 'consistent',
'key-spacing': {
beforeColon: false,
afterColon: true,
},
'keyword-spacing': {
before: true,
after: true,
},
'line-comment-position': 'above',
'linebreak-style': 'unix',
'lines-around-comment': {
beforeBlockComment: true,
afterBlockComment: false,
beforeLineComment: true,
afterLineComment: false,
allowBlockStart: true,
allowBlockEnd: false,
allowObjectStart: true,
allowObjectEnd: false,
allowArrayStart: true,
allowArrayEnd: false,
},
'max-len': {
code: 100,
tabWidth: 4,
comments: 100,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
'max-statements-per-line': { max: 1 },
'newline-per-chained-call': { ignoreChainWithDepth: 2 },
'no-multi-spaces': 'warn',
'no-multiple-empty-lines': {
max: 1,
maxEOF: 0,
},
'no-trailing-spaces': {
skipBlankLines: true,
ignoreComments: true,
},
'object-curly-newline': {
multiline: true,
consistent: true,
},
'object-curly-spacing': 'always',
'object-property-newline': { allowAllPropertiesOnSameLine: false },
'padded-blocks': 'never',
'space-in-parens': 'never',
'space-infix-ops': 'warn',
'space-unary-ops': 'warn',
'switch-colon-spacing': {
after: true,
before: false,
},
'template-curly-spacing': 'never',
'template-tag-spacing': 'always',
'curly': 'warn',
};
const off = [];
export default {
error,
warn,
off,
};