import js from '@eslint/js'; import globals from 'globals'; import tseslint from 'typescript-eslint'; import reactHooks from 'eslint-plugin-react-hooks'; import jsxA11y from 'eslint-plugin-jsx-a11y'; import react from 'eslint-plugin-react'; // Alleen regels die fouten vinden; opmaak is aan Prettier export default tseslint.config( { ignores: [ 'dist', 'coverage', '.lighthouseci', 'lighthouse-reports', '.agents', '.claude', '.junie', '.tanstack', 'src/routeTree.gen.ts', ], }, { files: ['**/*.{ts,tsx}'], extends: [ js.configs.recommended, ...tseslint.configs.recommended, reactHooks.configs.flat.recommended, jsxA11y.flatConfigs.recommended, ], languageOptions: { globals: globals.browser, }, }, { // Texts of the site live in the language files (src/i18n), not in the // JSX (an error, so a new hardcoded text is stopped). Left out: the hero (becomes a CMS module), tests and // the build-only helpers. files: ['src/components/**/*.tsx', 'src/routes/**/*.tsx'], ignores: [ 'src/components/Hero/**', // The privacy statement is its own feature, not moved yet 'src/routes/privacyverklaring.tsx', '**/*.test.tsx', 'src/routeTree.gen.ts', ], plugins: { react }, rules: { // Text in attributes that people read or hear (labels, alt text) 'no-restricted-syntax': [ 'error', { selector: "JSXAttribute[name.name=/^(aria-label|aria-description|alt|title|placeholder|label)$/][value.type='Literal'][value.value!='']", message: 'Put the text in a language file (src/i18n) and use t().', }, ], 'react/jsx-no-literals': [ 'error', { noStrings: false, ignoreProps: true, // Technical signs that are not words allowedStrings: [ '/', '|', '·', '–', '—', '×', '+', '-', ':', '…', ], }, ], }, }, { // The copied cms-client package stays headless: it may only import // react and its own files (also enforced by its boundary test) files: ['src/cms-client/**/*.{ts,tsx}'], rules: { 'no-restricted-imports': [ 'error', { patterns: [ { group: ['@/*'], message: 'cms-client must not import from the app', }, ], }, ], }, }, { files: ['config/**/*.ts', 'e2e/**/*.ts', 'vitest.e2e.config.ts'], languageOptions: { globals: globals.node, }, }, { files: ['*.{js,cjs}'], extends: [js.configs.recommended], languageOptions: { globals: globals.node, }, }, );