Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
66 lines
1.4 KiB
Markdown
66 lines
1.4 KiB
Markdown
# Disallow string interpolation inside snapshots (`no-interpolation-in-snapshots`)
|
|
|
|
💼 This rule is enabled in the ✅ `recommended`
|
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
|
|
<!-- end auto-generated rule header -->
|
|
|
|
Prevents the use of string interpolations in snapshots.
|
|
|
|
## Rule details
|
|
|
|
Interpolation prevents snapshots from being updated. Instead, properties should
|
|
be overloaded with a matcher by using
|
|
[property matchers](https://jestjs.io/docs/en/snapshot-testing#property-matchers).
|
|
|
|
Examples of **incorrect** code for this rule:
|
|
|
|
```js
|
|
expect(something).toMatchInlineSnapshot(
|
|
`Object {
|
|
property: ${interpolated}
|
|
}`,
|
|
);
|
|
|
|
expect(something).toMatchInlineSnapshot(
|
|
{ other: expect.any(Number) },
|
|
`Object {
|
|
other: Any<Number>,
|
|
property: ${interpolated}
|
|
}`,
|
|
);
|
|
|
|
expect(errorThrowingFunction).toThrowErrorMatchingInlineSnapshot(
|
|
`${interpolated}`,
|
|
);
|
|
```
|
|
|
|
Examples of **correct** code for this rule:
|
|
|
|
```js
|
|
expect(something).toMatchInlineSnapshot();
|
|
|
|
expect(something).toMatchInlineSnapshot(
|
|
`Object {
|
|
property: 1
|
|
}`,
|
|
);
|
|
|
|
expect(something).toMatchInlineSnapshot(
|
|
{ property: expect.any(Date) },
|
|
`Object {
|
|
property: Any<Date>
|
|
}`,
|
|
);
|
|
|
|
expect(errorThrowingFunction).toThrowErrorMatchingInlineSnapshot();
|
|
|
|
expect(errorThrowingFunction).toThrowErrorMatchingInlineSnapshot(
|
|
`Error Message`,
|
|
);
|
|
```
|
|
|
|
## When Not To Use It
|
|
|
|
Don't use this rule on non-jest test files.
|