UNPKG

gplint

Version:

A Gherkin linter/validator written in Javascript.

33 lines 961 B
export const name = 'no-dupe-feature-names'; const features = {}; export function run({ feature, file }) { if (!feature) { return []; } const errors = []; if (feature.name in features) { const dupes = features[feature.name].files.join(', '); features[feature.name].files.push(file.relativePath); errors.push({ message: `Feature name is already used in: ${dupes}`, rule: name, line: feature.location.line, column: feature.location.column, }); } else { features[feature.name] = { files: [file.relativePath] }; } return errors; } export const documentation = { description: 'Disallows duplicate Feature names.', examples: [{ title: 'Example', description: 'Enable rule', config: { [name]: 'error', } }], }; //# sourceMappingURL=no-dupe-feature-names.js.map