generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
68 lines (61 loc) · 2 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
import js from "@eslint/js";
import typescriptPlugin from "@typescript-eslint/eslint-plugin";
import typescriptPluginParser from "@typescript-eslint/parser";
import prettierConfig from "eslint-config-prettier";
import prettierPlugin from "eslint-plugin-prettier";
import tsdocPlugin from "eslint-plugin-tsdoc";
import globals from "globals";
export const TYPESCRIPT_FILES = ["src/**/*.ts"];
/** @type { import("eslint").Linter.FlatConfig[] } */
export default [
// Don't lint files under these directories.
{ ignores: ["test-vault/", "dist/", "docs/"] },
js.configs.recommended,
// ESLint needs to know that the *.config.js files run in a NodeJS environment.
{
files: ["*.config.js"],
languageOptions: {
globals: {
...globals.node,
},
},
},
// Configure the source code.
{
plugins: { "@typescript-eslint": typescriptPlugin },
files: TYPESCRIPT_FILES,
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
parser: typescriptPluginParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
modules: true,
},
},
globals: {
...globals.browser,
},
},
rules: {
...typescriptPlugin.configs.recommended.rules,
...typescriptPlugin.configs.strict.rules,
},
},
// Configure plugin for validating TSDoc annotations on TypeScript files.
{
plugins: { tsdoc: tsdocPlugin },
files: TYPESCRIPT_FILES,
rules: { "tsdoc/syntax": "error" },
},
// Configure prettier to run on all files.
{
plugins: { prettier: prettierPlugin },
// NOTE: Omitting `files` is the same as selecting all files.
rules: {
...prettierConfig.rules, // Updates rules that conflict with Prettier.
"prettier/prettier": "error",
},
},
];