PPTist/.eslintrc.js

82 lines
2.0 KiB
JavaScript
Raw Normal View History

2021-02-03 15:50:54 +08:00
// https://eslint.org/docs/rules/
const isProduction = process.env.NODE_ENV === 'production'
2020-12-10 19:14:45 +08:00
module.exports = {
root: true,
env: {
2020-12-11 10:47:53 +08:00
node: true,
2020-12-10 19:14:45 +08:00
},
2020-12-11 10:47:53 +08:00
extends: [
2020-12-10 19:14:45 +08:00
'plugin:vue/vue3-essential',
'eslint:recommended',
2020-12-11 10:47:53 +08:00
'@vue/typescript/recommended',
2020-12-10 19:14:45 +08:00
],
parserOptions: {
2020-12-11 10:47:53 +08:00
ecmaVersion: 2020,
2020-12-10 19:14:45 +08:00
},
rules: {
2020-12-19 16:10:48 +08:00
'curly': ['error', 'multi-line'],
2021-02-03 15:50:54 +08:00
'eqeqeq': ['error', 'always'],
'semi': ['error', 'never'],
'indent': ['error', 2, {
'SwitchCase': 1,
}],
2020-12-19 16:10:48 +08:00
'quotes': ['error', 'single', {
2020-12-10 22:40:15 +08:00
'avoidEscape': true,
'allowTemplateLiterals': true,
}],
2020-12-19 16:10:48 +08:00
'key-spacing': ['error', {
2020-12-10 22:40:15 +08:00
'beforeColon': false,
'afterColon': true,
'mode': 'strict',
}],
2020-12-19 16:10:48 +08:00
'no-empty': 'error',
'no-else-return': 'error',
'no-multi-spaces': 'error',
'require-await': 'error',
'brace-style': ['error', 'stroustrup'],
'spaced-comment': ['error', 'always'],
'arrow-spacing': 'error',
'no-duplicate-imports': 'error',
2021-02-03 15:50:54 +08:00
'comma-spacing': ['error', {
'before': false,
'after': true,
}],
2020-12-19 16:10:48 +08:00
'default-case': 'error',
2021-02-03 15:50:54 +08:00
'consistent-this': ['error', '_this'],
'max-depth': ['error', 4],
'max-lines': ['error', 800],
2020-12-19 16:10:48 +08:00
'no-multi-str': 'error',
'space-infix-ops': 'error',
'space-before-blocks': ['error', 'always'],
'space-before-function-paren': ['error', {
2020-12-10 22:40:15 +08:00
'named': 'never',
2021-02-03 15:50:54 +08:00
'anonymous': 'never',
2020-12-10 22:40:15 +08:00
'asyncArrow': 'always',
}],
2021-02-03 15:04:31 +08:00
'keyword-spacing': ['error'],
2020-12-19 16:10:48 +08:00
'prefer-const': 'error',
'no-useless-return': 'error',
'array-bracket-spacing': 'error',
'no-useless-escape': 'off',
2021-02-03 15:50:54 +08:00
'no-eval': 'error',
'no-var': 'error',
'no-with': 'error',
2021-02-03 17:55:21 +08:00
'no-alert': isProduction ? 'error' : 'warn',
'no-console': isProduction ? 'error' : 'warn',
'no-debugger': isProduction ? 'error' : 'warn',
2020-12-10 19:14:45 +08:00
},
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)'
],
env: {
2020-12-11 10:47:53 +08:00
jest: true,
},
},
],
2020-12-10 19:14:45 +08:00
}