antler
Version:
Directory structure linter
19 lines • 599 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NoLonelyIndex = void 0;
const rule_1 = require("../rule");
const MATCHES_INDEX_FILE = /^index\./;
class NoLonelyIndex extends rule_1.Rule {
run(node) {
if (!node.isDirectory &&
MATCHES_INDEX_FILE.test(node.name) &&
node.siblingNamesIncludingSelf.length === 1) {
this.report(`Lonely index file at ${node.path}`);
}
}
getName() {
return 'NoLonelyIndex';
}
}
exports.NoLonelyIndex = NoLonelyIndex;
//# sourceMappingURL=no-lonely-index.js.map