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>
64 lines
2.2 KiB
JavaScript
64 lines
2.2 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const ast_1 = require("../utils/ast");
|
|
exports.default = {
|
|
create(context) {
|
|
const { options } = context;
|
|
const max = options[0]?.max ?? 5;
|
|
const describeCallbackStack = [];
|
|
function pushDescribeCallback(node) {
|
|
if (node.parent.type !== 'CallExpression' ||
|
|
!(0, ast_1.isDescribeCall)(node.parent)) {
|
|
return;
|
|
}
|
|
describeCallbackStack.push(0);
|
|
if (describeCallbackStack.length > max) {
|
|
context.report({
|
|
data: {
|
|
depth: describeCallbackStack.length.toString(),
|
|
max: max.toString(),
|
|
},
|
|
messageId: 'exceededMaxDepth',
|
|
node: node.parent.callee,
|
|
});
|
|
}
|
|
}
|
|
function popDescribeCallback(node) {
|
|
const { parent } = node;
|
|
if (parent.type === 'CallExpression' && (0, ast_1.isDescribeCall)(parent)) {
|
|
describeCallbackStack.pop();
|
|
}
|
|
}
|
|
return {
|
|
ArrowFunctionExpression: pushDescribeCallback,
|
|
'ArrowFunctionExpression:exit': popDescribeCallback,
|
|
FunctionExpression: pushDescribeCallback,
|
|
'FunctionExpression:exit': popDescribeCallback,
|
|
};
|
|
},
|
|
meta: {
|
|
docs: {
|
|
category: 'Best Practices',
|
|
description: 'Enforces a maximum depth to nested describe calls',
|
|
recommended: true,
|
|
url: 'https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/max-nested-describe.md',
|
|
},
|
|
messages: {
|
|
exceededMaxDepth: 'Maximum describe call depth exceeded ({{ depth }}). Maximum allowed is {{ max }}.',
|
|
},
|
|
schema: [
|
|
{
|
|
additionalProperties: false,
|
|
properties: {
|
|
max: {
|
|
minimum: 0,
|
|
type: 'integer',
|
|
},
|
|
},
|
|
type: 'object',
|
|
},
|
|
],
|
|
type: 'suggestion',
|
|
},
|
|
};
|