eslint-plugin-svelte3
eslint-plugin-svelte3 copied to clipboard
type-aware linting rules config example
Using this example from README.md results in error Unexpected token ParseError
module.exports = {
// ...
parserOptions: { // add these parser options
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
extraFileExtensions: ['.svelte'],
},
extends: [ // then, enable whichever type-aware rules you want to use
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking'
],
// ...
};
Following the example in this issue has fixed the issue for me. https://github.com/sveltejs/eslint-plugin-svelte3/issues/116#issuecomment-863152211
Should the readme be updated to this?
module.exports = {
// ...
parserOptions: { // add these parser options
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
extraFileExtensions: ['.svelte'],
},
overrides: [
{
files: ['*.svelte'],
processor: 'svelte3/svelte3',
extends: [ // then, enable whichever type-aware rules you want to use
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking'
],
}
],
// ...
};