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>
57 lines
1.4 KiB
JavaScript
57 lines
1.4 KiB
JavaScript
/**
|
||
* @fileoverview Prevent usage of findDOMNode
|
||
* @author Yannick Croissant
|
||
*/
|
||
|
||
'use strict';
|
||
|
||
const docsUrl = require('../util/docsUrl');
|
||
const report = require('../util/report');
|
||
|
||
// ------------------------------------------------------------------------------
|
||
// Rule Definition
|
||
// ------------------------------------------------------------------------------
|
||
|
||
const messages = {
|
||
noFindDOMNode: 'Do not use findDOMNode. It doesn’t work with function components and is deprecated in StrictMode. See https://reactjs.org/docs/react-dom.html#finddomnode',
|
||
};
|
||
|
||
/** @type {import('eslint').Rule.RuleModule} */
|
||
module.exports = {
|
||
meta: {
|
||
docs: {
|
||
description: 'Disallow usage of findDOMNode',
|
||
category: 'Best Practices',
|
||
recommended: true,
|
||
url: docsUrl('no-find-dom-node'),
|
||
},
|
||
|
||
messages,
|
||
|
||
schema: [],
|
||
},
|
||
|
||
create(context) {
|
||
return {
|
||
CallExpression(node) {
|
||
const callee = node.callee;
|
||
|
||
const isFindDOMNode = ('name' in callee && callee.name === 'findDOMNode') || (
|
||
'property' in callee
|
||
&& callee.property
|
||
&& 'name' in callee.property
|
||
&& callee.property.name === 'findDOMNode'
|
||
);
|
||
|
||
if (!isFindDOMNode) {
|
||
return;
|
||
}
|
||
|
||
report(context, messages.noFindDOMNode, 'noFindDOMNode', {
|
||
node: callee,
|
||
});
|
||
},
|
||
};
|
||
},
|
||
};
|