generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 36
/
eslint.config.js
74 lines (72 loc) · 1.95 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
import prettierPlugin from 'eslint-plugin-prettier';
import eslintConfigPrettier from 'eslint-config-prettier';
import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin';
import importPlugin from 'eslint-plugin-import';
import unusedImportsPlugin from 'eslint-plugin-unused-imports';
import typescriptEslintParser from '@typescript-eslint/parser';
import eslintPluginSvelte from 'eslint-plugin-svelte';
import svelteParser from 'svelte-eslint-parser';
import js from "@eslint/js";
import globals from "globals"
/** @type {import("eslint").Linter.Config} */
const config = {
files: ["src/**/*.ts", "src/**/*.svelte"],
languageOptions: {
globals: {
CodeMirror: 'readonly',
...globals.browser,
...globals.node,
...globals.es2020,
...globals.jest,
},
parser: typescriptEslintParser,
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
modules: true,
},
extraFileExtensions: ['.svelte'],
},
},
plugins: {
'@typescript-eslint': typescriptEslintPlugin,
import: importPlugin,
'unused-imports': unusedImportsPlugin,
prettier: prettierPlugin,
},
rules: {
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single', { avoidEscape: true }],
'@typescript-eslint/no-unused-vars': 0, // Configured in tsconfig instead.
semi: ['error', 'always'],
'import/order': 'error',
'sort-imports': [
'error',
{
ignoreDeclarationSort: true,
},
],
'unused-imports/no-unused-imports': 'error',
'no-console': 'off',
'prettier/prettier': 'error',
},
};
export default [
{
ignores: ['main.js', 'docs/**/*'],
},
config,
js.configs.recommended,
...eslintPluginSvelte.configs['flat/recommended'],
{
files: ["src/**/*.svelte"],
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: typescriptEslintParser,
}
},
},
eslintConfigPrettier,
];