-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
152 lines (141 loc) · 3.59 KB
/
eslint.config.js
File metadata and controls
152 lines (141 loc) · 3.59 KB
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
152
const js = require("@eslint/js");
const tseslint = require("@typescript-eslint/eslint-plugin");
const tsparser = require("@typescript-eslint/parser");
const prettier = require("eslint-plugin-prettier");
module.exports = [
// JavaScript推奨設定
js.configs.recommended,
// TypeScriptファイルの設定
{
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
project: "./tsconfig.json",
},
globals: {
// Node.js環境
NodeJS: "readonly",
process: "readonly",
Buffer: "readonly",
console: "readonly",
__dirname: "readonly",
__filename: "readonly",
module: "readonly",
require: "readonly",
exports: "readonly",
global: "readonly",
// Browser環境(Web拡張用)
window: "readonly",
document: "readonly",
},
},
plugins: {
"@typescript-eslint": tseslint,
prettier,
},
rules: {
// TypeScript推奨ルール
...tseslint.configs.recommended.rules,
// プロジェクト固有のルール調整
"@typescript-eslint/no-unused-vars": [
"off",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-non-null-assertion": "warn",
// VSCode拡張開発でよく使用されるパターンを許可
"@typescript-eslint/no-var-requires": "off",
"no-undef": "off",
// Prettier連携
"prettier/prettier": "error",
// 一般的なJavaScript/TypeScriptルール
"no-console": "off", // 開発用ツールなのでconsoleを許可
"prefer-const": "off",
"no-var": "off",
eqeqeq: "error",
curly: "off",
},
},
// JavaScriptファイルの設定
{
files: ["**/*.js"],
languageOptions: {
ecmaVersion: 2020,
sourceType: "module",
globals: {
process: "readonly",
__dirname: "readonly",
__filename: "readonly",
module: "readonly",
require: "readonly",
exports: "readonly",
console: "readonly",
},
},
plugins: {
prettier,
},
rules: {
"prettier/prettier": "error",
"no-console": "off",
"prefer-const": "error",
"no-var": "error",
eqeqeq: "error",
curly: "error",
},
},
// テストファイルの設定
{
files: ["**/*.spec.ts", "**/*.test.ts", "**/tests/**/*.ts"],
languageOptions: {
globals: {
describe: "readonly",
it: "readonly",
test: "readonly",
expect: "readonly",
beforeEach: "readonly",
afterEach: "readonly",
beforeAll: "readonly",
afterAll: "readonly",
jest: "readonly",
},
},
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
},
},
// 設定ファイルの設定
{
files: ["*.config.js", "*.config.ts", "webpack.config.js"],
languageOptions: {
globals: {
module: "readonly",
require: "readonly",
__dirname: "readonly",
process: "readonly",
},
},
rules: {
"@typescript-eslint/no-var-requires": "off",
"no-console": "off",
},
},
// 除外設定
{
ignores: [
"out/**",
"node_modules/**",
"*.d.ts",
"dist/**",
".vscode-test/**",
],
},
];