add eslint-plugin-import-x, fix google maps typing
This commit is contained in:
@@ -4,13 +4,16 @@ 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,
|
||||
prettier,
|
||||
importX.flatConfigs.recommended,
|
||||
importX.flatConfigs.typescript,
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
@@ -19,19 +22,28 @@ export default ts.config(
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['**/*.svelte'],
|
||||
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
parser: ts.parser
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
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
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user