@webority/biome-config 0.161.0 → 0.163.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 +9 -2
- package/biome.jsonc +34 -2
- package/package.json +1 -1
- package/plugins/mobile-grit-accessibility-focus.grit +6 -0
- package/plugins/mobile-grit-blur-on-submit.grit +8 -0
- package/plugins/mobile-grit-deep-imports.grit +13 -0
- package/plugins/mobile-grit-experimental-background.grit +14 -0
- package/plugins/mobile-grit-large-title.grit +8 -0
- package/plugins/mobile-grit-navigation-shims.grit +14 -0
- package/plugins/mobile-grit-navigator-id.grit +21 -0
- package/plugins/no-legacy-component-props.grit +11 -0
- package/plugins/no-legacy-react-test-api.grit +14 -0
- package/plugins/web-grit-hand-built-overlay.grit +14 -0
- package/plugins/web-grit-ime-enter-submit.grit +20 -0
package/README.md
CHANGED
|
@@ -56,9 +56,11 @@ A component named here must draw its string children inside `Text`. Raw text in
|
|
|
56
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`.
|
|
57
57
|
- **`noFloatingPromises: error`** (nursery): see "Type-reading rules" below.
|
|
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
|
-
- **`noConsole`** off for `scripts/**` and `logger.js`; CSS and SCSS not linted; the icon module's mixed export allowed.
|
|
59
|
+
- **`noConsole`** off for `scripts/**` and `logger.js`; CSS and SCSS not linted, except a server-rendered site's own page styles under `wwwroot/` (linted with the recommended CSS rules); the icon module's mixed export allowed.
|
|
60
|
+
- **Page scripts and styles** of a server-rendered site (`.js`, `.mjs` and `.css` under `wwwroot/`) are linted like portal code when the root `biome.json` includes them. Keep vendored and minified files out of `files.includes` (`!**/wwwroot/lib`, `!**/*.min.js`, `!**/*.min.css`). `webority-repo-checks` counts their findings per file as `page-lint` against the shrink-only baseline.
|
|
60
61
|
- **`StyleSheet.absoluteFillObject`** is an error, through the `no-absolute-fill-object` plugin (below).
|
|
61
|
-
- **Twenty-
|
|
62
|
+
- **Twenty-seven 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`, `no-fixed-key-reflect-get`, `web-grit-ime-enter-submit`, `web-grit-hand-built-overlay`, `no-legacy-component-props` and `no-legacy-react-test-api`, below) are errors.
|
|
63
|
+
- **Deprecated and retired APIs: `error`.** `noDeprecatedImports` fails a named import of anything its own library marks `@deprecated` and prints the replacement the tag names (it does not follow `ns.member` through a namespace import). `noReactStringRefs` fails a string ref, which React 19 removed. Patterns React, React Native and React Navigation still support (class components, `forwardRef`, `Animated`, class `defaultProps`) are not banned. `webority-repo-checks` counts these findings and the three retired-pattern plugins per file against the shrink-only baseline, so a product adopts them with `--baseline-adopt`.
|
|
62
64
|
- `**/razor-js/*.ts`: classic page scripts keep `"use strict"`, function declarations and string concatenation; four module-only rules are off.
|
|
63
65
|
- `**/*.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
66
|
|
|
@@ -121,11 +123,16 @@ The config ships lint plugins in `plugins/` and turns them on for every product
|
|
|
121
123
|
|---|---|---|
|
|
122
124
|
| `no-absolute-fill-object` | `StyleSheet.absoluteFillObject` | React Native 0.86 removed it. It is `undefined`, and spreading it silently leaves the view in the layout flow. Use `StyleSheet.absoluteFill` (spread it or use it directly). |
|
|
123
125
|
| `no-raw-form` | A JSX `<form>` element in any file other than `AppForm.tsx` | A raw form lets a double click submit twice and sends no idempotency key. Use `AppForm` from `@webority/ui-react`. |
|
|
126
|
+
| `web-grit-ime-enter-submit` | An `Enter` key check (`e.key === "Enter"`) in a function that never reads `isComposing` or `isImeSafeEnter` | An Enter that confirms an input method composition (Hindi, Chinese, Japanese) would submit early; Safari reports it with keyCode 229. Use `isImeSafeEnter(event)` from `@webority/ui-react` or `@webority/ui-elements/helpers`, or check `!event.isComposing && event.keyCode !== 229`. |
|
|
127
|
+
| `web-grit-hand-built-overlay` | A JSX element with `role="dialog"`, `role="alertdialog"` or any `aria-modal` attribute, outside the library's own sources | A hand-built dialog or overlay misses the library's focus trap, Escape and stacking. Use `AppModal`, `AppDrawer`, `AppConfirmDialog`, `AppPopover` or `AppDropdown` from `@webority/ui-react`. |
|
|
124
128
|
| `no-locale-in-screen` | A `toLocale*()` call, or an `Intl.*` / `new Intl.*` call, in a file under a `screens/` folder (tests exempt), for example `d.toLocaleDateString("en-IN")` | A screen formats through the shared formatters: `formatDate`, `formatDateTime`, `formatNumber`, `formatINR` from `@webority/web-core` (`@webority/mobile-core` on phone). |
|
|
125
129
|
| `no-store-checks-off` | `serializableCheck: false` or `immutableCheck: false` | The store's checks catch a non-plain value or a mutation in development. Exclude only named `ignoredActions` or `ignoredPaths`, each with a one-line reason. |
|
|
126
130
|
| `no-whole-slice-selector` | An inline function passed to `useSelector` or `useAppSelector`, or a destructured result, for example `const { token } = useSelector(selectAccount)` | A selector returns one primitive or one stored reference, so the component re-renders only when that value changes. Write `useSelector(selectX)` and export derived data as a memoized selector from the slice file. |
|
|
127
131
|
| `no-fixed-key-reflect-get` | `Reflect.get` with a fixed key (a string or a template with no `${}`) reads a field the type does not declare; read `obj.key`, or narrow with `'key' in obj` first. A computed key is not matched. | A fixed key is a field the type does not declare, read past the compiler. |
|
|
128
132
|
| `form-needs-no-validate` | A `form` or `AppForm` whose `onSubmit` goes through `handleSubmit` without `noValidate` | The browser's own validation would run beside the form library's. Set `noValidate`; any value passes. |
|
|
133
|
+
| `no-legacy-component-props` | An assignment `X.defaultProps = ...` or `X.propTypes = ...`. A class's `static defaultProps` field is not matched. | React 19 removed both for function components and ignores them. Set defaults in the parameter destructure, and type the props in TypeScript. |
|
|
134
|
+
| `no-legacy-react-test-api` | An import from `react-test-renderer`, or `act` imported from `react-dom/test-utils` | React 19 deprecated the test renderer and removed `act` from `react-dom/test-utils`. Use `@testing-library/react` or `@testing-library/react-native`, and import `act` from `react`. |
|
|
135
|
+
| `mobile-grit-navigation-shims` | `navigateDeprecated`, `navigationInChildEnabled`, or `independent` on `NavigationContainer` | React Navigation 7 removed `independent` and kept the other two only as migration shims for one major. Use `navigate` or `popTo`, `navigate(parent, { screen })`, and `NavigationIndependentTree`. |
|
|
129
136
|
| `mobile-grit-alert-alert` | `Alert.alert` | A confirm or alert is the mobile-ui `Dialog`, and a short message is a `toast`. |
|
|
130
137
|
| `mobile-grit-touchable` | `TouchableOpacity`, `TouchableHighlight`, `TouchableWithoutFeedback` | Retired. Use a mobile-ui component, or `Pressable` with `accessibilityRole` and a label. |
|
|
131
138
|
| `mobile-grit-index-key` | an inline `keyExtractor={(item, index) => ...}` whose body uses `index` | A key from the index breaks row state on a reorder or an insert. Return the record's stable id. |
|
package/biome.jsonc
CHANGED
|
@@ -50,6 +50,15 @@
|
|
|
50
50
|
// no-store-checks-off: serializableCheck or immutableCheck set to false in a store.
|
|
51
51
|
// no-whole-slice-selector: an inline useSelector function, or a destructured useSelector result.
|
|
52
52
|
// form-needs-no-validate: a form or AppForm submitted through handleSubmit without noValidate.
|
|
53
|
+
// no-legacy-component-props: defaultProps or propTypes assigned to a component; React 19 ignores both on a function component.
|
|
54
|
+
// no-legacy-react-test-api: react-test-renderer, or act from react-dom/test-utils; React 19 retired both.
|
|
55
|
+
// mobile-grit-navigation-shims: React Navigation 7's migration shims and the removed independent prop.
|
|
56
|
+
// mobile-grit-accessibility-focus: AccessibilityInfo.setAccessibilityFocus; sendAccessibilityEvent(ref, 'focus') replaces it.
|
|
57
|
+
// mobile-grit-blur-on-submit: TextInput's removed blurOnSubmit prop; submitBehavior replaces it.
|
|
58
|
+
// mobile-grit-deep-imports: an import from react-native/Libraries/; the root react-native import replaces it.
|
|
59
|
+
// mobile-grit-experimental-background: the experimental_ prefixed background style keys; the unprefixed keys replace them.
|
|
60
|
+
// mobile-grit-large-title: the headerLargeTitle screen option React Navigation 8 removes; headerLargeTitleEnabled replaces it.
|
|
61
|
+
// mobile-grit-navigator-id: a navigator's id prop and getParent with an id, both removed in React Navigation 8.
|
|
53
62
|
"plugins": [
|
|
54
63
|
"./node_modules/@webority/biome-config/plugins/no-absolute-fill-object.grit",
|
|
55
64
|
"./node_modules/@webority/biome-config/plugins/mobile-grit-alert-alert.grit",
|
|
@@ -72,7 +81,18 @@
|
|
|
72
81
|
"./node_modules/@webority/biome-config/plugins/no-store-checks-off.grit",
|
|
73
82
|
"./node_modules/@webority/biome-config/plugins/no-whole-slice-selector.grit",
|
|
74
83
|
"./node_modules/@webority/biome-config/plugins/no-fixed-key-reflect-get.grit",
|
|
75
|
-
"./node_modules/@webority/biome-config/plugins/form-needs-no-validate.grit"
|
|
84
|
+
"./node_modules/@webority/biome-config/plugins/form-needs-no-validate.grit",
|
|
85
|
+
"./node_modules/@webority/biome-config/plugins/web-grit-ime-enter-submit.grit",
|
|
86
|
+
"./node_modules/@webority/biome-config/plugins/web-grit-hand-built-overlay.grit",
|
|
87
|
+
"./node_modules/@webority/biome-config/plugins/no-legacy-component-props.grit",
|
|
88
|
+
"./node_modules/@webority/biome-config/plugins/no-legacy-react-test-api.grit",
|
|
89
|
+
"./node_modules/@webority/biome-config/plugins/mobile-grit-navigation-shims.grit",
|
|
90
|
+
"./node_modules/@webority/biome-config/plugins/mobile-grit-accessibility-focus.grit",
|
|
91
|
+
"./node_modules/@webority/biome-config/plugins/mobile-grit-blur-on-submit.grit",
|
|
92
|
+
"./node_modules/@webority/biome-config/plugins/mobile-grit-deep-imports.grit",
|
|
93
|
+
"./node_modules/@webority/biome-config/plugins/mobile-grit-experimental-background.grit",
|
|
94
|
+
"./node_modules/@webority/biome-config/plugins/mobile-grit-large-title.grit",
|
|
95
|
+
"./node_modules/@webority/biome-config/plugins/mobile-grit-navigator-id.grit"
|
|
76
96
|
],
|
|
77
97
|
"linter": {
|
|
78
98
|
"enabled": true,
|
|
@@ -186,7 +206,11 @@
|
|
|
186
206
|
"noNonNullAssertedOptionalChain": "error",
|
|
187
207
|
// Apps log through the web-core Logger, and a library through its one diagnostics
|
|
188
208
|
// module (devWarn and devError). Any other console call fails lint.
|
|
189
|
-
"noConsole": "error"
|
|
209
|
+
"noConsole": "error",
|
|
210
|
+
// An import its own library marks @deprecated; the message names the replacement.
|
|
211
|
+
"noDeprecatedImports": "error",
|
|
212
|
+
// React 19 removed string refs.
|
|
213
|
+
"noReactStringRefs": "error"
|
|
190
214
|
}
|
|
191
215
|
}
|
|
192
216
|
},
|
|
@@ -266,6 +290,14 @@
|
|
|
266
290
|
"linter": {
|
|
267
291
|
"enabled": false
|
|
268
292
|
}
|
|
293
|
+
},
|
|
294
|
+
// A server-rendered site's own page styles are its code, unlike a portal's, whose styling comes from the shared theme.
|
|
295
|
+
// Vendored and minified files stay out through the product's files.includes; webority-repo-checks never passes them.
|
|
296
|
+
{
|
|
297
|
+
"includes": ["**/wwwroot/**/*.css"],
|
|
298
|
+
"linter": {
|
|
299
|
+
"enabled": true
|
|
300
|
+
}
|
|
269
301
|
}
|
|
270
302
|
]
|
|
271
303
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/biome-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.163.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": {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
language js
|
|
2
|
+
|
|
3
|
+
// React Native 0.85 deprecated setAccessibilityFocus; sendAccessibilityEvent with 'focus' replaces it.
|
|
4
|
+
`AccessibilityInfo.setAccessibilityFocus` as $use where {
|
|
5
|
+
register_diagnostic(span=$use, message="AccessibilityInfo.setAccessibilityFocus is deprecated in React Native 0.85. Use AccessibilityInfo.sendAccessibilityEvent(ref, 'focus') to move screen reader focus.", severity="error")
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
language js
|
|
2
|
+
|
|
3
|
+
// react-native.md: TextInput's blurOnSubmit prop was removed in React Native 0.89; submitBehavior replaces it.
|
|
4
|
+
or {
|
|
5
|
+
`blurOnSubmit={$_}` as $use where {
|
|
6
|
+
register_diagnostic(span=$use, message="blurOnSubmit was removed in React Native 0.89. Use submitBehavior='submit' (or 'blurAndSubmit' or 'newline').", severity="error")
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
language js
|
|
2
|
+
|
|
3
|
+
// React Native 0.80 deprecated deep imports from its internal Libraries folder; they break without notice on an upgrade.
|
|
4
|
+
or {
|
|
5
|
+
`import { $names } from $source` as $use where {
|
|
6
|
+
$source <: r".*react-native/Libraries/.*",
|
|
7
|
+
register_diagnostic(span=$use, message="react-native/Libraries/ deep imports are retired. Import the same name from react-native.", severity="error")
|
|
8
|
+
},
|
|
9
|
+
`import $name from $source` as $use where {
|
|
10
|
+
$source <: r".*react-native/Libraries/.*",
|
|
11
|
+
register_diagnostic(span=$use, message="react-native/Libraries/ deep imports are retired. Import the same name from react-native.", severity="error")
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
language js
|
|
2
|
+
|
|
3
|
+
// React Native 0.88 deprecated the experimental_ prefixed background style keys; the prefixed names still work as aliases.
|
|
4
|
+
or {
|
|
5
|
+
`experimental_backgroundSize` as $use where {
|
|
6
|
+
register_diagnostic(span=$use, message="experimental_backgroundSize is deprecated in React Native 0.88. Use backgroundSize, the unprefixed style key.", severity="error")
|
|
7
|
+
},
|
|
8
|
+
`experimental_backgroundPosition` as $use where {
|
|
9
|
+
register_diagnostic(span=$use, message="experimental_backgroundPosition is deprecated in React Native 0.88. Use backgroundPosition, the unprefixed style key.", severity="error")
|
|
10
|
+
},
|
|
11
|
+
`experimental_backgroundRepeat` as $use where {
|
|
12
|
+
register_diagnostic(span=$use, message="experimental_backgroundRepeat is deprecated in React Native 0.88. Use backgroundRepeat, the unprefixed style key.", severity="error")
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
language js
|
|
2
|
+
|
|
3
|
+
// React Navigation 8 removes the headerLargeTitle screen option; the 7.x replacement is headerLargeTitleEnabled.
|
|
4
|
+
or {
|
|
5
|
+
`headerLargeTitle` as $use where {
|
|
6
|
+
register_diagnostic(span=$use, message="headerLargeTitle was removed in React Navigation 8. Use headerLargeTitleEnabled: true on the screen options.", severity="error")
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
language js
|
|
2
|
+
|
|
3
|
+
// React Navigation 7 kept these migration shims for one major; the next major removes them.
|
|
4
|
+
or {
|
|
5
|
+
`navigateDeprecated` as $use where {
|
|
6
|
+
register_diagnostic(span=$use, message="navigateDeprecated is a React Navigation 7 migration shim removed in the next major. Use navigate, or popTo to go back to an existing screen.", severity="error")
|
|
7
|
+
},
|
|
8
|
+
`navigationInChildEnabled` as $use where {
|
|
9
|
+
register_diagnostic(span=$use, message="navigationInChildEnabled is a React Navigation 7 migration shim removed in the next major. Navigate to the nested screen with navigate(parent, { screen }).", severity="error")
|
|
10
|
+
},
|
|
11
|
+
`<NavigationContainer independent={$_} />` as $use where {
|
|
12
|
+
register_diagnostic(span=$use, message="The independent prop was removed in React Navigation 7. Wrap the container in NavigationIndependentTree.", severity="error")
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
language js
|
|
2
|
+
|
|
3
|
+
// React Navigation 8 removes the navigator id prop and getParent(id); a screen reaches its parent by the parent screen's name.
|
|
4
|
+
or {
|
|
5
|
+
jsx_attribute(name=$name) as $use where {
|
|
6
|
+
$name <: `id`,
|
|
7
|
+
$use <: within jsx_opening_element(name=$tag),
|
|
8
|
+
$tag <: r".*\.Navigator",
|
|
9
|
+
register_diagnostic(span=$use, message="id on a navigator was removed in React Navigation 8. Remove it and reach the parent by its screen name.", severity="error")
|
|
10
|
+
},
|
|
11
|
+
jsx_attribute(name=$name) as $use where {
|
|
12
|
+
$name <: `id`,
|
|
13
|
+
$use <: within jsx_self_closing_element(name=$tag),
|
|
14
|
+
$tag <: r".*\.Navigator",
|
|
15
|
+
register_diagnostic(span=$use, message="id on a navigator was removed in React Navigation 8. Remove it and reach the parent by its screen name.", severity="error")
|
|
16
|
+
},
|
|
17
|
+
`$nav.getParent($id)` where {
|
|
18
|
+
$id <: JsStringLiteralExpression(),
|
|
19
|
+
register_diagnostic(span=$id, message="getParent with a navigator id was removed in React Navigation 8. Reach the parent by its screen name.", severity="error")
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
language js
|
|
2
|
+
|
|
3
|
+
// React 19 removed defaultProps and propTypes for function components; a class's static field is not an assignment and is not matched.
|
|
4
|
+
or {
|
|
5
|
+
`$x.defaultProps = $_` as $use where {
|
|
6
|
+
register_diagnostic(span=$use, message="defaultProps on a function component was removed in React 19 and is ignored. Set defaults in the parameter destructure.", severity="error")
|
|
7
|
+
},
|
|
8
|
+
`$x.propTypes = $_` as $use where {
|
|
9
|
+
register_diagnostic(span=$use, message="propTypes was removed in React 19 and is ignored. Type the props in TypeScript.", severity="error")
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
language js
|
|
2
|
+
|
|
3
|
+
// React 19 removed react-test-renderer and act from react-dom/test-utils.
|
|
4
|
+
or {
|
|
5
|
+
`import $_ from "react-test-renderer"` as $use where {
|
|
6
|
+
register_diagnostic(span=$use, message="react-test-renderer is deprecated in React 19. Use @testing-library/react or @testing-library/react-native.", severity="error")
|
|
7
|
+
},
|
|
8
|
+
`import { $_ } from "react-test-renderer"` as $use where {
|
|
9
|
+
register_diagnostic(span=$use, message="react-test-renderer is deprecated in React 19. Use @testing-library/react or @testing-library/react-native.", severity="error")
|
|
10
|
+
},
|
|
11
|
+
`import { act } from "react-dom/test-utils"` as $use where {
|
|
12
|
+
register_diagnostic(span=$use, message="act from react-dom/test-utils was removed in React 19. Import act from 'react'.", severity="error")
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
language js
|
|
2
|
+
|
|
3
|
+
// The library's own sources build the dialogs and overlays the rule points to, so they are exempt.
|
|
4
|
+
// Only a plain HTML element (lower-case name) is hand-built; a component passing role="dialog" is the library's own.
|
|
5
|
+
or {
|
|
6
|
+
JsxOpeningElement(name=$name) as $el,
|
|
7
|
+
JsxSelfClosingElement(name=$name) as $el
|
|
8
|
+
} where {
|
|
9
|
+
$name <: r"[a-z][a-z0-9-]*",
|
|
10
|
+
$el <: r"(?s).*(?:\brole=\"(?:dialog|alertdialog)\"|\baria-modal\b).*",
|
|
11
|
+
$filename <: not r"^(?:.*/)?(?:__tests__/.*|[^/]*\.test\.[jt]sx?)$",
|
|
12
|
+
$filename <: not r"^(?:.*/)?packages/(?:ui-react|elements)/src/.*",
|
|
13
|
+
register_diagnostic(span=$el, message="A hand-built dialog or overlay misses the library's focus trap, Escape and stacking. Use AppModal, AppDrawer, AppConfirmDialog, AppPopover or AppDropdown from @webority/ui-react.", severity="error")
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
language js
|
|
2
|
+
|
|
3
|
+
// An Enter that confirms an input method composition (Hindi, Chinese, Japanese) would submit early; Safari reports it with keyCode 229.
|
|
4
|
+
// The guard is event.isComposing or the isImeSafeEnter helper; a function that checks neither submits on the composition Enter.
|
|
5
|
+
or {
|
|
6
|
+
`$e.key === "Enter"` as $cmp,
|
|
7
|
+
`"Enter" === $e.key` as $cmp,
|
|
8
|
+
`$e.key == "Enter"` as $cmp,
|
|
9
|
+
`"Enter" == $e.key` as $cmp
|
|
10
|
+
} where {
|
|
11
|
+
$filename <: not r"^(?:.*/)?(?:__tests__/.*|[^/]*\.test\.[jt]sx?)$",
|
|
12
|
+
$cmp <: within or {
|
|
13
|
+
JsArrowFunctionExpression() as $fn where { $fn <: not r"(?s).*\b(?:isComposing|isImeSafeEnter)\b.*" },
|
|
14
|
+
JsFunctionExpression() as $fn where { $fn <: not r"(?s).*\b(?:isComposing|isImeSafeEnter)\b.*" },
|
|
15
|
+
JsFunctionDeclaration() as $fn where { $fn <: not r"(?s).*\b(?:isComposing|isImeSafeEnter)\b.*" },
|
|
16
|
+
JsMethodClassMember() as $fn where { $fn <: not r"(?s).*\b(?:isComposing|isImeSafeEnter)\b.*" },
|
|
17
|
+
JsMethodObjectMember() as $fn where { $fn <: not r"(?s).*\b(?:isComposing|isImeSafeEnter)\b.*" }
|
|
18
|
+
},
|
|
19
|
+
register_diagnostic(span=$cmp, message="This Enter check also fires when someone confirms a word typed through an input method, and submits early. Use isImeSafeEnter(event) from @webority/ui-react or @webority/ui-elements/helpers, or check !event.isComposing && event.keyCode !== 229.", severity="error")
|
|
20
|
+
}
|