get-builtin-rule.js 384 B

1234567891011121314
  1. 'use strict';
  2. function getBuiltinRule(id) {
  3. // TODO: Remove this when we drop support for ESLint 7
  4. const eslintVersion = require('eslint/package.json').version;
  5. /* istanbul ignore next */
  6. if (eslintVersion.startsWith('7.')) {
  7. return require(`eslint/lib/rules/${id}`);
  8. }
  9. return require('eslint/use-at-your-own-risk').builtinRules.get(id);
  10. }
  11. module.exports = getBuiltinRule;