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>
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
const preprocessWarnings = require('./preprocessWarnings');
|
|
|
|
/**
|
|
* @see https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
|
|
*
|
|
* @type {import('stylelint').Formatter}
|
|
*/
|
|
module.exports = function githubFormatter(results, returnValue) {
|
|
const title = 'Stylelint problem';
|
|
const metadata = returnValue.ruleMetadata;
|
|
|
|
return results
|
|
.flatMap((result) => {
|
|
const { source, warnings } = preprocessWarnings(result);
|
|
|
|
return warnings.map(({ line, column, endLine, endColumn, text, severity, rule }) => {
|
|
const msg = buildMessage(text, metadata[rule]);
|
|
|
|
return endLine === undefined
|
|
? `::${severity} file=${source},line=${line},col=${column},title=${title}::${msg}`
|
|
: `::${severity} file=${source},line=${line},col=${column},endLine=${endLine},endColumn=${endColumn},title=${title}::${msg}`;
|
|
});
|
|
})
|
|
.join('\n');
|
|
};
|
|
|
|
/**
|
|
* @param {string} msg
|
|
* @param {Partial<import('stylelint').RuleMeta> | undefined} metadata
|
|
* @returns {string}
|
|
*/
|
|
function buildMessage(msg, metadata) {
|
|
if (!metadata) return msg;
|
|
|
|
const url = metadata.url ? ` - ${metadata.url}` : '';
|
|
const fixable = metadata.fixable ? ' [maybe fixable]' : '';
|
|
|
|
return `${msg}${fixable}${url}`;
|
|
}
|