generated from kevinpeckham/sveltekit-typescript-tailwind-pug-starter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
94 lines (89 loc) · 2.63 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// from eslint, basic recommended rules
import js from "@eslint/js";
const eslintRecommendedRules = js.configs.recommended.rules;
// from typescript-eslint, parser and plugin for typescript
import tsParser from "@typescript-eslint/parser";
import tsPlugin from "@typescript-eslint/eslint-plugin";
const tsRecommendedRules = tsPlugin.configs.recommended.rules;
// from eslint-config-prettier, rules to override ESLint formatting rules that might conflict with Prettier
import eslintConfigPrettier from "eslint-config-prettier";
const prettierRecommendedRules = eslintConfigPrettier.rules;
// from svelte, parser for svelte
import svelteEslintPlugin from "eslint-plugin-svelte";
import svelteEslintParser from "svelte-eslint-parser";
const svelteRecommendedRules = svelteEslintPlugin.configs.recommended.rules;
const sveltePrettierRules = svelteEslintPlugin.configs.prettier.rules;
// globals package for predefined global variables
// https://github.com/sindresorhus/globals
import globals from "globals";
export default [
// 4. set default parser to typescript-eslint-parser
{
files: ["**/*.js", "**/*.cjs", "**/*.mjs", "**/*.ts", "**/*.svelte"],
languageOptions: {
parser: tsParser,
parserOptions: {
extraFileExtensions: [".svelte"],
ecmaVersion: 2022,
},
sourceType: "module",
ecmaVersion: 2022,
// enable globals
globals: {
...globals.browser,
...globals.node,
...globals.es2017,
},
},
plugins: {
"@typescript-eslint": tsPlugin,
},
rules: {
// add recommended rules from ESLint
...eslintRecommendedRules,
// add recommended rules from typescript-eslint
...tsRecommendedRules,
...prettierRecommendedRules,
// add custom rules
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-inferrable-types": "off",
"no-inner-declarations": "off",
"no-undef": "off",
},
ignores: [
"**/.*",
"**/.svelte-kit/**",
"**/.vercel/**",
"**/build/**",
"**/package/**",
"**/yarn.lock",
"**/package-lock.json",
"**/pnpm-lock.yaml",
"**/src/static/**",
],
},
{
files: ["**/*.svelte"],
plugins: {
svelte: svelteEslintPlugin,
},
rules: {
// add recommended rules from svelte/recommended
...svelteRecommendedRules,
// add recommended rules from svelte/prettier
...sveltePrettierRules,
// add custom rules
// note: with pug syntax the parser doesn't seem to know when certain refs are used in the template
"svelte/valid-compile": "warn",
"svelte/no-at-html-tags": "warn",
},
languageOptions: {
sourceType: "module",
ecmaVersion: 2022,
parser: svelteEslintParser,
parserOptions: {
parser: tsParser,
},
},
},
];