This repository was archived by the owner on Jul 7, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
46 lines (44 loc) · 1.46 KB
/
Copy patheslint.config.js
File metadata and controls
46 lines (44 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const { FlatCompat } = require('@eslint/eslintrc')
const js = require('@eslint/js')
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
})
module.exports = [
...compat.extends('next/core-web-vitals'),
{
rules: {
'prefer-const': 'error',
'no-var': 'error',
'no-console': ['warn', { allow: ['warn', 'error', 'log', 'info'] }],
'react/no-unescaped-entities': 'off',
'react/display-name': 'off',
},
},
// SSR/hydration safety: discourage creating AudioContext outside the audio facade
{
files: ['app/**/*.{ts,tsx}', 'src/components/**/*.{ts,tsx}', 'src/lib/**/*.{ts,tsx}'],
rules: {
'no-restricted-syntax': [
'warn',
{
selector: 'NewExpression[callee.name=/^(AudioContext|webkitAudioContext)$/]',
message:
'Do not create AudioContext directly. Use the central audio facade (startAudioContext) after a user gesture.',
},
{
selector:
'NewExpression[callee.type="MemberExpression"][callee.object.name="window"][callee.property.name=/^(AudioContext|webkitAudioContext)$/] ',
message:
'Do not create AudioContext via window.* in components. Route through the audio facade.',
},
],
},
},
{
files: ['**/__tests__/**', '**/*.test.*', '**/src/lib/**'],
rules: {
'no-console': 'off', // Allow all console methods in tests and lib files
},
},
]