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>
58 lines
1.9 KiB
JavaScript
58 lines
1.9 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const ast_1 = require("../utils/ast");
|
|
const messageId = 'noNetworkidle';
|
|
const methods = new Set([
|
|
'goBack',
|
|
'goForward',
|
|
'goto',
|
|
'reload',
|
|
'setContent',
|
|
'waitForLoadState',
|
|
'waitForURL',
|
|
]);
|
|
exports.default = {
|
|
create(context) {
|
|
return {
|
|
CallExpression(node) {
|
|
if (node.callee.type !== 'MemberExpression')
|
|
return;
|
|
const methodName = (0, ast_1.getStringValue)(node.callee.property);
|
|
if (!methods.has(methodName))
|
|
return;
|
|
// waitForLoadState has a single string argument
|
|
if (methodName === 'waitForLoadState') {
|
|
const arg = node.arguments[0];
|
|
if (arg && (0, ast_1.isStringLiteral)(arg, 'networkidle')) {
|
|
context.report({ messageId, node: arg });
|
|
}
|
|
return;
|
|
}
|
|
// All other methods have an options object
|
|
if (node.arguments.length >= 2) {
|
|
const [_, arg] = node.arguments;
|
|
if (arg.type !== 'ObjectExpression')
|
|
return;
|
|
const property = arg.properties
|
|
.filter((p) => p.type === 'Property')
|
|
.find((p) => (0, ast_1.isStringLiteral)(p.value, 'networkidle'));
|
|
if (property) {
|
|
context.report({ messageId, node: property.value });
|
|
}
|
|
}
|
|
},
|
|
};
|
|
},
|
|
meta: {
|
|
docs: {
|
|
category: 'Possible Errors',
|
|
description: 'Prevent usage of the networkidle option',
|
|
recommended: true,
|
|
},
|
|
messages: {
|
|
noNetworkidle: 'Unexpected use of networkidle.',
|
|
},
|
|
type: 'problem',
|
|
},
|
|
};
|