persona-community-5/.pnpm-store/v3/files/e6/6609e4e6c2d1b2fd48047b96ebd83ae1151c8c4e3b427d9cd53243ec6f0e8d66ae2f679cf5a4e78de69565e13fe3c4d3cac74c5d70f1e50bf40bea9add36f1
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

34 lines
1.3 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PathSegmentPlural = void 0;
const pluralize = require("pluralize");
const utils_1 = require("../../utils");
const PathSegmentPlural = (opts) => {
const { ignoreLastPathSegment, exceptions } = opts;
return {
PathItem: {
leave(_path, { report, key, location }) {
const pathKey = key.toString();
if (pathKey.startsWith('/')) {
const pathSegments = pathKey.split('/');
pathSegments.shift();
if (ignoreLastPathSegment && pathSegments.length > 1) {
pathSegments.pop();
}
for (const pathSegment of pathSegments) {
if (exceptions && exceptions.includes(pathSegment))
continue;
if (!(0, utils_1.isPathParameter)(pathSegment) && pluralize.isSingular(pathSegment)) {
report({
message: `path segment \`${pathSegment}\` should be plural.`,
location: location.key(),
});
}
}
}
},
},
};
};
exports.PathSegmentPlural = PathSegmentPlural;