From e4ea5c3e7c74c4d2c700ced71372da13e031eb6c Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 15:17:49 +0200 Subject: [PATCH] feat: extend ESLint config with default rule set - ignore generated code (.nuxt, .output, dist) - no-console/no-debugger warnings in production - enforce eqeqeq, prefer-const, no-var - Vue conventions: PascalCase templates, script-template-style order, true attribute shorthand, warn on v-html (XSS) - disable no-undef in favour of TypeScript --- eslint.config.mjs | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 59858df..1b5e32e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,8 +1,34 @@ import { withNuxt } from './.nuxt/eslint.config.mjs' export default withNuxt({ - // Your custom ESLint rules go here, e.g.: - // rules: { - // 'no-console': 'warn', - // }, + // Files ESLint should never look at (generated code & build output) + ignores: [ + '.nuxt/**', + '.output/**', + 'node_modules/**', + 'dist/**', + '.data/**', + ], + + rules: { + // ---------- general ---------- + 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', + eqeqeq: ['error', 'always'], + 'prefer-const': 'error', + 'no-var': 'error', + 'object-shorthand': ['warn', 'always'], + + // ---------- vue ---------- + // Keep components consistent and catch template bugs early + 'vue/multi-word-component-names': 'off', // pages/index.vue etc. are fine + 'vue/component-name-in-template-casing': ['warn', 'PascalCase'], + 'vue/no-unused-refs': 'error', + 'vue/prefer-true-attribute-shorthand': 'warn', + 'vue/block-order': ['error', { order: ['script', 'template', 'style'] }], + 'vue/no-v-html': 'warn', // XSS risk unless content is sanitized + + // ---------- typescript-ish (via vue-tsc + nuxt defaults) ---------- + 'no-undef': 'off', // TS handles this; avoids false positives on Nuxt auto-imports + }, })