|
| 1 | +import js from '@eslint/js' |
| 2 | +import prettierConfig from 'eslint-config-prettier' |
| 3 | + |
| 4 | +const browserGlobals = { |
| 5 | + window: 'readonly', |
| 6 | + document: 'readonly', |
| 7 | + console: 'readonly', |
| 8 | + navigator: 'readonly', |
| 9 | + fetch: 'readonly', |
| 10 | + URL: 'readonly', |
| 11 | + URLSearchParams: 'readonly', |
| 12 | + history: 'readonly', |
| 13 | + location: 'readonly', |
| 14 | + localStorage: 'readonly', |
| 15 | + sessionStorage: 'readonly', |
| 16 | + setTimeout: 'readonly', |
| 17 | + clearTimeout: 'readonly', |
| 18 | + setInterval: 'readonly', |
| 19 | + clearInterval: 'readonly', |
| 20 | + HTMLElement: 'readonly', |
| 21 | + Event: 'readonly', |
| 22 | + CustomEvent: 'readonly', |
| 23 | + KeyboardEvent: 'readonly', |
| 24 | + HashChangeEvent: 'readonly', |
| 25 | + MutationObserver: 'readonly', |
| 26 | + IntersectionObserver: 'readonly', |
| 27 | + requestAnimationFrame: 'readonly', |
| 28 | + performance: 'readonly', |
| 29 | +} |
| 30 | + |
| 31 | +export default [ |
| 32 | + js.configs.recommended, |
| 33 | + prettierConfig, |
| 34 | + { |
| 35 | + languageOptions: { |
| 36 | + ecmaVersion: 2024, |
| 37 | + sourceType: 'module', |
| 38 | + globals: browserGlobals, |
| 39 | + }, |
| 40 | + rules: { |
| 41 | + 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], |
| 42 | + 'no-console': ['warn', { allow: ['warn', 'error'] }], |
| 43 | + }, |
| 44 | + ignores: [ |
| 45 | + 'node_modules/**', |
| 46 | + 'dist/**', |
| 47 | + 'playwright-report/**', |
| 48 | + '.lighthouseci/**', |
| 49 | + 'test-results/**', |
| 50 | + ], |
| 51 | + }, |
| 52 | + { |
| 53 | + files: ['**/*.test.js', 'tests/**/*.js', 'playwright.config.js'], |
| 54 | + languageOptions: { |
| 55 | + globals: { |
| 56 | + ...browserGlobals, |
| 57 | + global: 'writable', |
| 58 | + describe: 'readonly', |
| 59 | + it: 'readonly', |
| 60 | + test: 'readonly', |
| 61 | + expect: 'readonly', |
| 62 | + beforeEach: 'readonly', |
| 63 | + afterEach: 'readonly', |
| 64 | + beforeAll: 'readonly', |
| 65 | + afterAll: 'readonly', |
| 66 | + vi: 'readonly', |
| 67 | + }, |
| 68 | + }, |
| 69 | + rules: { |
| 70 | + 'no-console': 'off', |
| 71 | + }, |
| 72 | + }, |
| 73 | +] |
0 commit comments