persona-community-5/.pnpm-store/v3/files/d8/734b980a0eb98d8a483dd1bed25d57c2a82f4a8ee798f3a273ef3da788320f3028f3705d3add8be22e3cef2549bb418a2e1447ea0a32db5c36e880544ea498
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

20 lines
722 B
Plaintext

import type { Channel } from '../../typings/asyncapi3';
import type { Async3Rule } from '../../visitors';
import type { UserContext } from '../../walk';
export const ChannelsKebabCase: Async3Rule = () => {
return {
Channel(channel: Channel, { report }: UserContext) {
const segments = (channel.address || '')
.split(/[/.:]/) // split on / or : as likely channel namespacers
.filter((s) => s !== ''); // filter out empty segments
if (!segments.every((segment) => /^{.+}$/.test(segment) || /^[a-z0-9-.]+$/.test(segment))) {
report({
message: `\`${channel.address}\` does not use kebab-case.`,
location: { reportOnKey: true },
});
}
},
};
};