@cratis/eslint-plugin-components 4.13.1 → 4.14.1
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 +19 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,15 +14,10 @@ Cratis base config, [`@cratis/eslint-config`](https://www.npmjs.com/package/@cra
|
|
|
14
14
|
|
|
15
15
|
Both import rules cover static `import` and re-`export … from` forms. The root-barrel rule also reports TypeScript `import = require(...)`, dynamic `import(...)`, and CommonJS `require(...)` of the package root; ambiguous forms are never autofixed.
|
|
16
16
|
|
|
17
|
-
> **Publication status:** The install examples target the owner-authorized 4.0.0 npm release. When
|
|
18
|
-
> reading this README from repository source before that release, verify availability with
|
|
19
|
-
> `npm view @cratis/eslint-plugin-components@4.0.0 version`; source contributors use the workspace
|
|
20
|
-
> commands in this checkout instead.
|
|
21
|
-
|
|
22
17
|
## Install
|
|
23
18
|
|
|
24
|
-
|
|
25
|
-
`
|
|
19
|
+
The plugin is released at the same version as `@cratis/components`. Install the Components 4
|
|
20
|
+
tooling train bounded to `>=4 <5` so a future major cannot arrive unannounced. Never use `latest`:
|
|
26
21
|
|
|
27
22
|
```sh
|
|
28
23
|
TOOLING_RANGE='^4.0.0' # Shell-safe equivalent of >=4 <5.
|
|
@@ -100,7 +95,8 @@ Components 4 removes every component-family namespace from the package root. The
|
|
|
100
95
|
|
|
101
96
|
- `CratisComponentsProvider`, `useCratisComponentsConfig`, `cratisDefaults`, and `mergeCratisComponentsConfig`;
|
|
102
97
|
- `CratisComponentsConfig`, `CratisComponentsProviderProps`, and `CratisComponentsMessages`;
|
|
103
|
-
- `CratisPaginatorMessages`, `CratisDatePickerMessages`, `CratisDropdownMessages`, `CratisDialogMessages`, `CratisStepperMessages`, `CratisNotificationsMessages`, `CratisDataTableMessages`, and `CratisColumnFilterMessages
|
|
98
|
+
- `CratisPaginatorMessages`, `CratisDatePickerMessages`, `CratisDropdownMessages`, `CratisDialogMessages`, `CratisStepperMessages`, `CratisNotificationsMessages`, `CratisDataTableMessages`, and `CratisColumnFilterMessages`;
|
|
99
|
+
- `CratisComponentsIcons`, `CratisIconResolver`, and `useCratisIcon`.
|
|
104
100
|
|
|
105
101
|
```ts
|
|
106
102
|
// ✅ approved setup symbols stay at the root
|
|
@@ -142,8 +138,10 @@ The rule never guesses. Each of these is flagged with guidance but **not** autof
|
|
|
142
138
|
- The Components 3.6 `Compatibility` namespace and direct pass-through exports — reported
|
|
143
139
|
as known removals with typed-parts guidance and never autofixed because Components 4 has
|
|
144
140
|
no compatibility subpath.
|
|
145
|
-
- Any `export … from '@cratis/components'` re-export
|
|
146
|
-
|
|
141
|
+
- Any `export … from '@cratis/components'` re-export of a namespace, removed compatibility
|
|
142
|
+
export, or unknown symbol, and any wildcard re-export — flagged with the same subpath
|
|
143
|
+
guidance, but re-exports are never autofixed. Re-exporting an approved setup symbol is
|
|
144
|
+
allowed.
|
|
147
145
|
|
|
148
146
|
A companion, standalone codemod applies the equivalent rewrite across a whole project in one
|
|
149
147
|
pass, and additionally autofixes a named `export { Canvas } from '@cratis/components'`
|
|
@@ -153,10 +151,12 @@ form with guidance but never autofixes any of them; see
|
|
|
153
151
|
|
|
154
152
|
### `onbeforeexecute-must-return`
|
|
155
153
|
|
|
156
|
-
`onBeforeExecute`
|
|
157
|
-
**transformer**: it receives the current command values and must **return** them (mutated or
|
|
158
|
-
not).
|
|
159
|
-
guard (`applyBeforeExecute`) falls back to the current object and logs a
|
|
154
|
+
`onBeforeExecute` on `CommandDialog`, `StepperCommandDialog`, `CommandStepper`, and Arc's
|
|
155
|
+
`CommandForm` is a **transformer**: it receives the current command values and must **return** them (mutated or
|
|
156
|
+
not). In the Components wrappers, a callback that returns nothing does not run the command with
|
|
157
|
+
`undefined` — a runtime guard (`applyBeforeExecute`) falls back to the current object and logs a
|
|
158
|
+
`console.warn`. Arc's standalone `CommandForm` (22.16.0) uses the returned value directly, with no
|
|
159
|
+
such fallback.
|
|
160
160
|
In-place mutations may therefore remain, but a replacement object is discarded and the call
|
|
161
161
|
still violates the transformer contract. TypeScript catches this at fully typed call sites;
|
|
162
162
|
this rule is the static backstop for JavaScript and loosely typed consumers, so behavior never
|
|
@@ -178,6 +178,11 @@ and variable (`const onBeforeExecute = …`) forms. It is a lint backstop, not a
|
|
|
178
178
|
control-flow analysis: a callback that returns a value on some branches but can still fall
|
|
179
179
|
through is not flagged.
|
|
180
180
|
|
|
181
|
+
The rule matches the `onBeforeExecute` name, not the component. Arc's `CommandScope` also has an
|
|
182
|
+
`onBeforeExecute` prop, but it is typed `(command) => void` and is not a transformer; the rule
|
|
183
|
+
still reports a callback there that returns nothing. Return the command (harmless) or disable the
|
|
184
|
+
rule for that line.
|
|
185
|
+
|
|
181
186
|
### `no-hooks-in-view-model`
|
|
182
187
|
|
|
183
188
|
A view model is plain TypeScript — it must never call React hooks. `react-hooks/rules-of-hooks`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cratis/eslint-plugin-components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.14.1",
|
|
4
4
|
"description": "Cratis Components ESLint rules: import from subpaths not the root barrel, use the Cratis dialog wrappers instead of primereact/dialog, require onBeforeExecute callbacks to return their values, keep React hooks out of view models, protect the repository-owned React-free kernel, and identify CommandForm fields by a tamper-resistant marker rather than a raw displayName string. Compose on top of @cratis/eslint-config.",
|
|
5
5
|
"author": "Cratis",
|
|
6
6
|
"license": "MIT",
|