50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
import js from "@eslint/js";
|
|
import globals from "globals";
|
|
import tsParser from "@typescript-eslint/parser";
|
|
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
|
import svelte from "eslint-plugin-svelte";
|
|
|
|
export default [
|
|
// SvelteKit sync and adapter-static output; these are not source files.
|
|
{ ignores: [".svelte-kit/**", "build/**"] },
|
|
js.configs.recommended,
|
|
...svelte.configs["flat/recommended"],
|
|
// v3 removed these from recommended; retain the previous checks explicitly.
|
|
{
|
|
rules: {
|
|
"svelte/valid-compile": "error",
|
|
"svelte/no-dynamic-slot-name": "error",
|
|
},
|
|
},
|
|
{
|
|
files: ["**/*.{ts,svelte}"],
|
|
plugins: { "@typescript-eslint": tsPlugin },
|
|
rules: {
|
|
...tsPlugin.configs["eslint-recommended"].overrides[0].rules,
|
|
...tsPlugin.configs.recommended.rules,
|
|
},
|
|
},
|
|
{
|
|
files: ["**/*.ts"],
|
|
ignores: ["**/*.svelte.ts"],
|
|
languageOptions: { parser: tsParser },
|
|
},
|
|
{
|
|
files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],
|
|
languageOptions: { parserOptions: { parser: tsParser } },
|
|
rules: {
|
|
"prefer-const": "off",
|
|
"svelte/prefer-const": "error",
|
|
},
|
|
},
|
|
{
|
|
files: ["src/**/*.{js,ts,svelte}"],
|
|
ignores: ["src/hooks.server.ts"],
|
|
languageOptions: { globals: globals.browser },
|
|
},
|
|
{
|
|
files: ["*.{js,ts}", "scripts/**/*.mjs", "src/hooks.server.ts"],
|
|
languageOptions: { globals: globals.node },
|
|
},
|
|
];
|