declapract
Version:
A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.
17 lines • 867 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isWithinPracticeDeclarationDirectory = void 0;
/**
* checks whether a file path is within a practice declaration directory
* (best-practice or bad-practices)
*
* why? because applying fixes to practice declaration files would break the
* ability to safely apply practices against best practice declaration repos
*/
const isWithinPracticeDeclarationDirectory = (filePath) => {
// match paths like: .../practices/.../best-practice/... or .../practices/.../bad-practices/...
const practiceDeclarationPattern = /\/practices\/[^/]+\/(best-practice|bad-practices)\//;
return practiceDeclarationPattern.test(filePath);
};
exports.isWithinPracticeDeclarationDirectory = isWithinPracticeDeclarationDirectory;
//# sourceMappingURL=isWithinPracticeDeclarationDirectory.js.map