58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
module.exports = {
|
|
root: true,
|
|
env: {
|
|
node: true,
|
|
browser: true,
|
|
es2022: true
|
|
},
|
|
extends: [
|
|
'plugin:vue/vue3-essential',
|
|
'eslint:recommended',
|
|
'@vue/eslint-config-prettier'
|
|
],
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module'
|
|
},
|
|
plugins: [
|
|
'vue'
|
|
],
|
|
rules: {
|
|
// Vue 相關規則
|
|
'vue/multi-word-component-names': 'off',
|
|
'vue/no-unused-vars': 'error',
|
|
'vue/component-name-in-template-casing': ['error', 'PascalCase', {
|
|
'registeredComponentsOnly': false
|
|
}],
|
|
'vue/component-definition-name-casing': ['error', 'PascalCase'],
|
|
'vue/attribute-hyphenation': ['error', 'always'],
|
|
'vue/v-on-event-hyphenation': ['error', 'always'],
|
|
|
|
// JavaScript 規則
|
|
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
'no-unused-vars': ['error', {
|
|
'vars': 'all',
|
|
'args': 'after-used',
|
|
'ignoreRestSiblings': false
|
|
}],
|
|
'prefer-const': 'error',
|
|
'no-var': 'error',
|
|
'object-shorthand': 'error',
|
|
'prefer-template': 'error',
|
|
|
|
// 程式碼品質
|
|
'eqeqeq': ['error', 'always'],
|
|
'curly': ['error', 'all'],
|
|
'brace-style': ['error', '1tbs'],
|
|
'comma-dangle': ['error', 'never'],
|
|
'quotes': ['error', 'single', { 'avoidEscape': true }],
|
|
'semi': ['error', 'never']
|
|
},
|
|
globals: {
|
|
defineProps: 'readonly',
|
|
defineEmits: 'readonly',
|
|
defineExpose: 'readonly',
|
|
withDefaults: 'readonly'
|
|
}
|
|
} |