Files
EmailBill/Web/eslint.config.js

83 lines
2.4 KiB
JavaScript
Raw Normal View History

2026-01-16 11:15:44 +08:00
import js from '@eslint/js'
import globals from 'globals'
2025-12-25 11:20:56 +08:00
import pluginVue from 'eslint-plugin-vue'
export default [
2025-12-25 11:20:56 +08:00
{
2026-01-16 11:15:44 +08:00
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**', '**/node_modules/**', '.nuxt/**']
2025-12-25 11:20:56 +08:00
},
2026-01-16 11:15:44 +08:00
// Load Vue recommended rules first (sets up parser etc.)
...pluginVue.configs['flat/recommended'],
// General Configuration for all JS/Vue files
2025-12-25 11:20:56 +08:00
{
2026-01-16 11:15:44 +08:00
files: ['**/*.{js,mjs,jsx,vue}'],
2025-12-25 11:20:56 +08:00
languageOptions: {
globals: {
2026-01-16 11:15:44 +08:00
...globals.browser
},
2026-01-16 11:15:44 +08:00
ecmaVersion: 'latest',
sourceType: 'module'
},
rules: {
2026-01-16 11:15:44 +08:00
// Import standard JS recommended rules
...js.configs.recommended.rules,
2026-01-16 11:15:44 +08:00
// --- Logic & Best Practices ---
'no-unused-vars': ['warn', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}],
'no-undef': 'error',
'no-console': ['warn', { allow: ['warn', 'error', 'info'] }],
'no-debugger': 'warn',
'eqeqeq': ['error', 'always', { null: 'ignore' }],
'curly': ['error', 'all'],
'prefer-const': 'warn',
'no-var': 'error',
// --- Formatting & Style (User requested warnings) ---
'indent': ['error', 2, { SwitchCase: 1 }],
'quotes': ['error', 'single', { avoidEscape: true }],
'semi': ['error', 'never'],
'comma-dangle': ['error', 'never'],
'no-trailing-spaces': 'error',
'no-multiple-empty-lines': ['error', { max: 1 }],
'space-before-function-paren': ['error', 'always'],
2026-01-16 11:15:44 +08:00
'object-curly-spacing': ['error', 'always'],
'array-bracket-spacing': ['error', 'never']
}
},
2026-01-16 11:15:44 +08:00
// Vue Specific Overrides
{
files: ['**/*.vue'],
rules: {
'vue/multi-word-component-names': 'off',
'vue/no-v-html': 'warn',
2026-01-16 11:15:44 +08:00
// Turn off standard indent for Vue files to avoid conflicts with vue/html-indent
// or script indentation issues. Vue plugin handles this better.
'indent': 'off',
2026-01-16 11:15:44 +08:00
// Ensure Vue's own indentation rules are active (they are in 'recommended' but let's be explicit if needed)
'vue/html-indent': ['error', 2],
'vue/script-indent': ['error', 2, {
baseIndent: 0,
switchCase: 1,
ignores: []
}]
}
2025-12-25 11:20:56 +08:00
},
2026-01-16 11:15:44 +08:00
// Service Worker specific globals
{
files: ['**/service-worker.js', '**/src/registerServiceWorker.js'],
languageOptions: {
globals: {
2026-01-16 11:15:44 +08:00
...globals.serviceworker
}
}
}
]