UNPKG

eslint-plugin-codelyzer

Version:

22 lines (21 loc) 1.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var experimental_utils_1 = require("@typescript-eslint/experimental-utils"); exports.createESLintRule = experimental_utils_1.ESLintUtils.RuleCreator(function () { return ""; }); function getParserServices(context) { if (!context.parserServices || !context.parserServices.program || !context.parserServices.esTreeNodeToTSNodeMap) { throw new Error('You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.'); } return context.parserServices; } exports.getParserServices = getParserServices; function getNodeMaps(context) { if (!context.parserServices || !context.parserServices.esTreeNodeToTSNodeMap || !context.parserServices.tsNodeToESTreeNodeMap) { throw new Error('You have used a rule which requires AST node maps to be preserved during conversion. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser, or set "parserOptions.preserveNodeMaps" to `true`.'); } return { esTreeNodeToTSNodeMap: context.parserServices.esTreeNodeToTSNodeMap, tsNodeToESTreeNodeMap: context.parserServices.tsNodeToESTreeNodeMap }; } exports.getNodeMaps = getNodeMaps;