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>
67 lines
1.5 KiB
JavaScript
67 lines
1.5 KiB
JavaScript
'use strict';
|
|
|
|
const eachDeclarationBlock = require('../../utils/eachDeclarationBlock');
|
|
const isCustomProperty = require('../../utils/isCustomProperty');
|
|
const isStandardSyntaxProperty = require('../../utils/isStandardSyntaxProperty');
|
|
const report = require('../../utils/report');
|
|
const ruleMessages = require('../../utils/ruleMessages');
|
|
const validateOptions = require('../../utils/validateOptions');
|
|
|
|
const ruleName = 'declaration-block-no-duplicate-custom-properties';
|
|
|
|
const messages = ruleMessages(ruleName, {
|
|
rejected: (property) => `Unexpected duplicate "${property}"`,
|
|
});
|
|
|
|
const meta = {
|
|
url: 'https://stylelint.io/user-guide/rules/declaration-block-no-duplicate-custom-properties',
|
|
};
|
|
|
|
/** @type {import('stylelint').Rule} */
|
|
const rule = (primary) => {
|
|
return (root, result) => {
|
|
const validOptions = validateOptions(result, ruleName, { actual: primary });
|
|
|
|
if (!validOptions) {
|
|
return;
|
|
}
|
|
|
|
eachDeclarationBlock(root, (eachDecl) => {
|
|
const decls = new Set();
|
|
|
|
eachDecl((decl) => {
|
|
const prop = decl.prop;
|
|
|
|
if (!isStandardSyntaxProperty(prop)) {
|
|
return;
|
|
}
|
|
|
|
if (!isCustomProperty(prop)) {
|
|
return;
|
|
}
|
|
|
|
const isDuplicate = decls.has(prop);
|
|
|
|
if (isDuplicate) {
|
|
report({
|
|
message: messages.rejected(prop),
|
|
node: decl,
|
|
result,
|
|
ruleName,
|
|
word: prop,
|
|
});
|
|
|
|
return;
|
|
}
|
|
|
|
decls.add(prop);
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
rule.ruleName = ruleName;
|
|
rule.messages = messages;
|
|
rule.meta = meta;
|
|
module.exports = rule;
|