mirror of
https://gh.wpcy.net/https://github.com/djav1985/v-wordpress-plugin-updater.git
synced 2026-04-29 10:00:49 +08:00
22 lines
523 B
JavaScript
22 lines
523 B
JavaScript
import rules from '../rules/index.mjs';
|
|
|
|
/**
|
|
* @param {string} ruleName
|
|
* @param {import('stylelint').Config | undefined} [config]
|
|
* @returns {Promise<import('stylelint').Rule | undefined>}
|
|
*/
|
|
export default function getStylelintRule(ruleName, config) {
|
|
if (isBuiltInRule(ruleName)) {
|
|
return rules[ruleName];
|
|
}
|
|
|
|
return Promise.resolve(config?.pluginFunctions?.[ruleName]);
|
|
}
|
|
|
|
/**
|
|
* @param {string} ruleName
|
|
* @returns {ruleName is keyof rules}
|
|
*/
|
|
function isBuiltInRule(ruleName) {
|
|
return ruleName in rules;
|
|
}
|