@yuu1111/biome-config 2.2.8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +9 -127
- package/README.md +9 -125
- package/base.json +9 -0
- package/package.json +1 -8
- package/react.json +9 -0
- package/plugins/core/no-incomplete-implementation.grit +0 -42
- package/plugins/core/no-meaningless-test.grit +0 -46
- package/plugins/core/no-reexports.grit +0 -15
- package/plugins/core/no-ternary-statement.grit +0 -6
- package/plugins/core/no-type-safety-bypass.grit +0 -30
- package/plugins/core/no-unsafe-errno-assertion.grit +0 -9
- package/plugins/core/no-useless-abstraction.grit +0 -9
- package/plugins/discord/no-unsafe-dynamic-discord-message.grit +0 -39
- package/plugins/network/require-abort-timeout-cleanup.grit +0 -11
- package/plugins/network/require-fetch-abort-signal.grit +0 -16
- package/plugins/scoped/no-adapter-import.grit +0 -9
- package/plugins/scoped/no-direct-response.grit +0 -20
- package/plugins-core.json +0 -11
- package/plugins-discord.json +0 -5
- package/plugins-network.json +0 -6
package/README.ja.md
CHANGED
|
@@ -12,30 +12,26 @@ bun add -D @yuu1111/biome-config
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
-
`biome` をextendsし、Project
|
|
15
|
+
`biome` をextendsし、CSSを持つProjectは `react` をextendsする
|
|
16
16
|
|
|
17
17
|
```json
|
|
18
18
|
{
|
|
19
19
|
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
|
20
20
|
"extends": [
|
|
21
|
-
"@yuu1111/biome-config/biome"
|
|
22
|
-
"@yuu1111/biome-config/plugins/core"
|
|
21
|
+
"@yuu1111/biome-config/biome"
|
|
23
22
|
]
|
|
24
23
|
}
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
GritQLのpluginとして配っていた自作ruleは、OxlintのJS pluginとして [`@yuu1111/oxc-config`](../oxc-config/README.ja.md) に移した
|
|
27
|
+
GritQLのpluginはBiomeのlintを約2倍遅くしていたが、Oxlintでは同じ検査が1秒未満で終わる
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
| ----------------- | ----------------------------- |
|
|
31
|
-
| `biome` | formatter、lint rule、VCS連携 |
|
|
32
|
-
| `react` | `biome` にCSSとTailwindを足す |
|
|
33
|
-
| `plugins/core` | 汎用のrule plugin 7つ |
|
|
34
|
-
| `plugins/network` | `fetch` のrule plugin 2つ |
|
|
35
|
-
| `plugins/discord` | Discordのrule plugin 1つ |
|
|
29
|
+
## Presets
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
| Preset | 用途 |
|
|
32
|
+
| ------- | ----------------------------- |
|
|
33
|
+
| `biome` | formatter、lint rule、VCS連携 |
|
|
34
|
+
| `react` | `biome` にCSSとTailwindを足す |
|
|
39
35
|
|
|
40
36
|
### biome
|
|
41
37
|
|
|
@@ -78,117 +74,3 @@ CSSのformatterとlinterを足し、Tailwind directiveを有効にする
|
|
|
78
74
|
]
|
|
79
75
|
}
|
|
80
76
|
```
|
|
81
|
-
|
|
82
|
-
### plugins/core
|
|
83
|
-
|
|
84
|
-
| Rule | 重大度 | Default | 検出対象 |
|
|
85
|
-
| ------------------------------ | ----------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
86
|
-
| `no-reexports` | warn | false | 既存bindingを転送するだけのexport(`export type Alias = Imported` など)、`export { imported }` はbaseの `style.noExportedImports`、`export ... from` の形はbaseのbarrel file ruleが担当する |
|
|
87
|
-
| `no-incomplete-implementation` | error, warn | false | placeholderのthrowはerror、logだけのcatch、`null`・`[]`・`{}` へ置き換えたrejected promiseとcatchしたerrorはwarn |
|
|
88
|
-
| `no-type-safety-bypass` | error, warn | false | `as unknown as T` はerror、`Record<string, unknown>` のassertion、未検証のJSON assertion、静的な `Reflect.get`、receiver無しの `Reflect.apply` はwarn |
|
|
89
|
-
| `no-unsafe-errno-assertion` | warn | false | catchした値を検証せず `NodeJS.ErrnoException` のassertion経由で `code` を読むコード |
|
|
90
|
-
| `no-meaningless-test` | error, warn | false | identifierやliteralを自分自身と比較する `toBe`・`toEqual`・`toStrictEqual` はerror、空の `test`・`it` callbackはwarn |
|
|
91
|
-
| `no-useless-abstraction` | warn | false | 同じ引数を別の関数へ渡すだけの名前付き単一引数arrow function(async版も含む) |
|
|
92
|
-
| `no-ternary-statement` | warn | false | `flag ? enable() : disable()` のような文としてのternary |
|
|
93
|
-
|
|
94
|
-
ruleは意図的に狭く保つ
|
|
95
|
-
検証、変換、log、cache、transaction開始などの処理を行うwrapperはpass-through wrapperとして報告しない
|
|
96
|
-
準備やassertionのあるtestは空として扱わない
|
|
97
|
-
|
|
98
|
-
```ts
|
|
99
|
-
throw new Error("Not implemented");
|
|
100
|
-
request.catch(() => null);
|
|
101
|
-
|
|
102
|
-
const user = value as unknown as User;
|
|
103
|
-
const parsed = JSON.parse(text) as User;
|
|
104
|
-
const code = (error as NodeJS.ErrnoException).code;
|
|
105
|
-
|
|
106
|
-
test("placeholder", () => {});
|
|
107
|
-
expect(result).toEqual(result);
|
|
108
|
-
|
|
109
|
-
const loadUser = (id) => fetchUser(id);
|
|
110
|
-
|
|
111
|
-
flag ? enable() : disable();
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
理由を添えて意図的な例外を抑制する
|
|
115
|
-
|
|
116
|
-
```ts
|
|
117
|
-
// biome-ignore lint/plugin: An optional cache miss is an expected fallback
|
|
118
|
-
cacheRequest.catch(() => null);
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### plugins/network
|
|
122
|
-
|
|
123
|
-
| Rule | 重大度 | Default | 検出対象 |
|
|
124
|
-
| ------------------------------- | ------ | ------- | ------------------------------------------------------------------------- |
|
|
125
|
-
| `require-fetch-abort-signal` | warn | false | `signal` optionを省いた `fetch` 呼び出し |
|
|
126
|
-
| `require-abort-timeout-cleanup` | warn | false | `setTimeout` callbackで `fetch` をabortしながらそのtimerをclearしない関数 |
|
|
127
|
-
|
|
128
|
-
### plugins/discord
|
|
129
|
-
|
|
130
|
-
| Rule | 重大度 | Default | 検出対象 |
|
|
131
|
-
| ----------------------------------- | ------ | ------- | ------------------------------------------------------------ |
|
|
132
|
-
| `no-unsafe-dynamic-discord-message` | warn | false | 明示的な `allowedMentions` policy無しで送る動的なmessage内容 |
|
|
133
|
-
|
|
134
|
-
## Scoped rules
|
|
135
|
-
|
|
136
|
-
| Rule | 重大度 | Default | 検出対象 |
|
|
137
|
-
| -------------------- | ------ | ------- | ------------------------------------------------------------------------------ |
|
|
138
|
-
| `no-adapter-import` | error | false | `integrations/` か `adapters/` を含むpathのimport |
|
|
139
|
-
| `no-direct-response` | error | false | 対象層での `new Response(...)`、`Response.json(...)`、`Response.redirect(...)` |
|
|
140
|
-
|
|
141
|
-
対象層を選ぶ `includes` を必要とするため共有presetでは持てない
|
|
142
|
-
Project自身の設定で宣言する
|
|
143
|
-
|
|
144
|
-
### no-adapter-import
|
|
145
|
-
|
|
146
|
-
```json
|
|
147
|
-
{
|
|
148
|
-
"plugins": [
|
|
149
|
-
{
|
|
150
|
-
"path": "./node_modules/@yuu1111/biome-config/plugins/scoped/no-adapter-import.grit",
|
|
151
|
-
"includes": [
|
|
152
|
-
"**/src/modules/authorization/**"
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
-
]
|
|
156
|
-
}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
pluginは `includes` に一致したfileだけで走る
|
|
160
|
-
そのためadapter側と、統合層へ到達してよい層では同じimportが有効なままになる
|
|
161
|
-
patternはfileのfull pathと照合されるため、`src/modules/authorization` のようなpathへ一致させるには `**/` から始める
|
|
162
|
-
|
|
163
|
-
pluginの `path` はfile pathとして解決される
|
|
164
|
-
そのため上記のように `node_modules` 経由のpathを書く
|
|
165
|
-
`@yuu1111/biome-config/plugins/scoped/no-adapter-import.grit` のようなpackage specifierはplugin packageとして解決され、`.grit` fileへは到達しない
|
|
166
|
-
|
|
167
|
-
統合moduleへ到達してよい層はpatternから外す
|
|
168
|
-
自身のadapter実装を `adapters/` に置くmoduleは、そのディレクトリを除外しないとruleがadapter自身を報告する
|
|
169
|
-
|
|
170
|
-
```json
|
|
171
|
-
{
|
|
172
|
-
"includes": [
|
|
173
|
-
"**/src/modules/authorization/**",
|
|
174
|
-
"!**/src/modules/authorization/adapters/**"
|
|
175
|
-
]
|
|
176
|
-
}
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
### no-direct-response
|
|
180
|
-
|
|
181
|
-
```json
|
|
182
|
-
{
|
|
183
|
-
"plugins": [
|
|
184
|
-
{
|
|
185
|
-
"path": "./node_modules/@yuu1111/biome-config/plugins/scoped/no-direct-response.grit",
|
|
186
|
-
"includes": [
|
|
187
|
-
"**/src/worker/routes/**"
|
|
188
|
-
]
|
|
189
|
-
}
|
|
190
|
-
]
|
|
191
|
-
}
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
helper module自身はpatternの外に置くため、responseを組み立ててよい
|
package/README.md
CHANGED
|
@@ -12,30 +12,26 @@ bun add -D @yuu1111/biome-config
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
-
Extend `biome
|
|
15
|
+
Extend `biome`, or `react` for a project with CSS:
|
|
16
16
|
|
|
17
17
|
```json
|
|
18
18
|
{
|
|
19
19
|
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
|
20
20
|
"extends": [
|
|
21
|
-
"@yuu1111/biome-config/biome"
|
|
22
|
-
"@yuu1111/biome-config/plugins/core"
|
|
21
|
+
"@yuu1111/biome-config/biome"
|
|
23
22
|
]
|
|
24
23
|
}
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
The custom rules that used to ship as GritQL plugins live in [`@yuu1111/oxc-config`](../oxc-config/README.md) as an Oxlint JS plugin.
|
|
27
|
+
GritQL plugins made the Biome lint about twice as slow, and Oxlint runs the same checks in well under a second.
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
| ----------------- | ------------------------------------------ |
|
|
31
|
-
| `biome` | Formatter, lint rules, and VCS integration |
|
|
32
|
-
| `react` | `biome` plus CSS and Tailwind |
|
|
33
|
-
| `plugins/core` | Seven general-purpose rule plugins |
|
|
34
|
-
| `plugins/network` | Two `fetch` rule plugins |
|
|
35
|
-
| `plugins/discord` | One Discord rule plugin |
|
|
29
|
+
## Presets
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
| Preset | Use case |
|
|
32
|
+
| ------- | ------------------------------------------ |
|
|
33
|
+
| `biome` | Formatter, lint rules, and VCS integration |
|
|
34
|
+
| `react` | `biome` plus CSS and Tailwind |
|
|
39
35
|
|
|
40
36
|
### biome
|
|
41
37
|
|
|
@@ -78,115 +74,3 @@ Adds the CSS formatter and linter, with the Tailwind directives enabled.
|
|
|
78
74
|
]
|
|
79
75
|
}
|
|
80
76
|
```
|
|
81
|
-
|
|
82
|
-
### plugins/core
|
|
83
|
-
|
|
84
|
-
| Rule | Severity | Default | Detects |
|
|
85
|
-
| ------------------------------ | ----------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
86
|
-
| `no-reexports` | warn | false | An export that only forwards an existing binding, such as `export type Alias = Imported` or `export default imported`; `export { imported }` is caught by the base `style.noExportedImports` and the `export ... from` forms by the base barrel-file rules |
|
|
87
|
-
| `no-incomplete-implementation` | error, warn | false | A placeholder throw, as an error; a catch block that only logs, or a rejected promise or caught error replaced with `null`, `[]`, or `{}`, as a warning |
|
|
88
|
-
| `no-type-safety-bypass` | error, warn | false | `as unknown as T`, as an error; a `Record<string, unknown>` assertion, an unchecked JSON assertion, static `Reflect.get`, or a receiver-free `Reflect.apply`, as a warning |
|
|
89
|
-
| `no-unsafe-errno-assertion` | warn | false | Reading `code` through a `NodeJS.ErrnoException` assertion without validating the caught value |
|
|
90
|
-
| `no-meaningless-test` | error, warn | false | A `toBe`, `toEqual`, or `toStrictEqual` comparison of an identifier or literal with itself, as an error; an empty `test` or `it` callback, as a warning |
|
|
91
|
-
| `no-useless-abstraction` | warn | false | A named single-argument arrow function that only passes the same argument to another function, including the async form |
|
|
92
|
-
| `no-ternary-statement` | warn | false | A ternary operator used as a standalone statement, such as `flag ? enable() : disable()` |
|
|
93
|
-
|
|
94
|
-
The rules stay narrow.
|
|
95
|
-
A wrapper that validates, transforms, logs, caches, starts a transaction, or performs another operation is not reported as a pass-through wrapper.
|
|
96
|
-
A test with setup or assertions is not treated as empty.
|
|
97
|
-
|
|
98
|
-
```ts
|
|
99
|
-
throw new Error("Not implemented");
|
|
100
|
-
request.catch(() => null);
|
|
101
|
-
|
|
102
|
-
const user = value as unknown as User;
|
|
103
|
-
const parsed = JSON.parse(text) as User;
|
|
104
|
-
const code = (error as NodeJS.ErrnoException).code;
|
|
105
|
-
|
|
106
|
-
test("placeholder", () => {});
|
|
107
|
-
expect(result).toEqual(result);
|
|
108
|
-
|
|
109
|
-
const loadUser = (id) => fetchUser(id);
|
|
110
|
-
|
|
111
|
-
flag ? enable() : disable();
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Suppress an intentional exception with a reason:
|
|
115
|
-
|
|
116
|
-
```ts
|
|
117
|
-
// biome-ignore lint/plugin: An optional cache miss is an expected fallback
|
|
118
|
-
cacheRequest.catch(() => null);
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### plugins/network
|
|
122
|
-
|
|
123
|
-
| Rule | Severity | Default | Detects |
|
|
124
|
-
| ------------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------ |
|
|
125
|
-
| `require-fetch-abort-signal` | warn | false | A `fetch` call that omits the `signal` option |
|
|
126
|
-
| `require-abort-timeout-cleanup` | warn | false | A function that aborts a `fetch` request from a `setTimeout` callback but never clears the timer |
|
|
127
|
-
|
|
128
|
-
### plugins/discord
|
|
129
|
-
|
|
130
|
-
| Rule | Severity | Default | Detects |
|
|
131
|
-
| ----------------------------------- | -------- | ------- | ------------------------------------------------------------------------- |
|
|
132
|
-
| `no-unsafe-dynamic-discord-message` | warn | false | Dynamic message content sent without an explicit `allowedMentions` policy |
|
|
133
|
-
|
|
134
|
-
## Scoped rules
|
|
135
|
-
|
|
136
|
-
| Rule | Severity | Default | Detects |
|
|
137
|
-
| -------------------- | -------- | ------- | ------------------------------------------------------------------------------------------ |
|
|
138
|
-
| `no-adapter-import` | error | false | An import of a path that contains `integrations/` or `adapters/` |
|
|
139
|
-
| `no-direct-response` | error | false | `new Response(...)`, `Response.json(...)`, or `Response.redirect(...)` in the scoped layer |
|
|
140
|
-
|
|
141
|
-
They need `includes` to name the layer they protect, so a shared preset cannot carry them.
|
|
142
|
-
Declare them in the project's own configuration.
|
|
143
|
-
|
|
144
|
-
### no-adapter-import
|
|
145
|
-
|
|
146
|
-
```json
|
|
147
|
-
{
|
|
148
|
-
"plugins": [
|
|
149
|
-
{
|
|
150
|
-
"path": "./node_modules/@yuu1111/biome-config/plugins/scoped/no-adapter-import.grit",
|
|
151
|
-
"includes": [
|
|
152
|
-
"**/src/modules/authorization/**"
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
-
]
|
|
156
|
-
}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
The plugin runs only on the files that match `includes`, so the same import stays valid in the adapters and in the layers that are allowed to reach them.
|
|
160
|
-
A plugin pattern is matched against the full file path, so it has to start with `**/` to match a path such as `src/modules/authorization`.
|
|
161
|
-
|
|
162
|
-
Biome resolves a plugin `path` as a file path, so reference the rule through `node_modules` as shown above.
|
|
163
|
-
A package specifier such as `@yuu1111/biome-config/plugins/scoped/no-adapter-import.grit` is resolved as a plugin package instead.
|
|
164
|
-
|
|
165
|
-
Leave the layer that is allowed to reach the integration modules out of the pattern.
|
|
166
|
-
A module that keeps its own adapter implementations under an `adapters/` directory has to exclude that directory, or the rule reports the adapters themselves:
|
|
167
|
-
|
|
168
|
-
```json
|
|
169
|
-
{
|
|
170
|
-
"includes": [
|
|
171
|
-
"**/src/modules/authorization/**",
|
|
172
|
-
"!**/src/modules/authorization/adapters/**"
|
|
173
|
-
]
|
|
174
|
-
}
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
### no-direct-response
|
|
178
|
-
|
|
179
|
-
```json
|
|
180
|
-
{
|
|
181
|
-
"plugins": [
|
|
182
|
-
{
|
|
183
|
-
"path": "./node_modules/@yuu1111/biome-config/plugins/scoped/no-direct-response.grit",
|
|
184
|
-
"includes": [
|
|
185
|
-
"**/src/worker/routes/**"
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
]
|
|
189
|
-
}
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
The helper module itself stays outside the pattern, so it can still construct responses.
|
package/base.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuu1111/biome-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Shared Biome configuration",
|
|
5
5
|
"homepage": "https://yuu1111.github.io/configs/packages/config/biome-config/",
|
|
6
6
|
"repository": {
|
|
@@ -10,18 +10,11 @@
|
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
12
12
|
"./biome": "./base.json",
|
|
13
|
-
"./plugins/core": "./plugins-core.json",
|
|
14
|
-
"./plugins/discord": "./plugins-discord.json",
|
|
15
|
-
"./plugins/network": "./plugins-network.json",
|
|
16
13
|
"./react": "./react.json"
|
|
17
14
|
},
|
|
18
15
|
"files": [
|
|
19
16
|
"README.ja.md",
|
|
20
17
|
"base.json",
|
|
21
|
-
"plugins",
|
|
22
|
-
"plugins-core.json",
|
|
23
|
-
"plugins-discord.json",
|
|
24
|
-
"plugins-network.json",
|
|
25
18
|
"react.json"
|
|
26
19
|
],
|
|
27
20
|
"keywords": [
|
package/react.json
CHANGED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
engine biome(1.0)
|
|
2
|
-
language js(typescript)
|
|
3
|
-
|
|
4
|
-
or {
|
|
5
|
-
JsThrowStatement(argument=JsNewExpression(callee=JsIdentifierExpression())) as $match where {
|
|
6
|
-
$match <: r"(?i).*not[ -]?implemented.*|.*todo.*|.*coming soon.*",
|
|
7
|
-
register_diagnostic(span=$match, message="Remove the placeholder implementation", severity="error")
|
|
8
|
-
},
|
|
9
|
-
`$promise.catch(() => null)` as $match where {
|
|
10
|
-
register_diagnostic(span=$match, message="Do not leave incomplete implementations or silently replace failures", severity="warn")
|
|
11
|
-
},
|
|
12
|
-
`$promise.catch(() => [])` as $match where {
|
|
13
|
-
register_diagnostic(span=$match, message="Do not leave incomplete implementations or silently replace failures", severity="warn")
|
|
14
|
-
},
|
|
15
|
-
`$promise.catch(() => ({}))` as $match where {
|
|
16
|
-
register_diagnostic(span=$match, message="Do not leave incomplete implementations or silently replace failures", severity="warn")
|
|
17
|
-
},
|
|
18
|
-
`$promise.catch(($error) => null)` as $match where {
|
|
19
|
-
register_diagnostic(span=$match, message="Do not leave incomplete implementations or silently replace failures", severity="warn")
|
|
20
|
-
},
|
|
21
|
-
`$promise.catch(($error) => [])` as $match where {
|
|
22
|
-
register_diagnostic(span=$match, message="Do not leave incomplete implementations or silently replace failures", severity="warn")
|
|
23
|
-
},
|
|
24
|
-
`$promise.catch(($error) => ({}))` as $match where {
|
|
25
|
-
register_diagnostic(span=$match, message="Do not leave incomplete implementations or silently replace failures", severity="warn")
|
|
26
|
-
},
|
|
27
|
-
`try { $...body } catch ($error) { return null; }` as $match where {
|
|
28
|
-
register_diagnostic(span=$match, message="Do not leave incomplete implementations or silently replace failures", severity="warn")
|
|
29
|
-
},
|
|
30
|
-
`try { $...body } catch ($error) { return []; }` as $match where {
|
|
31
|
-
register_diagnostic(span=$match, message="Do not leave incomplete implementations or silently replace failures", severity="warn")
|
|
32
|
-
},
|
|
33
|
-
`try { $...body } catch ($error) { return {}; }` as $match where {
|
|
34
|
-
register_diagnostic(span=$match, message="Do not leave incomplete implementations or silently replace failures", severity="warn")
|
|
35
|
-
},
|
|
36
|
-
JsCatchClause(body=JsBlockStatement(statements=[
|
|
37
|
-
$statement
|
|
38
|
-
])) as $match where {
|
|
39
|
-
$statement <: r"^console\.(?:debug|error|info|log|warn)\(.*",
|
|
40
|
-
register_diagnostic(span=$match, message="Do not leave incomplete implementations or silently replace failures", severity="warn")
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
engine biome(1.0)
|
|
2
|
-
language js(typescript)
|
|
3
|
-
|
|
4
|
-
or {
|
|
5
|
-
`$test($name, () => {}, $...)` as $match where {
|
|
6
|
-
$test <: r"^(?:test|it)$",
|
|
7
|
-
register_diagnostic(span=$match, message="Remove empty tests", severity="warn")
|
|
8
|
-
},
|
|
9
|
-
`$test($name, async () => {}, $...)` as $match where {
|
|
10
|
-
$test <: r"^(?:test|it)$",
|
|
11
|
-
register_diagnostic(span=$match, message="Remove empty tests", severity="warn")
|
|
12
|
-
},
|
|
13
|
-
`$test($name, function () {}, $...)` as $match where {
|
|
14
|
-
$test <: r"^(?:test|it)$",
|
|
15
|
-
register_diagnostic(span=$match, message="Remove empty tests", severity="warn")
|
|
16
|
-
},
|
|
17
|
-
`$test($name, async function () {}, $...)` as $match where {
|
|
18
|
-
$test <: r"^(?:test|it)$",
|
|
19
|
-
register_diagnostic(span=$match, message="Remove empty tests", severity="warn")
|
|
20
|
-
},
|
|
21
|
-
`expect($value).$matcher($value)` as $match where {
|
|
22
|
-
$value <: JsIdentifierExpression(),
|
|
23
|
-
$matcher <: r"^(?:toBe|toEqual|toStrictEqual)$",
|
|
24
|
-
register_diagnostic(span=$match, message="Remove tautological assertions", severity="error")
|
|
25
|
-
},
|
|
26
|
-
`expect($value).$matcher($value)` as $match where {
|
|
27
|
-
$value <: JsStringLiteralExpression(),
|
|
28
|
-
$matcher <: r"^(?:toBe|toEqual|toStrictEqual)$",
|
|
29
|
-
register_diagnostic(span=$match, message="Remove tautological assertions", severity="error")
|
|
30
|
-
},
|
|
31
|
-
`expect($value).$matcher($value)` as $match where {
|
|
32
|
-
$value <: JsNumberLiteralExpression(),
|
|
33
|
-
$matcher <: r"^(?:toBe|toEqual|toStrictEqual)$",
|
|
34
|
-
register_diagnostic(span=$match, message="Remove tautological assertions", severity="error")
|
|
35
|
-
},
|
|
36
|
-
`expect($value).$matcher($value)` as $match where {
|
|
37
|
-
$value <: JsBooleanLiteralExpression(),
|
|
38
|
-
$matcher <: r"^(?:toBe|toEqual|toStrictEqual)$",
|
|
39
|
-
register_diagnostic(span=$match, message="Remove tautological assertions", severity="error")
|
|
40
|
-
},
|
|
41
|
-
`expect($value).$matcher($value)` as $match where {
|
|
42
|
-
$value <: JsNullLiteralExpression(),
|
|
43
|
-
$matcher <: r"^(?:toBe|toEqual|toStrictEqual)$",
|
|
44
|
-
register_diagnostic(span=$match, message="Remove tautological assertions", severity="error")
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
engine biome(1.0)
|
|
2
|
-
language js(typescript)
|
|
3
|
-
|
|
4
|
-
or {
|
|
5
|
-
JsExport(export_clause=TsTypeAliasDeclaration(ty=$type)) as $match where {
|
|
6
|
-
$type <: r"^[A-Za-z_$][A-Za-z0-9_$]*$",
|
|
7
|
-
not $type <: r"^(?:any|bigint|boolean|never|null|number|object|string|symbol|undefined|unknown|void)$"
|
|
8
|
-
},
|
|
9
|
-
JsExport(export_clause=JsExportDefaultExpressionClause(expression=JsIdentifierExpression())) as $match,
|
|
10
|
-
JsExport(export_clause=JsVariableDeclarationClause(declaration=JsVariableDeclaration(declarators=$declarators))) as $match where {
|
|
11
|
-
$declarators <: some JsVariableDeclarator(initializer=JsInitializerClause(expression=JsIdentifierExpression()))
|
|
12
|
-
}
|
|
13
|
-
} where {
|
|
14
|
-
register_diagnostic(span=$match, message="Re-export is prohibited", severity="warn")
|
|
15
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
engine biome(1.0)
|
|
2
|
-
language js(typescript)
|
|
3
|
-
|
|
4
|
-
or {
|
|
5
|
-
`$value as unknown as $type` as $match where {
|
|
6
|
-
register_diagnostic(span=$match, message="Do not bypass type safety with a chained assertion", severity="error")
|
|
7
|
-
},
|
|
8
|
-
`$value as Record<string, unknown>` as $match where {
|
|
9
|
-
register_diagnostic(span=$match, message="Validate the object shape instead of asserting a generic dictionary", severity="warn")
|
|
10
|
-
},
|
|
11
|
-
`JSON.parse($value) as $type` as $match where {
|
|
12
|
-
not $type <: `unknown`,
|
|
13
|
-
register_diagnostic(span=$match, message="Validate parsed JSON before asserting its type", severity="warn")
|
|
14
|
-
},
|
|
15
|
-
`$response.json() as Promise<$type>` as $match where {
|
|
16
|
-
register_diagnostic(span=$match, message="Validate the JSON response before asserting its type", severity="warn")
|
|
17
|
-
},
|
|
18
|
-
`(await $response.json()) as $type` as $match where {
|
|
19
|
-
not $type <: `unknown`,
|
|
20
|
-
register_diagnostic(span=$match, message="Validate the JSON response before asserting its type", severity="warn")
|
|
21
|
-
},
|
|
22
|
-
`Reflect.get($object, $property)` as $match where {
|
|
23
|
-
$property <: JsStringLiteralExpression(),
|
|
24
|
-
register_diagnostic(span=$match, message="Use direct property access when the property name is static", severity="warn")
|
|
25
|
-
},
|
|
26
|
-
`Reflect.apply($function, undefined, $arguments)` as $match where {
|
|
27
|
-
$arguments <: JsArrayExpression(),
|
|
28
|
-
register_diagnostic(span=$match, message="Call the function directly when no receiver is required", severity="warn")
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
engine biome(1.0)
|
|
2
|
-
language js(typescript)
|
|
3
|
-
|
|
4
|
-
or {
|
|
5
|
-
`($value as NodeJS.ErrnoException).code` as $match,
|
|
6
|
-
`($value as NodeJS.ErrnoException)["code"]` as $match
|
|
7
|
-
} where {
|
|
8
|
-
register_diagnostic(span=$match, message="Validate the error shape before reading errno properties", severity="warn")
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
engine biome(1.0)
|
|
2
|
-
language js(typescript)
|
|
3
|
-
|
|
4
|
-
or {
|
|
5
|
-
`const $wrapper = ($argument) => $target($argument)` as $match,
|
|
6
|
-
`const $wrapper = async ($argument) => await $target($argument)` as $match
|
|
7
|
-
} where {
|
|
8
|
-
register_diagnostic(span=$match, message="Remove pass-through wrappers that add no behavior", severity="warn")
|
|
9
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
engine biome(1.0)
|
|
2
|
-
language js(typescript)
|
|
3
|
-
|
|
4
|
-
or {
|
|
5
|
-
`$target.$method($content)` as $match where {
|
|
6
|
-
$method <: r"^(?:reply|send|editReply|followUp|update)$",
|
|
7
|
-
or {
|
|
8
|
-
$content <: JsIdentifierExpression(),
|
|
9
|
-
$content <: JsTemplateExpression()
|
|
10
|
-
},
|
|
11
|
-
not $target <: `createHash($algorithm)`,
|
|
12
|
-
not $target <: `$namespace.createHash($algorithm)`,
|
|
13
|
-
register_diagnostic(span=$match, message="Wrap dynamic Discord content in a payload that disables mentions", severity="warn")
|
|
14
|
-
},
|
|
15
|
-
`$target.$method({ $... })` as $match where {
|
|
16
|
-
$method <: r"^(?:reply|send|editReply|followUp|update)$",
|
|
17
|
-
$match <: contains `content: $content`,
|
|
18
|
-
or {
|
|
19
|
-
$content <: JsIdentifierExpression(),
|
|
20
|
-
$content <: JsTemplateExpression()
|
|
21
|
-
},
|
|
22
|
-
not $match <: contains `allowedMentions: $allowedMentions`,
|
|
23
|
-
not $match <: contains JsShorthandPropertyObjectMember(name=$name) where {
|
|
24
|
-
$name <: `allowedMentions`
|
|
25
|
-
},
|
|
26
|
-
register_diagnostic(span=$match, message="Set allowedMentions when sending dynamic Discord content", severity="warn")
|
|
27
|
-
},
|
|
28
|
-
`$target.$method({ $... })` as $match where {
|
|
29
|
-
$method <: r"^(?:reply|send|editReply|followUp|update)$",
|
|
30
|
-
$match <: contains JsShorthandPropertyObjectMember(name=$content) where {
|
|
31
|
-
$content <: `content`
|
|
32
|
-
},
|
|
33
|
-
not $match <: contains `allowedMentions: $allowedMentions`,
|
|
34
|
-
not $match <: contains JsShorthandPropertyObjectMember(name=$name) where {
|
|
35
|
-
$name <: `allowedMentions`
|
|
36
|
-
},
|
|
37
|
-
register_diagnostic(span=$match, message="Set allowedMentions when sending dynamic Discord content", severity="warn")
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
engine biome(1.0)
|
|
2
|
-
language js(typescript)
|
|
3
|
-
|
|
4
|
-
`const $timer = setTimeout(() => $controller.abort(), $delay)` as $match where {
|
|
5
|
-
$match <: within JsFunctionBody() as $scope,
|
|
6
|
-
$scope <: contains `fetch($url, { $... })` as $fetch where {
|
|
7
|
-
$fetch <: contains `signal: $controller.signal`
|
|
8
|
-
},
|
|
9
|
-
not $scope <: contains `clearTimeout($timer)`,
|
|
10
|
-
register_diagnostic(span=$match, message="Clear the AbortController timeout after using its signal", severity="warn")
|
|
11
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
engine biome(1.0)
|
|
2
|
-
language js(typescript)
|
|
3
|
-
|
|
4
|
-
or {
|
|
5
|
-
`fetch($url)` as $match where {
|
|
6
|
-
$url <: [$argument],
|
|
7
|
-
register_diagnostic(span=$match, message="Pass an AbortSignal to external fetch calls", severity="warn")
|
|
8
|
-
},
|
|
9
|
-
`fetch($url, { $... })` as $match where {
|
|
10
|
-
not $match <: contains `signal: $signal`,
|
|
11
|
-
not $match <: contains JsShorthandPropertyObjectMember(name=$name) where {
|
|
12
|
-
$name <: `signal`
|
|
13
|
-
},
|
|
14
|
-
register_diagnostic(span=$match, message="Pass an AbortSignal to external fetch calls", severity="warn")
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
engine biome(1.0)
|
|
2
|
-
language js(typescript)
|
|
3
|
-
|
|
4
|
-
JsImport() as $match where {
|
|
5
|
-
$match <: contains JsModuleSource() as $source where {
|
|
6
|
-
$source <: r".*(?:integrations|adapters)/.*"
|
|
7
|
-
},
|
|
8
|
-
register_diagnostic(span=$match, message="Import the port instead of the adapter module", severity="error")
|
|
9
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
engine biome(1.0)
|
|
2
|
-
language js(typescript)
|
|
3
|
-
|
|
4
|
-
or {
|
|
5
|
-
`new Response($...)` as $match where {
|
|
6
|
-
register_diagnostic(span=$match, message="Build the response with the shared response helper", severity="error")
|
|
7
|
-
},
|
|
8
|
-
`Response.json($body)` as $match where {
|
|
9
|
-
register_diagnostic(span=$match, message="Build the response with the shared response helper", severity="error")
|
|
10
|
-
},
|
|
11
|
-
`Response.json($body, $init)` as $match where {
|
|
12
|
-
register_diagnostic(span=$match, message="Build the response with the shared response helper", severity="error")
|
|
13
|
-
},
|
|
14
|
-
`Response.redirect($url)` as $match where {
|
|
15
|
-
register_diagnostic(span=$match, message="Build the response with the shared response helper", severity="error")
|
|
16
|
-
},
|
|
17
|
-
`Response.redirect($url, $status)` as $match where {
|
|
18
|
-
register_diagnostic(span=$match, message="Build the response with the shared response helper", severity="error")
|
|
19
|
-
}
|
|
20
|
-
}
|
package/plugins-core.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"plugins": [
|
|
3
|
-
"./node_modules/@yuu1111/biome-config/plugins/core/no-reexports.grit",
|
|
4
|
-
"./node_modules/@yuu1111/biome-config/plugins/core/no-incomplete-implementation.grit",
|
|
5
|
-
"./node_modules/@yuu1111/biome-config/plugins/core/no-type-safety-bypass.grit",
|
|
6
|
-
"./node_modules/@yuu1111/biome-config/plugins/core/no-unsafe-errno-assertion.grit",
|
|
7
|
-
"./node_modules/@yuu1111/biome-config/plugins/core/no-meaningless-test.grit",
|
|
8
|
-
"./node_modules/@yuu1111/biome-config/plugins/core/no-useless-abstraction.grit",
|
|
9
|
-
"./node_modules/@yuu1111/biome-config/plugins/core/no-ternary-statement.grit"
|
|
10
|
-
]
|
|
11
|
-
}
|
package/plugins-discord.json
DELETED