-
Notifications
You must be signed in to change notification settings - Fork 458
/
eslint.config.mjs
151 lines (148 loc) · 4.37 KB
/
eslint.config.mjs
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// @ts-check
import tseslint from "typescript-eslint";
import notice from "eslint-plugin-notice";
import jsdoc from "eslint-plugin-jsdoc";
import deprecationPlugin from "eslint-plugin-deprecation";
import { fixupPluginRules } from "@eslint/compat";
import reactRecommended from "eslint-plugin-react/configs/recommended.js";
import react from "eslint-plugin-react";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import { includeIgnoreFile } from "@eslint/compat";
import path from "node:path";
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, ".gitignore");
import stylistic from '@stylistic/eslint-plugin'
export default [
{
ignores: ["out/**/*"],
},
{
files: ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts"],
ignores: [
...(includeIgnoreFile(gitignorePath).ignores) || [],
"src/views/**/*",
"src/prompts/**/*.ts", // Ignore prompts files as they are copied from other repos
"**/out/**/*",
],
languageOptions: {
...reactRecommended.languageOptions,
ecmaVersion: "latest",
sourceType: "module",
parser: tseslint.parser,
parserOptions: {
project: ["./tsconfig.json", "./tsconfig.react.json"],
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
notice,
jsdoc,
["@typescript-eslint"]: tseslint.plugin,
// @ts-ignore
["deprecation"]: fixupPluginRules(deprecationPlugin),
react,
...eslintPluginPrettierRecommended.plugins,
'@stylistic': stylistic
},
settings: {
react: {
version: "detect",
},
},
rules: {
...eslintPluginPrettierRecommended.rules,
"notice/notice": [
"error",
{
template:
"/*---------------------------------------------------------------------------------------------" +
"\n" +
" * Copyright (c) Microsoft Corporation. All rights reserved." +
"\n" +
" * Licensed under the MIT License. See License.txt in the project root for license information." +
"\n" +
" *--------------------------------------------------------------------------------------------*/" +
"\n" +
"\n",
},
],
"no-undef": "off",
"no-unused-vars": "off",
"constructor-super": "warn",
curly: "off",
eqeqeq: "warn",
"no-buffer-constructor": "warn",
"no-caller": "warn",
"no-debugger": "warn",
"no-duplicate-case": "warn",
"no-duplicate-imports": "error",
"no-eval": "warn",
"no-async-promise-executor": "off",
"no-extra-semi": "warn",
"no-new-wrappers": "warn",
"no-redeclare": "off",
"no-sparse-arrays": "warn",
"no-throw-literal": "off",
"no-unsafe-finally": "warn",
"no-unused-labels": "warn",
"no-restricted-globals": [
"warn",
"name",
"length",
"event",
"closed",
"external",
"status",
"origin",
"orientation",
"context",
], // non-complete list of globals that are easy to access unintentionally
"no-var": "off",
"jsdoc/no-types": "warn",
"no-restricted-syntax": ["warn", "Literal[raw='null']"],
"@typescript-eslint/no-explicit-any": "warn",
// Not really that useful, there are valid reasons to have empty functions
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-inferrable-types": [
"warn",
{
ignoreParameters: true,
ignoreProperties: true,
},
],
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
},
],
"deprecation/deprecation": "warn",
"@typescript-eslint/no-floating-promises": [
"error",
{
ignoreVoid: true,
},
],
"@typescript-eslint/naming-convention": [
"warn",
{
selector: "property",
modifiers: ["private"],
format: ["camelCase"],
leadingUnderscore: "require",
},
],
"@stylistic/semi": "warn",
"prettier/prettier": [
"error",
{
endOfLine: "auto",
},
],
},
},
];