UNPKG

gherkin-lint-ts

Version:

Gherkin features linter written in Typescript

33 lines 1.15 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.run = exports.name = void 0; const chalk_1 = __importDefault(require("chalk")); exports.name = "no-dupe-feature-names"; const features = []; function run(feature, file) { var _a; if (!feature) { return []; } const errors = []; if (feature.name) { 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: ${chalk_1.default.underline(dupes)}`, rule: exports.name, line: ((_a = feature.location) === null || _a === void 0 ? void 0 : _a.line) || 0, }); } else { features[feature.name] = { files: [file.relativePath] }; } } return errors; } exports.run = run; //# sourceMappingURL=no-dupe-feature-names.js.map