@typescript-eslint/utils
Advanced tools
Comparing version 7.15.1-alpha.10 to 7.15.1-alpha.11
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getParserServices = getParserServices; | ||
const parserPathSeemsToBeTSESLint_1 = require("./parserPathSeemsToBeTSESLint"); | ||
const parserSeemsToBeTSESLint_1 = require("./parserSeemsToBeTSESLint"); | ||
const ERROR_MESSAGE_REQUIRES_PARSER_SERVICES = '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.'; | ||
const ERROR_MESSAGE_UNKNOWN_PARSER = 'Note: detected a parser other than @typescript-eslint/parser. Make sure the parser is configured to forward "parserOptions.project" to @typescript-eslint/parser.'; | ||
function getParserServices(context, allowWithoutFullTypeInformation = false) { | ||
const parser = context.parserPath || context.languageOptions.parser?.meta?.name; | ||
// This check is unnecessary if the user is using the latest version of our parser. | ||
@@ -20,3 +21,3 @@ // | ||
context.sourceCode.parserServices.tsNodeToESTreeNodeMap == null) { | ||
throwError(context.parserPath); | ||
throwError(parser); | ||
} | ||
@@ -27,3 +28,3 @@ // if a rule requires full type information, then hard fail if it doesn't exist | ||
!allowWithoutFullTypeInformation) { | ||
throwError(context.parserPath); | ||
throwError(parser); | ||
} | ||
@@ -33,12 +34,10 @@ return context.sourceCode.parserServices; | ||
/* eslint-enable @typescript-eslint/unified-signatures */ | ||
function throwError(parserPath) { | ||
function throwError(parser) { | ||
const messages = [ | ||
ERROR_MESSAGE_REQUIRES_PARSER_SERVICES, | ||
`Parser: ${parserPath}`, | ||
]; | ||
if (!(0, parserPathSeemsToBeTSESLint_1.parserPathSeemsToBeTSESLint)(parserPath)) { | ||
messages.push(ERROR_MESSAGE_UNKNOWN_PARSER); | ||
} | ||
`Parser: ${parser || '(unknown)'}`, | ||
!(0, parserSeemsToBeTSESLint_1.parserSeemsToBeTSESLint)(parser) && ERROR_MESSAGE_UNKNOWN_PARSER, | ||
].filter(Boolean); | ||
throw new Error(messages.join('\n')); | ||
} | ||
//# sourceMappingURL=getParserServices.js.map |
@@ -154,5 +154,5 @@ import type { JSONSchema4 } from '../json-schema'; | ||
/** | ||
* The name of the parser from configuration. | ||
* The name of the parser from configuration, if in eslintrc (legacy) config. | ||
*/ | ||
parserPath: string; | ||
parserPath: string | undefined; | ||
/** | ||
@@ -159,0 +159,0 @@ * The language options configured for this run |
{ | ||
"name": "@typescript-eslint/utils", | ||
"version": "7.15.1-alpha.10", | ||
"version": "7.15.1-alpha.11", | ||
"description": "Utilities for working with TypeScript + ESLint together", | ||
@@ -67,5 +67,5 @@ "files": [ | ||
"@eslint-community/eslint-utils": "^4.4.0", | ||
"@typescript-eslint/scope-manager": "7.15.1-alpha.10", | ||
"@typescript-eslint/types": "7.15.1-alpha.10", | ||
"@typescript-eslint/typescript-estree": "7.15.1-alpha.10" | ||
"@typescript-eslint/scope-manager": "7.15.1-alpha.11", | ||
"@typescript-eslint/types": "7.15.1-alpha.11", | ||
"@typescript-eslint/typescript-estree": "7.15.1-alpha.11" | ||
}, | ||
@@ -72,0 +72,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
284415
4199
+ Added@typescript-eslint/scope-manager@7.15.1-alpha.11(transitive)
+ Added@typescript-eslint/types@7.15.1-alpha.11(transitive)
+ Added@typescript-eslint/typescript-estree@7.15.1-alpha.11(transitive)
+ Added@typescript-eslint/visitor-keys@7.15.1-alpha.11(transitive)
- Removed@typescript-eslint/scope-manager@7.15.1-alpha.10(transitive)
- Removed@typescript-eslint/types@7.15.1-alpha.10(transitive)
- Removed@typescript-eslint/typescript-estree@7.15.1-alpha.10(transitive)
- Removed@typescript-eslint/visitor-keys@7.15.1-alpha.10(transitive)