Files
formipay/node_modules/stylelint/lib/isPathIgnored.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

49 lines
1.3 KiB
JavaScript

'use strict';
const micromatch = require('micromatch');
const normalizePath = require('normalize-path');
const path = require('path');
const filterFilePaths = require('./utils/filterFilePaths');
const getConfigForFile = require('./getConfigForFile');
const getFileIgnorer = require('./utils/getFileIgnorer');
/**
* To find out if a path is ignored, we need to load the config,
* which may have an ignoreFiles property. We then check the path
* against these.
* @param {import('stylelint').InternalApi} stylelint
* @param {string} [filePath]
* @return {Promise<boolean>}
*/
module.exports = async function isPathIgnored(stylelint, filePath) {
if (!filePath) {
return false;
}
const cwd = stylelint._options.cwd;
const ignorer = getFileIgnorer(stylelint._options);
const result = await getConfigForFile(stylelint, filePath, filePath);
if (!result) {
return true;
}
// Glob patterns for micromatch should be in POSIX-style
const ignoreFiles = [result.config.ignoreFiles || []].flat().map((s) => normalizePath(s));
const absoluteFilePath = path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath);
if (micromatch([absoluteFilePath], ignoreFiles).length) {
return true;
}
// Check filePath with .stylelintignore file
if (filterFilePaths(ignorer, [path.relative(cwd, absoluteFilePath)]).length === 0) {
return true;
}
return false;
};