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>
71 lines
2.6 KiB
JavaScript
71 lines
2.6 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const ast_1 = require("../utils/ast");
|
|
const misc_1 = require("../utils/misc");
|
|
exports.default = {
|
|
create(context) {
|
|
const { maxTopLevelDescribes } = {
|
|
maxTopLevelDescribes: Infinity,
|
|
...(context.options?.[0] ?? {}),
|
|
};
|
|
let topLevelDescribeCount = 0;
|
|
let describeCount = 0;
|
|
return {
|
|
CallExpression(node) {
|
|
if ((0, ast_1.isDescribeCall)(node)) {
|
|
describeCount++;
|
|
if (describeCount === 1) {
|
|
topLevelDescribeCount++;
|
|
if (topLevelDescribeCount > maxTopLevelDescribes) {
|
|
context.report({
|
|
data: (0, misc_1.getAmountData)(maxTopLevelDescribes),
|
|
messageId: 'tooManyDescribes',
|
|
node: node.callee,
|
|
});
|
|
}
|
|
}
|
|
}
|
|
else if (!describeCount) {
|
|
if ((0, ast_1.isTest)(node)) {
|
|
context.report({ messageId: 'unexpectedTest', node: node.callee });
|
|
}
|
|
else if ((0, ast_1.isTestHook)(node)) {
|
|
context.report({ messageId: 'unexpectedHook', node: node.callee });
|
|
}
|
|
}
|
|
},
|
|
'CallExpression:exit'(node) {
|
|
if ((0, ast_1.isDescribeCall)(node)) {
|
|
describeCount--;
|
|
}
|
|
},
|
|
};
|
|
},
|
|
meta: {
|
|
docs: {
|
|
category: 'Best Practices',
|
|
description: 'Require test cases and hooks to be inside a `test.describe` block',
|
|
recommended: false,
|
|
url: 'https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/require-top-level-describe.md',
|
|
},
|
|
messages: {
|
|
tooManyDescribes: 'There should not be more than {{max}} describe{{s}} at the top level',
|
|
unexpectedHook: 'All hooks must be wrapped in a describe block.',
|
|
unexpectedTest: 'All test cases must be wrapped in a describe block.',
|
|
},
|
|
schema: [
|
|
{
|
|
additionalProperties: false,
|
|
properties: {
|
|
maxTopLevelDescribes: {
|
|
minimum: 1,
|
|
type: 'number',
|
|
},
|
|
},
|
|
type: 'object',
|
|
},
|
|
],
|
|
type: 'suggestion',
|
|
},
|
|
};
|