import js from '@eslint/js' import globals from 'globals' import reactHooks from 'eslint-plugin-react-hooks' import reactRefresh from 'eslint-plugin-react-refresh' import tseslint from 'typescript-eslint' import { defineConfig, globalIgnores } from 'eslint/config' export default defineConfig([ globalIgnores(['dist']), { files: ['**/*.{ts,tsx}'], extends: [ js.configs.recommended, tseslint.configs.recommended, reactHooks.configs.flat.recommended, reactRefresh.configs.vite, ], languageOptions: { globals: globals.browser, }, }, // Discourage new hardcoded hex colors in components and pages. // Use DS_COLORS, matchScoreHex(), RESULT_TYPE_META, or MUI theme tokens ("primary.main") instead. // See src/lib/ds.ts and src/lib/utils.ts for available tokens. { files: ['src/components/**/*.{ts,tsx}', 'src/pages/**/*.{ts,tsx}'], rules: { 'no-restricted-syntax': [ 'warn', { selector: [ 'Property[key.name=/^(bgcolor|color|borderColor|background|fill)$/]', ' > Literal[value=/^#[0-9A-Fa-f]{3,8}$/]', ].join(''), message: 'Avoid hardcoded hex colors in sx props. Use DS_COLORS, matchScoreHex(), RESULT_TYPE_META, or MUI theme tokens ("primary.main") from src/lib/ds.ts and src/lib/utils.ts.', }, ], }, }, ])