persona-community-5/.pnpm-store/v3/files/5a/237c9418f992a3650df7e72e6aca6543e1ab3b0b138122a2ee02534295b76e1023f7f17b28998244984bdf545e6b6addb1b854c5e95e359437ac6e14b3a044
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.4 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NoHttpVerbsInPaths = void 0;
const utils_1 = require("../../utils");
const httpMethods = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];
const NoHttpVerbsInPaths = ({ splitIntoWords }) => {
return {
PathItem(_path, { key, report, location }) {
const pathKey = key.toString();
if (!pathKey.startsWith('/'))
return;
const pathSegments = pathKey.split('/');
for (const pathSegment of pathSegments) {
if (!pathSegment || (0, utils_1.isPathParameter)(pathSegment))
continue;
const isHttpMethodIncluded = (method) => {
return splitIntoWords
? (0, utils_1.splitCamelCaseIntoWords)(pathSegment).has(method)
: pathSegment.toLocaleLowerCase().includes(method);
};
for (const method of httpMethods) {
if (isHttpMethodIncluded(method)) {
report({
message: `path \`${pathKey}\` should not contain http verb ${method}`,
location: location.key(),
});
}
}
}
},
};
};
exports.NoHttpVerbsInPaths = NoHttpVerbsInPaths;