@yuu1111/biome-config 1.3.0 → 1.3.2

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.md CHANGED
@@ -46,8 +46,8 @@ Custom rules are opt-in. Add one preset after the base or React configuration:
46
46
 
47
47
  Choose the most specific preset needed by the project:
48
48
 
49
- - `plugins/core` checks re-exports, incomplete implementations, type-safety bypasses, meaningless tests, and pass-through wrappers
50
- - `plugins/network` includes `core` and requires an `AbortSignal` for `fetch`
49
+ - `plugins/core` checks re-exports, incomplete implementations, type-safety bypasses, unsafe errno assertions, meaningless tests, and pass-through wrappers
50
+ - `plugins/network` includes `core`, requires an `AbortSignal` for `fetch`, and checks cleanup for manually scheduled abort timeouts
51
51
  - `plugins/discord` includes `network` and checks dynamic Discord messages for explicit mention handling
52
52
 
53
53
  Do not list parent presets separately. Each child preset includes its parent rules.
@@ -57,6 +57,7 @@ Do not list parent presets separately. Each child preset includes its parent rul
57
57
  - `no-reexports` prohibits exports that only forward an imported symbol or module
58
58
  - `no-incomplete-implementation` warns about placeholder throws, catch blocks that only log, and rejected promises or caught errors replaced with `null`, `[]`, or `{}`
59
59
  - `no-type-safety-bypass` warns about `as unknown as T`, `Record<string, unknown>` assertions, unchecked JSON assertions, static `Reflect.get`, and receiver-free `Reflect.apply`
60
+ - `no-unsafe-errno-assertion` warns when code reads `code` directly through a `NodeJS.ErrnoException` assertion without validating the caught value
60
61
  - `no-meaningless-test` warns about empty `test` or `it` callbacks and `toBe`, `toEqual`, or `toStrictEqual` comparisons where an identifier or literal is compared with itself
61
62
  - `no-useless-abstraction` warns about named single-argument arrow functions that only pass the same argument to another function, including the equivalent async form
62
63
 
@@ -70,6 +71,7 @@ request.catch(() => null)
70
71
 
71
72
  const user = value as unknown as User
72
73
  const parsed = JSON.parse(text) as User
74
+ const code = (error as NodeJS.ErrnoException).code
73
75
 
74
76
  test("placeholder", () => {})
75
77
  expect(result).toEqual(result)
@@ -86,7 +88,8 @@ cacheRequest.catch(() => null)
86
88
 
87
89
  #### Network rule
88
90
 
89
- `require-fetch-abort-signal` warns when a `fetch` call omits the `signal` option.
91
+ - `require-fetch-abort-signal` warns when a `fetch` call omits the `signal` option
92
+ - `require-abort-timeout-cleanup` warns when a function uses a `setTimeout` callback to abort a `fetch` request but does not clear that timer
90
93
 
91
94
  #### Discord rule
92
95
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuu1111/biome-config",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Shared Biome configuration",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -8,6 +8,8 @@ or {
8
8
  $content <: JsIdentifierExpression(),
9
9
  $content <: JsTemplateExpression()
10
10
  },
11
+ not $target <: `createHash($algorithm)`,
12
+ not $target <: `$namespace.createHash($algorithm)`,
11
13
  register_diagnostic(span=$match, message="Wrap dynamic Discord content in a payload that disables mentions", severity="warn")
12
14
  },
13
15
  `$target.$method({ $... })` as $match where {
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1,11 @@
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
+ }
package/plugins-core.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "./node_modules/@yuu1111/biome-config/plugins/no-reexports.grit",
5
5
  "./node_modules/@yuu1111/biome-config/plugins/no-incomplete-implementation.grit",
6
6
  "./node_modules/@yuu1111/biome-config/plugins/no-type-safety-bypass.grit",
7
+ "./node_modules/@yuu1111/biome-config/plugins/no-unsafe-errno-assertion.grit",
7
8
  "./node_modules/@yuu1111/biome-config/plugins/no-meaningless-test.grit",
8
9
  "./node_modules/@yuu1111/biome-config/plugins/no-useless-abstraction.grit"
9
10
  ]
@@ -5,9 +5,11 @@
5
5
  "./node_modules/@yuu1111/biome-config/plugins/no-reexports.grit",
6
6
  "./node_modules/@yuu1111/biome-config/plugins/no-incomplete-implementation.grit",
7
7
  "./node_modules/@yuu1111/biome-config/plugins/no-type-safety-bypass.grit",
8
+ "./node_modules/@yuu1111/biome-config/plugins/no-unsafe-errno-assertion.grit",
8
9
  "./node_modules/@yuu1111/biome-config/plugins/no-meaningless-test.grit",
9
10
  "./node_modules/@yuu1111/biome-config/plugins/no-useless-abstraction.grit",
10
11
  "./node_modules/@yuu1111/biome-config/plugins/require-fetch-abort-signal.grit",
12
+ "./node_modules/@yuu1111/biome-config/plugins/require-abort-timeout-cleanup.grit",
11
13
  "./node_modules/@yuu1111/biome-config/plugins/no-unsafe-dynamic-discord-message.grit"
12
14
  ]
13
15
  }
@@ -5,8 +5,10 @@
5
5
  "./node_modules/@yuu1111/biome-config/plugins/no-reexports.grit",
6
6
  "./node_modules/@yuu1111/biome-config/plugins/no-incomplete-implementation.grit",
7
7
  "./node_modules/@yuu1111/biome-config/plugins/no-type-safety-bypass.grit",
8
+ "./node_modules/@yuu1111/biome-config/plugins/no-unsafe-errno-assertion.grit",
8
9
  "./node_modules/@yuu1111/biome-config/plugins/no-meaningless-test.grit",
9
10
  "./node_modules/@yuu1111/biome-config/plugins/no-useless-abstraction.grit",
10
- "./node_modules/@yuu1111/biome-config/plugins/require-fetch-abort-signal.grit"
11
+ "./node_modules/@yuu1111/biome-config/plugins/require-fetch-abort-signal.grit",
12
+ "./node_modules/@yuu1111/biome-config/plugins/require-abort-timeout-cleanup.grit"
11
13
  ]
12
14
  }