@webority/biome-config 0.153.0 → 0.154.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
@@ -27,6 +27,23 @@ Then a product's `biome.json` extends this base and adds **only** its own repo-s
27
27
 
28
28
  A phone app (React Native or Expo) also extends `biome.phone.jsonc`, after the base: `"extends": ["@webority/biome-config/biome.jsonc", "@webority/biome-config/biome.phone.jsonc"]`. It sets `noReactNativeRawText` to `error`, with a `skip` list of the mobile-ui components that draw their string children inside `Text` (`Markdown`, `SectionHeader`). Raw text in any other element still fails. A new mobile-ui component that renders its children as text joins the list in `biome.phone.jsonc`. A web app never extends it, because the rule reads React Native's text model.
29
29
 
30
+ A phone app names its own text-rendering components in its own `biome.json`, under `linter.rules.correctness.noReactNativeRawText.options.skip`. List only the app's names. Biome appends this array to the one in `biome.phone.jsonc`, so `Markdown` and `SectionHeader` stay skipped and the app does not restate them. Keep `"level": "error"` beside `options`: Biome refuses the entry without it.
31
+
32
+ ```jsonc
33
+ {
34
+ "extends": ["@webority/biome-config/biome.jsonc", "@webority/biome-config/biome.phone.jsonc"],
35
+ "linter": {
36
+ "rules": {
37
+ "correctness": {
38
+ "noReactNativeRawText": { "level": "error", "options": { "skip": ["FormSectionHeader"] } }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ A component named here must draw its string children inside `Text`. Raw text in any element that is not named still fails.
46
+
30
47
  **Never set `formatter.lineEnding` in a product.** It is `lf` here, for every consuming repo, matching their `.gitattributes` (`* text=auto eol=lf`) and `.editorconfig` (`end_of_line = lf`). This config sets `useEditorconfig: false`, so the value above is the *only* place the line ending is stated. A local override is the deviation, and a stale one fails every file in the repo at once, drowning any real violation (one repo's leftover `"lineEnding": "crlf"` failed 198 of its 203 files; removing it left 1).
31
48
 
32
49
  ## What Biome decides here (once, for every repo)
@@ -38,6 +55,7 @@ A phone app (React Native or Expo) also extends `biome.phone.jsonc`, after the b
38
55
  - **Stricter rules, all `error`**: `noUnusedImports`, `noUnusedFunctionParameters` (prefix an interface-required parameter with `_`), `useOptionalChain`, `noUselessFragments`, `useTemplate`, `useIterableCallbackReturn`, `noGlobalIsNan`, `noAssignInExpressions`. Each is recorded with its reason in `biome.jsonc`.
39
56
  - **`noArrayIndexKey` and `noDuplicateProperties`: `error`**, kept on because they catch real dynamic-list bugs; genuine static-list exceptions get a documented per-line `biome-ignore`.
40
57
  - **`noFloatingPromises: error`** (nursery): see "Type-reading rules" below.
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.
41
59
  - **`noConsole`** off for `scripts/**` and `logger.js`; CSS and SCSS not linted; the icon module's mixed export allowed.
42
60
  - **`StyleSheet.absoluteFillObject`** is an error, through the `no-absolute-fill-object` plugin (below).
43
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.
@@ -120,7 +138,7 @@ The config ships lint plugins in `plugins/` and turns them on for every product
120
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. |
121
139
  | `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. |
122
140
  | `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. |
123
- | `web-grit-raw-query-read` | An RTK Query hook result read outside `useDataState`, for example `const { data } = useGetXQuery()` or `api.endpoints.x.useQuery()` | A screen reads a query only as a data state. Write `useDataState(useXQuery(args))` and draw it with AppAsyncBlock (AsyncBlock on phone). |
141
+ | `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). |
124
142
  | `web-grit-route-lazy-reload` | A `lazy(...)` or `React.lazy(...)` call, or a route `lazy:` property, whose argument is `import(...)` without the reload helper, for example `lazy: () => import(...)` | A tab opened before a deploy breaks on its next navigation. Load a route with `lazy: importWithReload(() => import(...))`, or a component with `lazyWithReload(() => import(...))`, both from `@webority/web-core/router`. |
125
143
 
126
144
  A plugin finding is an error, so `biome check` and `biome lint` fail on it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/biome-config",
3
- "version": "0.153.0",
3
+ "version": "0.154.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": {
@@ -2,6 +2,9 @@ language js
2
2
 
3
3
  // react.md → API data: a screen reads an RTK Query result only as a DataState.
4
4
  // useListQuery and useInfiniteListQuery are web-core list hooks, not generated RTK Query hooks.
5
+ // A read that draws nothing for loading or error passes: one fed to a data hook through a variable, one that
6
+ // picks its own fields with selectFromResult, a bare call that only holds the cache subscription, and one
7
+ // destructured with none of the loading and error fields. A read of data alone draws without a loading state.
5
8
  or {
6
9
  `$hook($args)` as $call where {
7
10
  $hook <: r"^use[A-Z][A-Za-z0-9]*Query$",
@@ -12,10 +15,27 @@ or {
12
15
  `$endpoint.useQuery($args)` as $call,
13
16
  `$endpoint.useInfiniteQuery($args)` as $call
14
17
  } where {
18
+ $args <: not r"(?s).*\bselectFromResult\b.*",
15
19
  $call <: not within or {
16
20
  `useDataState($_)`,
17
21
  `useDataState($_, $_)`,
18
- `useInfiniteDataState($_)`
22
+ `useInfiniteDataState($_)`,
23
+ `useInfiniteDataState($_, $_)`,
24
+ JsExpressionStatement(expression=$call)
25
+ },
26
+ $call <: not within `const $name = $call` where {
27
+ $name <: r"^[A-Za-z_$][A-Za-z0-9_$]*$",
28
+ $program <: contains or {
29
+ `useDataState($name)`,
30
+ `useDataState($name, $_)`,
31
+ `useInfiniteDataState($name)`,
32
+ `useInfiniteDataState($name, $_)`
33
+ }
34
+ },
35
+ $call <: not within `const $fields = $call` where {
36
+ $fields <: r"(?s)^\{.*\}$",
37
+ $fields <: not r"(?s).*\b(?:isLoading|isFetching|isError|error|isUninitialized)\b.*",
38
+ $fields <: not r"(?s)^\{\s*data\s*\}$"
19
39
  },
20
40
  register_diagnostic(span=$call, message="A query result is read only as a data state. Write useDataState(useXQuery(args)) and draw it with AppAsyncBlock (AsyncBlock on phone), which shows loading, the error with Retry, and empty.", severity="error")
21
41
  }