70 lines
2.1 KiB
JavaScript
70 lines
2.1 KiB
JavaScript
// ESLint flat config codifying the style already in use across the workspace's
|
|
// Vue projects: tabs, single quotes, `if(x)` with no space before the paren,
|
|
// and Hungarian-ish prefixes on locals. Goal is catching real mistakes, not
|
|
// importing an external style guide.
|
|
import js from '@eslint/js';
|
|
import vue from 'eslint-plugin-vue';
|
|
import globals from 'globals';
|
|
|
|
export default [
|
|
js.configs.recommended,
|
|
...vue.configs['flat/essential'],
|
|
{
|
|
languageOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
globals: {
|
|
...globals.browser
|
|
}
|
|
},
|
|
rules: {
|
|
//Indentation: tabs everywhere. Left manual - the rule throws too
|
|
//many false positives on wrapped Vue template attributes.
|
|
'indent': 'off',
|
|
'no-tabs': 'off',
|
|
|
|
'quotes': ['warn', 'single', {avoidEscape: true, allowTemplateLiterals: true}],
|
|
|
|
//Semicolons everywhere except the top-level `export default {...}`
|
|
//in Vue SFCs, which ESLint cannot carve out - hence 'warn'.
|
|
'semi': ['warn', 'always'],
|
|
|
|
//Loose and strict equality are both used on purpose (numeric
|
|
//strings come back from the API) - do not force either.
|
|
'eqeqeq': 'off',
|
|
|
|
'space-before-function-paren': ['warn', 'never'],
|
|
'keyword-spacing': ['warn', {
|
|
after: true,
|
|
overrides: {
|
|
if: {after: false},
|
|
for: {after: false},
|
|
while: {after: false},
|
|
switch: {after: false},
|
|
catch: {after: false}
|
|
}
|
|
}],
|
|
'space-before-blocks': ['warn', 'always'],
|
|
|
|
//Object literals and destructuring use `{a, b}`, but imports use
|
|
//`import { x } from 'y'` - one rule cannot express both.
|
|
'object-curly-spacing': 'off',
|
|
'array-bracket-spacing': ['warn', 'never'],
|
|
|
|
'no-unused-vars': ['warn', {argsIgnorePattern: '^_', ignoreRestSiblings: true}],
|
|
'no-undef': 'error',
|
|
'no-var': 'error',
|
|
'prefer-const': 'off',
|
|
|
|
'vue/component-name-in-template-casing': 'off',
|
|
'vue/multi-word-component-names': 'off',
|
|
'vue/attribute-hyphenation': 'off',
|
|
'vue/require-default-prop': 'off',
|
|
'vue/no-v-html': 'error'
|
|
}
|
|
},
|
|
{
|
|
ignores: ['public/**', 'vendor/**', 'node_modules/**']
|
|
}
|
|
];
|