Sveltek's config for ESLint.
pnpm add -D @sveltek/eslint-config
Add lint commands for manual linting (optional):
// package.json
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint --fix ."
}
}
// eslint.config.js
import { defineConfig, jsConfig, ignoresConfig } from '@sveltek/eslint-config'
export default defineConfig([jsConfig, ignoresConfig])
// eslint.config.js
import {
defineConfig,
jsConfig,
tsConfig,
ignoresConfig,
} from '@sveltek/eslint-config'
export default defineConfig([jsConfig, tsConfig, ignoresConfig])
Note
Also, don't forget to add the svelte
lang key to the eslint.validate
vscode setting:
// .vscode/settings.json
{
"eslint.validate": ["javascript", "typescript", "svelte"]
}
// eslint.config.js
import {
defineConfig,
jsConfig,
tsConfig,
svelteConfig,
ignoresConfig,
} from '@sveltek/eslint-config'
export default defineConfig([jsConfig, tsConfig, svelteConfig, ignoresConfig])
// eslint.config.js
import {
defineConfig,
globalIgnores,
jsConfig,
tsConfig,
ignores,
} from '@sveltek/eslint-config'
export default defineConfig([
jsConfig,
tsConfig,
svelteConfig,
{
files: jsConfig.files,
rules: {
// ...
},
},
{
files: tsConfig.files,
rules: {
// ...
},
},
{
files: svelteConfig.files,
rules: {
// ...
}
}
globalIgnores([...ignores, '**/dir/']),
])
For more info on how to ignore files
, see the official docs.
Feel free to ask questions or share new ideas.
Use the official discussions to get involved.
Developed in 🇭🇷 Croatia, © Sveltek.
Released under the MIT license.