@webority/biome-config 0.156.0 → 0.158.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.md CHANGED
@@ -58,7 +58,7 @@ A component named here must draw its string children inside `Text`. Raw text in
58
58
  - **`noUnresolvedImports`: not set, and a product never turns it on in its own `biome.json`.** Biome 2.6.5 reports React's `Fragment` as a missing export from `react` and `react/jsx-runtime`. The repo-checks `missing-export` check runs the same rule with React's known false alarms filtered, and TypeScript checks every import.
59
59
  - **`noConsole`** off for `scripts/**` and `logger.js`; CSS and SCSS not linted; the icon module's mixed export allowed.
60
60
  - **`StyleSheet.absoluteFillObject`** is an error, through the `no-absolute-fill-object` plugin (below).
61
- - **Twenty-one GritQL plugins** (`mobile-grit-*`, `web-grit-*`, `no-absolute-fill-object`, `no-raw-form`, `no-locale-in-screen`, `no-store-checks-off`, `no-whole-slice-selector`, `form-needs-no-validate` and `no-fixed-key-reflect-get`, below) are errors.
61
+ - **Twenty-two GritQL plugins** (`mobile-grit-*`, `web-grit-*`, `no-absolute-fill-object`, `no-raw-form`, `no-locale-in-screen`, `no-store-checks-off`, `no-whole-slice-selector`, `form-needs-no-validate` and `no-fixed-key-reflect-get`, below) are errors.
62
62
  - `**/razor-js/*.ts`: classic page scripts keep `"use strict"`, function declarations and string concatenation; four module-only rules are off.
63
63
  - `**/*.md`: Markdown is neither formatted nor linted, because Biome rewrites bare glob paths and a lint fix under `check --write` would rewrite a changelog's released sections.
64
64
 
@@ -135,7 +135,8 @@ The config ships lint plugins in `plugins/` and turns them on for every product
135
135
  | `mobile-grit-select-from-result` | an RTK Query `selectFromResult` that returns a non-object value, or that takes `refetch` | RTK Query spreads the result beside `refetch`, so a plain value replaces the hook result. Return `{ name: value }` and destructure; take `refetch` from the hook's own result. |
136
136
  | `mobile-grit-keyboard-avoiding` | `KeyboardAvoidingView`, `Keyboard.addListener` | Keyboard handling is `react-native-keyboard-controller`: `KeyboardProvider`, `KeyboardAwareScrollView`, `KeyboardStickyView`. |
137
137
  | `mobile-grit-keychain-internet` | `setInternetCredentials`, `getInternetCredentials`, `hasInternetCredentials` | A token is a generic password. Use `setGenericPassword`, `getGenericPassword` and `resetGenericPassword`. `resetInternetCredentials` stays allowed for the first-install clean-up. |
138
- | `mobile-grit-unchecked-native-call` | A `NativeModules.<module>.<method>(...)` call, or a call on a default import from a `Native<Name>` module, whose result is dropped, voided, or caught by an empty handler, for example `void NativeModules.x.y()` | A failed native call goes unnoticed. Await it and handle the failure, or return it to a caller that does. |
138
+ | `mobile-grit-unchecked-native-call` | A `NativeModules.<module>.<method>(...)` call whose result is dropped, voided, or caught by an empty handler, for example `void NativeModules.x.y()` | A failed native call goes unnoticed. Await it and handle the failure, or return it to a caller that does. |
139
+ | `mobile-grit-unchecked-native-spec-call` | A call on a default import from a `Native<Name>` codegen spec module, whose result is dropped, voided, or caught by an empty handler, for example `NativeFoo.start();` | A failed native call goes unnoticed. Await it and handle the failure, or return it to a caller that does. |
139
140
  | `web-grit-axios-module-config` | `axios.create({ baseURL: <non-literal> })` or `timeout: <non-literal>` outside a function | Config read at import time cannot be set later. Resolve it at call time in an interceptor. |
140
141
  | `web-grit-empty-catch` | An empty `catch {}` block, or a promise `.catch(...)` whose handler is empty or returns only `null` or `undefined`, for example `.catch(() => {})` | The catch swallows the error. Handle it, retry it as a classified transient, or log it and rethrow it. A documented best-effort path says why in a `biome-ignore lint/plugin/web-grit-empty-catch` comment. |
141
142
  | `web-grit-raw-query-read` | An RTK Query hook result read outside `useDataState`, for example `const { data } = useGetXQuery()` or `api.endpoints.x.useQuery()`. A read that draws nothing for loading or error passes: one fed to `useDataState` or `useInfiniteDataState` through a variable, one with `selectFromResult`, a bare call that only holds the cache subscription, and one destructured with none of `isLoading`, `isFetching`, `isError`, `error` or `isUninitialized` (but not `{ data }` alone) | A screen reads a query only as a data state. Write `useDataState(useXQuery(args))` and draw it with AppAsyncBlock (AsyncBlock on phone). |
package/biome.jsonc CHANGED
@@ -43,7 +43,8 @@
43
43
  // web-grit-empty-catch: an empty catch block (a comment alone included) swallows the error.
44
44
  // web-grit-raw-query-read: an RTK Query hook result read outside useDataState.
45
45
  // web-grit-route-lazy-reload: a route's lazy or a React.lazy that loads a screen without the reload helper.
46
- // mobile-grit-unchecked-native-call: a NativeModules or codegen spec call whose result is dropped, voided or swallowed.
46
+ // mobile-grit-unchecked-native-call: a NativeModules call whose result is dropped, voided or swallowed.
47
+ // mobile-grit-unchecked-native-spec-call: a codegen spec call (a default import from Native<Name>) whose result is dropped, voided or swallowed.
47
48
  // no-raw-form: a JSX form element outside AppForm.tsx; AppForm drops a double submit and carries an idempotency key.
48
49
  // no-locale-in-screen: a toLocale* or Intl call in a screens/ file; the shared formatters format dates and numbers.
49
50
  // no-store-checks-off: serializableCheck or immutableCheck set to false in a store.
@@ -65,6 +66,7 @@
65
66
  "./node_modules/@webority/biome-config/plugins/web-grit-raw-query-read.grit",
66
67
  "./node_modules/@webority/biome-config/plugins/web-grit-route-lazy-reload.grit",
67
68
  "./node_modules/@webority/biome-config/plugins/mobile-grit-unchecked-native-call.grit",
69
+ "./node_modules/@webority/biome-config/plugins/mobile-grit-unchecked-native-spec-call.grit",
68
70
  "./node_modules/@webority/biome-config/plugins/no-raw-form.grit",
69
71
  "./node_modules/@webority/biome-config/plugins/no-locale-in-screen.grit",
70
72
  "./node_modules/@webority/biome-config/plugins/no-store-checks-off.grit",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/biome-config",
3
- "version": "0.156.0",
3
+ "version": "0.158.0",
4
4
  "description": "Shared Webority code standards: the Biome lint and format policy and the TypeScript compiler presets for web apps, phone apps, Razor page scripts and Node packages.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {
@@ -1,8 +1,8 @@
1
1
  language js
2
2
 
3
- // react-native.md → Failing loud: check the result of every native module call. A call through NativeModules or
4
- // through a codegen spec (a default import from a Native<Name> module) whose result is dropped or voided, or caught
5
- // by a handler that does nothing (awaited or not), hides a failed call. An awaited call with no catch is checked.
3
+ // react-native.md → Failing loud: check the result of every native module call. A call through NativeModules whose
4
+ // result is dropped or voided, or caught by a handler that does nothing (awaited or not), hides a failed call. An
5
+ // awaited call with no catch is checked. A codegen spec call is checked by mobile-grit-unchecked-native-spec-call.grit.
6
6
  JsExpressionStatement(expression=$call) as $stmt where {
7
7
  $call <: or {
8
8
  JsCallExpression(),
@@ -14,18 +14,7 @@ JsExpressionStatement(expression=$call) as $stmt where {
14
14
  $call <: r"(?s)(?:void\s+)?NativeModules\??\.[A-Za-z_$][\w$]*\??\.[A-Za-z_$][\w$]*\(.*",
15
15
  $call <: not r"(?s).*\.catch\(.*\)\s*$"
16
16
  },
17
- $call <: r"(?s)(?:void\s+|await\s+)?NativeModules\??\..*\.catch\(\s*(?:\(\s*[\w$]*\s*\)|[\w$]+)?\s*=>\s*(?:\{\s*\}|undefined|null|void 0)\s*\)\s*$",
18
- and {
19
- $call <: r"(?s)(?:void\s+|await\s+)?([A-Za-z_$][\w$]*)\??\.[A-Za-z_$][\w$]*\(.*"($native),
20
- $program <: contains `import $name from $source` where {
21
- $name <: $native,
22
- $source <: r"[\"'](?:.*/)?Native[A-Z][A-Za-z0-9]*[\"']"
23
- },
24
- or {
25
- and { $call <: not r"(?s)await\s.*", $call <: not r"(?s).*\.catch\(.*\)\s*$" },
26
- $call <: r"(?s).*\.catch\(\s*(?:\(\s*[\w$]*\s*\)|[\w$]+)?\s*=>\s*(?:\{\s*\}|undefined|null|void 0)\s*\)\s*$"
27
- }
28
- }
17
+ $call <: r"(?s)(?:void\s+|await\s+)?NativeModules\??\..*\.catch\(\s*(?:\(\s*[\w$]*\s*\)|[\w$]+)?\s*=>\s*(?:\{\s*\}|undefined|null|void 0)\s*\)\s*$"
29
18
  },
30
19
  register_diagnostic(span=$stmt, message="This native module call's result is never checked, so a failed call goes unnoticed. Await it and handle the failure, or return it to a caller that does.", severity="error")
31
20
  }
@@ -0,0 +1,23 @@
1
+ language js
2
+
3
+ // react-native.md → Failing loud: check the result of every codegen spec call. A call on a default import from a
4
+ // Native<Name> module whose result is dropped or voided, or caught by a handler that does nothing (awaited or not),
5
+ // hides a failed call. An awaited call with no catch is checked.
6
+ // The program scan runs once per Native import, not once per statement, because the per-statement scan made lint 25 times slower.
7
+ `import $native from $source` where {
8
+ $source <: r"[\"'](?:.*/)?Native[A-Z][A-Za-z0-9]*[\"']",
9
+ $program <: contains JsExpressionStatement(expression=$call) as $stmt where {
10
+ $call <: or {
11
+ JsCallExpression(),
12
+ JsUnaryExpression(),
13
+ JsAwaitExpression()
14
+ },
15
+ $call <: r"(?s)(?:void\s+|await\s+)?([A-Za-z_$][\w$]*)\??\.[A-Za-z_$][\w$]*\(.*"($recv),
16
+ $recv <: $native,
17
+ or {
18
+ and { $call <: not r"(?s)await\s.*", $call <: not r"(?s).*\.catch\(.*\)\s*$" },
19
+ $call <: r"(?s).*\.catch\(\s*(?:\(\s*[\w$]*\s*\)|[\w$]+)?\s*=>\s*(?:\{\s*\}|undefined|null|void 0)\s*\)\s*$"
20
+ },
21
+ register_diagnostic(span=$stmt, message="This native module call's result is never checked, so a failed call goes unnoticed. Await it and handle the failure, or return it to a caller that does.", severity="error")
22
+ }
23
+ }