eslint-plugin-jest-runner-groups-validator
Version:
Validates that Jest runner groups applied to test files are from a known set
19 lines (15 loc) • 461 B
JavaScript
const { includeFileNames } = require('./constants');
const doNothing = {
Program() {
// Do nothing.
}
};
/**
* Returns a "do nothing" program linter if the context file is reportable.
* @param {JRGV.ESLint.Rule.RuleContext} context
*/
const onlyRunOnTestFiles = (context) => {
const filename = context.getFilename();
return includeFileNames.test(filename) ? undefined : doNothing;
};
module.exports = { onlyRunOnTestFiles };