persona-community-5/.pnpm-store/v3/files/a4/31e03a52624f0ee2155b801b26be4cbc2900db0524d4fc215315fc5201bd30fb53df44021242b7c837022a4476e4aa2575fa0ab61a4af60a5623105312756e
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

25 lines
1.1 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BooleanParameterPrefixes = void 0;
const BooleanParameterPrefixes = (options) => {
const prefixes = options.prefixes || ['is', 'has'];
const regexp = new RegExp(`^(${prefixes.join('|')})[A-Z-_]`);
const wrappedPrefixes = prefixes.map((p) => `\`${p}\``);
const prefixesString = wrappedPrefixes.length === 1
? wrappedPrefixes[0]
: wrappedPrefixes.slice(0, -1).join(', ') + ' or ' + wrappedPrefixes[prefixes.length - 1];
return {
Parameter: {
Schema(schema, { report, parentLocations }, parents) {
if (schema.type === 'boolean' && !regexp.test(parents.Parameter.name)) {
report({
message: `Boolean parameter \`${parents.Parameter.name}\` should have ${prefixesString} prefix.`,
location: parentLocations.Parameter.child(['name']),
});
}
},
},
};
};
exports.BooleanParameterPrefixes = BooleanParameterPrefixes;