persona-community-5/.pnpm-store/v3/files/7f/c571148c696fdbf0f2cf97c5871b3340084073d6a190a955c2805496fb49abf310de1d3637917ddfc9a2bca8fdd8afb2a7abf9acfe0ec02f399d4187e7933d
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

46 lines
1.2 KiB
Plaintext

import { readFileSync } from 'fs';
import { join as pathJoin, resolve as pathResolve } from 'path';
import { lintDocument } from '../../lint';
import { BaseResolver } from '../../resolve';
import { parseYamlToDocument, makeConfigForRuleset } from '../utils';
import type { StyleguideConfig } from '../../config';
export const name = 'Validate with single nested rule';
export const count = 10;
const rebillyDefinitionRef = pathResolve(pathJoin(__dirname, 'rebilly.yaml'));
const rebillyDocument = parseYamlToDocument(
readFileSync(rebillyDefinitionRef, 'utf-8'),
rebillyDefinitionRef
);
const visitor = {
test: () => {
let count = 0;
return {
PathItem: {
Parameter() {
count++;
},
Operation: {
Parameter() {
count++;
if (count === -1) throw new Error('Disable optimization');
},
},
},
};
},
};
let config: StyleguideConfig;
export async function setupAsync() {
config = await makeConfigForRuleset(visitor);
}
export function measureAsync() {
return lintDocument({
externalRefResolver: new BaseResolver(),
document: rebillyDocument,
config,
});
}