⬅️ Back to Table of Contents
📄 getParserServices.test.ts
📊 Analysis Summary
Metric |
Count |
🔧 Functions |
4 |
📦 Imports |
5 |
📊 Variables & Constants |
1 |
📑 Type Aliases |
1 |
📚 Table of Contents
🛠️ File Location:
📂 packages/utils/tests/eslint-utils/getParserServices.test.ts
📦 Imports
Name |
Source |
ParserServices |
../../src |
TSESLint |
../../src |
TSESTree |
../../src |
FlatConfig |
../../src/ts-eslint |
ESLintUtils |
../../src |
Variables & Constants
Name |
Type |
Kind |
Value |
Exported |
defaults |
Readonly<RuleContext<string, unknown[]>> |
const |
`{ |
|
parserPath: '@typescript-eslint/parser/dist/index.js', |
|
|
|
|
sourceCode: { |
|
|
|
|
parserServices: { |
|
|
|
|
esTreeNodeToTSNodeMap: new Map(), |
|
|
|
|
program: {}, |
|
|
|
|
tsNodeToESTreeNodeMap: new Map(), |
|
|
|
|
} as unknown as ParserServices, |
|
|
|
|
}, |
|
|
|
|
} as unknown as UnknownRuleContext` |
✗ |
|
|
|
Functions
createMockRuleContext(overrides: Partial<UnknownRuleContext>): UnknownRuleContext
Code
(
overrides: Partial<UnknownRuleContext> = {},
): UnknownRuleContext =>
({
...defaults,
...overrides,
}) as unknown as UnknownRuleContext
- Parameters:
overrides: Partial<UnknownRuleContext>
- Return Type:
UnknownRuleContext
requiresParserServicesMessageTemplate(parser: string): string
Code
(parser = '\\S*'): string =>
'You have used a rule which requires type information, .+\n' +
`Parser: ${parser}`
- Parameters:
parser: string
- Return Type:
string
baseErrorRegex(parser: string): RegExp
Code
(parser?: string): RegExp =>
new RegExp(requiresParserServicesMessageTemplate(parser))
- Parameters:
parser: string
- Return Type:
RegExp
unknownParserErrorRegex(parser: string): RegExp
Code
(parser?: string): RegExp =>
new RegExp(
`${requiresParserServicesMessageTemplate(parser)}
Note: detected a parser other than @typescript-eslint/parser. Make sure the parser is configured to forward "parserOptions.project" to @typescript-eslint/parser.`,
)
- Parameters:
parser: string
- Return Type:
RegExp
Type Aliases
UnknownRuleContext
type UnknownRuleContext = Readonly<TSESLint.RuleContext<string, unknown[]>>;