Files
InvoiceShelf/eslint.config.mjs
Darko Gjorgjijoski f3ab0f22fc chore(frontend): fix ESLint, add Pint+ESLint pre-commit hook, centralize v-html
Fix the broken ESLint setup: add vue-eslint-parser and @typescript-eslint/parser
and wire the TS parser into eslint.config.mjs so .ts and <script lang=ts> parse
(was failing outright). Clear the resulting backlog to a clean 0/0 baseline —
fix genuine issues, relax two intentional-pattern rules (multi-word-component-names,
no-required-prop-with-default).

Add a committed .githooks/pre-commit (enabled via core.hooksPath, auto-set by the
prepare script) that runs Pint on staged PHP and ESLint --max-warnings 0 on staged
resources/scripts JS/TS/Vue, blocking on failure. Add composer/npm lint scripts and
document the gate in CLAUDE.md.

Replace every scattered v-html with a single audited BaseSanitizedHtml component
that DOMPurify-sanitizes its input (new utils/markdown.ts sanitizeHtml), so
server/registry-provided HTML is actually sanitized and vue/no-v-html stays enabled
everywhere but one reviewed sink.
2026-06-11 11:11:12 +02:00

40 lines
1.2 KiB
JavaScript

import pluginVue from 'eslint-plugin-vue'
import eslintConfigPrettier from 'eslint-config-prettier'
import tsParser from '@typescript-eslint/parser'
export default [
...pluginVue.configs['flat/recommended'],
// Parse TypeScript inside <script lang="ts"> blocks of .vue files.
// vue-eslint-parser stays the top-level parser; it delegates <script> to tsParser.
{
files: ['resources/scripts/**/*.vue'],
languageOptions: {
parserOptions: {
parser: tsParser,
sourceType: 'module',
ecmaVersion: 'latest',
},
},
},
// Parse standalone .ts files with the TypeScript parser.
{
files: ['resources/scripts/**/*.ts'],
languageOptions: {
parser: tsParser,
sourceType: 'module',
ecmaVersion: 'latest',
},
},
eslintConfigPrettier,
{
files: ['resources/scripts/**/*.{js,ts,vue}'],
rules: {
'vue/no-mutating-props': 'off',
// Single-word components (Page, Breadcrumb) are intentional in this app.
'vue/multi-word-component-names': 'off',
// The app intentionally pairs `required` props with sensible `default`s.
'vue/no-required-prop-with-default': 'off',
},
},
]