Files
formipay/node_modules/eslint-plugin-react/lib/rules/jsx-no-comment-textnodes.js
dwindown e8fbfb14c1 fix: prevent asset conflicts between React and Grid.js versions
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>
2026-04-18 17:02:14 +07:00

72 lines
1.8 KiB
JavaScript

/**
* @fileoverview Comments inside children section of tag should be placed inside braces.
* @author Ben Vinegar
*/
'use strict';
const docsUrl = require('../util/docsUrl');
const getText = require('../util/eslint').getText;
const report = require('../util/report');
// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
const messages = {
putCommentInBraces: 'Comments inside children section of tag should be placed inside braces',
};
/**
* @param {Context} context
* @param {ASTNode} node
* @returns {void}
*/
function checkText(context, node) {
// since babel-eslint has the wrong node.raw, we'll get the source text
const rawValue = getText(context, node);
if (/^\s*\/(\/|\*)/m.test(rawValue)) {
// inside component, e.g. <div>literal</div>
if (
node.parent.type !== 'JSXAttribute'
&& node.parent.type !== 'JSXExpressionContainer'
&& node.parent.type.indexOf('JSX') !== -1
) {
report(context, messages.putCommentInBraces, 'putCommentInBraces', {
node,
});
}
}
}
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
description: 'Disallow comments from being inserted as text nodes',
category: 'Possible Errors',
recommended: true,
url: docsUrl('jsx-no-comment-textnodes'),
},
messages,
schema: [],
},
create(context) {
// --------------------------------------------------------------------------
// Public
// --------------------------------------------------------------------------
return {
Literal(node) {
checkText(context, node);
},
JSXText(node) {
checkText(context, node);
},
};
},
};