Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bug: RuleContext.parserPath should be string | undefined, not string #9475

Closed
Assignees
JoshuaKGoldberg
Labels
accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I havesearched for related issues and found none that matched my issue.
  • I haveread the FAQ and my problem is not listed.

Relevant Package

utils

Playground Link

No response

Repro Code

import*asespreefrom'espree';importeslintfrom'@eslint/js';importtseslintAfrom'typescript-eslint';exportdefaulttseslintA.config(eslint.configs.recommended,  ...tseslintA.configs.recommendedTypeChecked,{files:['index.ts'],languageOptions:{parser:espree,parserOptions:{EXPERIMENTAL_useProjectService:true,}}});

ESLint Config

No response

tsconfig

No response

Expected Result

ESLint doesn't always know theparserName provided in rule contexts:

https://github.com/eslint/eslint/blob/7c78ad9d9f896354d557f24e2d37710cf79a27bf/lib/linter/linter.js#L978

* @param{string|undefined}parserNameThenameoftheparserintheconfig

https://github.com/eslint/eslint/blob/7c78ad9d9f896354d557f24e2d37710cf79a27bf/lib/linter/linter.js#L1920-L1924

lintingProblems=runRules(sourceCode,configuredRules,ruleId=>getRuleFromConfig(ruleId,config),void0,

Actual Result

...but we define it as:

/**
* The rule ID.
*/
id:string;

And now we have this unfortunate stdout bug - note theParser: undefined:

Error: Error while loading rule '@typescript-eslint/await-thenable': 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.Parser: undefinedNote: detected a parser other than @typescript-eslint/parser. Make sure the parser is configured to forward "parserOptions.project" to @typescript-eslint/parser.Occurred while linting /Users/josh/repos/repros/index.ts

Additional Info

I'll file an ESLint issue soon asking that ESLint tries to glean that parser name if possible. Theespree module exports aname = 'espree' that can be useful.

Edit:eslint/eslint#18645

Versions

packageversion
@typescript-eslint/eslint-plugin7.15.0
@typescript-eslint/parser7.15.0
@typescript-eslint/utils7.15.0
ESLint8.6.0

💖

Metadata

Metadata

Labels

accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp