49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
import globals from 'globals'
|
|
import tseslint from 'typescript-eslint'
|
|
|
|
/**
|
|
* The engine must run without a browser and without Node-only APIs
|
|
* (STEP6 §3.3): the restricted globals and imports apply to `src/**` only,
|
|
* tests may read fixtures with node:fs.
|
|
*/
|
|
const BROWSER_OR_NODE_GLOBALS = [
|
|
'fetch',
|
|
'window',
|
|
'document',
|
|
'Image',
|
|
'DOMParser',
|
|
'XMLSerializer',
|
|
'navigator',
|
|
'Buffer',
|
|
'process',
|
|
'require',
|
|
]
|
|
|
|
export default tseslint.config(
|
|
{ ignores: ['node_modules/**'] },
|
|
{
|
|
files: ['**/*.ts'],
|
|
extends: [...tseslint.configs.recommended],
|
|
languageOptions: {
|
|
globals: { ...globals.node, ...globals.es2022 },
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'error',
|
|
{ argsIgnorePattern: '^_' },
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ['src/**/*.ts'],
|
|
rules: {
|
|
'no-restricted-globals': ['error', ...BROWSER_OR_NODE_GLOBALS],
|
|
'no-restricted-imports': [
|
|
'error',
|
|
{ patterns: ['@/*', 'react*', 'node:*'] },
|
|
],
|
|
},
|
|
},
|
|
)
|