Closed
Description
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 have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Relevant Package
utils
Playground Link
No response
Repro Code
ESLintUtils.getParserServices(context, true).program.getSourceFile('/Users/user/Documents/repo/src/context.ts');
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json",
},
plugins: ["@typescript-eslint", "import-access"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
ignorePatterns: [".eslintrc.js", "node_modules"],
rules: {
"import-access/no-imports-outside-package": [
"error",
{
strictMode: true,
},
],
},
};
tsconfig
Expected Result
program.getSourceFile('...')
returns requested file when parserOptions.project
is specified in .eslintrc
, but when parserOptions.project
is missing, getSourceFile('...')
returns the file that is being linted. I would like to remove this setting from .eslintrc, but I can't as it breaks my plugin.
Actual Result
the wrong file is returned
Additional Info
Provided configs are the configs of the project using the plugin, not the project that compiles the plugin
Versions
package | version |
---|---|
@typescript-eslint/utils |
^5.42.1 |
@typescript-eslint/eslint-plugin |
^5.42.1 |
@typescript-eslint/parser |
^5.42.1 |
eslint |
^8.19.0 |
eslint-plugin-eslint-plugin |
^5.0.0 |
eslint-plugin-node |
^11.1.0 |
typescript |
^4.8.4 |
node |
v16.17.0 |