50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
import prettier from 'eslint-config-prettier';
|
|
import js from '@eslint/js';
|
|
import { includeIgnoreFile } from '@eslint/compat';
|
|
import globals from 'globals';
|
|
import { fileURLToPath } from 'node:url';
|
|
import ts from 'typescript-eslint';
|
|
import { importX } from 'eslint-plugin-import-x';
|
|
|
|
const gitignorePath = fileURLToPath(new URL('.gitignore', import.meta.url));
|
|
|
|
export default ts.config(
|
|
includeIgnoreFile(gitignorePath),
|
|
js.configs.recommended,
|
|
...ts.configs.recommended,
|
|
importX.flatConfigs.recommended,
|
|
importX.flatConfigs.typescript,
|
|
{
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.browser,
|
|
...globals.node
|
|
}
|
|
}
|
|
},
|
|
{
|
|
rules: {
|
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
'no-undef': 'off'
|
|
}
|
|
},
|
|
{
|
|
settings: {
|
|
'import-x/resolver': {
|
|
typescript: true,
|
|
node: true
|
|
}
|
|
},
|
|
rules: {
|
|
// import-x/recommended is noisy for TS/Svelte; align with local resolution story.
|
|
'import-x/no-unresolved': 'off',
|
|
'import-x/no-named-as-default-member': 'off',
|
|
// Was only enabled for *.svelte*; enable for all linted modules so TS/JS cycles are visible too.
|
|
// Note: skips type-only import edges; maxDepth limits search (use a large number or '∞' if cycles are deeper).
|
|
'import-x/no-cycle': ['error', { maxDepth: 5, ignoreExternal: true }]
|
|
}
|
|
},
|
|
// Last: turns off stylistic rules that conflict with Prettier (must not be overridden by later blocks).
|
|
prettier
|
|
);
|