Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Description
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I haveread the FAQ and my problem is not listed.
Repro
We need a few files to reproduce this:
- a TS project
- with acustom path resolution to itself
- andexporting something that depends on aimported symbol that is imported using the custom path
- other TS project using the above export of the first TS project
Reproduction is available here:https://github.com/gcangussu/typescript-eslint-bug-repro
Expected Result
Tests passing
$ npm --silent test && echo $?0
We can see that it works with single run inference disabled with
npm run test-without-single-run-inference
Actual Result
npm --silent test && echo $?/Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo/src/app.ts 9:7 error Unsafe assignment of an `any` value @typescript-eslint/no-unsafe-assignment 10:30 error Invalid type "any" of template literal expression @typescript-eslint/restrict-template-expressions 10:30 error Unsafe member access .toFixed on an `any` value @typescript-eslint/no-unsafe-member-access 10:30 error Unsafe call of an `any` typed value @typescript-eslint/no-unsafe-call✖ 4 problems (4 errors, 0 warnings)
Additional Info
It seems that with single run the project (tsconfig.json) is not being correctly taken into consideration. Checking theoutput ofpackages/bar/src/public/utils.ts
shows that it is correctly typed. However, when it is imported from another package (foo), ts-eslint fails to find its type. Although, it works fine whenimported from within the same package.
I've kept only the rule@typescript-eslint/no-unsafe-assignment
and runnpx eslint --ext=.ts --debug packages/foo/src/app.ts
.
Output, click to expand
2021-09-06T20:51:40.919Z eslint:cli CLI args: [ '--ext=.ts', '--debug', 'packages/foo/src/app.ts' ]2021-09-06T20:51:40.921Z eslint:cli Running on files2021-09-06T20:51:40.930Z eslintrc:config-array-factory Loading .eslintignore file: /Users/gabriel/Repos/typescript-eslint-bug-repro/.eslintignore2021-09-06T20:51:40.931Z eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/Users/gabriel/Repos/typescript-eslint-bug-repro', loose: false } ]2021-09-06T20:51:40.933Z eslintrc:ignore-pattern processed: { basePath: '/Users/gabriel/Repos/typescript-eslint-bug-repro', patterns: [ '/**/node_modules/*' ] }2021-09-06T20:51:40.933Z eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/Users/gabriel/Repos/typescript-eslint-bug-repro', loose: false } ]2021-09-06T20:51:40.933Z eslintrc:ignore-pattern processed: { basePath: '/Users/gabriel/Repos/typescript-eslint-bug-repro', patterns: [ '/**/node_modules/*' ] }2021-09-06T20:51:40.934Z eslint:file-enumerator Start to iterate files: [ 'packages/foo/src/app.ts' ]2021-09-06T20:51:40.934Z eslint:file-enumerator File: /Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo/src/app.ts2021-09-06T20:51:40.934Z eslintrc:cascading-config-array-factory Load config files for /Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo/src.2021-09-06T20:51:40.934Z eslintrc:cascading-config-array-factory No cache found: /Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo/src.2021-09-06T20:51:40.934Z eslintrc:config-array-factory Config file not found on /Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo/src2021-09-06T20:51:40.935Z eslintrc:cascading-config-array-factory No cache found: /Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo.2021-09-06T20:51:40.935Z eslintrc:config-array-factory Config file not found on /Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo2021-09-06T20:51:40.935Z eslintrc:cascading-config-array-factory No cache found: /Users/gabriel/Repos/typescript-eslint-bug-repro/packages.2021-09-06T20:51:40.935Z eslintrc:config-array-factory Config file not found on /Users/gabriel/Repos/typescript-eslint-bug-repro/packages2021-09-06T20:51:40.935Z eslintrc:cascading-config-array-factory No cache found: /Users/gabriel/Repos/typescript-eslint-bug-repro.2021-09-06T20:51:40.935Z eslintrc:config-array-factory Loading JSON config file: /Users/gabriel/Repos/typescript-eslint-bug-repro/.eslintrc.json2021-09-06T20:51:40.935Z eslintrc:config-array-factory Config file found: /Users/gabriel/Repos/typescript-eslint-bug-repro/.eslintrc.json2021-09-06T20:51:40.936Z eslintrc:config-array-factory Loading parser "@typescript-eslint/parser" from /Users/gabriel/Repos/typescript-eslint-bug-repro/.eslintrc.json2021-09-06T20:51:40.936Z eslintrc:config-array-factory Loaded: @typescript-eslint/parser@4.30.0 (/Users/gabriel/Repos/typescript-eslint-bug-repro/node_modules/@typescript-eslint/parser/dist/index.js)2021-09-06T20:51:41.136Z eslintrc:config-array-factory Loading plugin "@typescript-eslint" from /Users/gabriel/Repos/typescript-eslint-bug-repro/.eslintrc.json2021-09-06T20:51:41.137Z eslintrc:config-array-factory Loaded: @typescript-eslint/eslint-plugin@4.30.0 (/Users/gabriel/Repos/typescript-eslint-bug-repro/node_modules/@typescript-eslint/eslint-plugin/dist/index.js)2021-09-06T20:51:41.274Z eslintrc:config-array-factory Plugin /Users/gabriel/Repos/typescript-eslint-bug-repro/node_modules/@typescript-eslint/eslint-plugin/dist/index.js loaded in: 137ms2021-09-06T20:51:41.274Z eslintrc:cascading-config-array-factory Stop traversing because of 'root:true'.2021-09-06T20:51:41.276Z eslintrc:cascading-config-array-factory Configuration was determined: ConfigArray(3) [ { type: 'config', name: 'DefaultIgnorePattern', filePath: '', criteria: null, env: undefined, globals: undefined, ignorePattern: IgnorePattern { patterns: [Array], basePath: '/Users/gabriel/Repos/typescript-eslint-bug-repro', loose: false }, noInlineConfig: undefined, parser: undefined, parserOptions: undefined, plugins: undefined, processor: undefined, reportUnusedDisableDirectives: undefined, root: undefined, rules: undefined, settings: undefined }, { type: 'config', name: '.eslintrc.json', filePath: '/Users/gabriel/Repos/typescript-eslint-bug-repro/.eslintrc.json', criteria: null, env: undefined, globals: undefined, ignorePattern: undefined, noInlineConfig: undefined, parser: { error: null, filePath: '/Users/gabriel/Repos/typescript-eslint-bug-repro/node_modules/@typescript-eslint/parser/dist/index.js', id: '@typescript-eslint/parser', importerName: '.eslintrc.json', importerPath: '/Users/gabriel/Repos/typescript-eslint-bug-repro/.eslintrc.json' }, parserOptions: { allowAutomaticSingleRunInference: true, project: [Array] }, plugins: { '@typescript-eslint': [Object] }, processor: undefined, reportUnusedDisableDirectives: undefined, root: true, rules: { '@typescript-eslint/no-unsafe-assignment': 'error' }, settings: undefined }, { type: 'ignore', name: '.eslintignore', filePath: '/Users/gabriel/Repos/typescript-eslint-bug-repro/.eslintignore', criteria: null, env: undefined, globals: undefined, ignorePattern: IgnorePattern { patterns: [Array], basePath: '/Users/gabriel/Repos/typescript-eslint-bug-repro', loose: true }, noInlineConfig: undefined, parser: undefined, parserOptions: undefined, plugins: undefined, processor: undefined, reportUnusedDisableDirectives: undefined, root: undefined, rules: undefined, settings: undefined } ] on /Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo/src2021-09-06T20:51:41.276Z eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/Users/gabriel/Repos/typescript-eslint-bug-repro', loose: false }, IgnorePattern { patterns: [ 'build/' ], basePath: '/Users/gabriel/Repos/typescript-eslint-bug-repro', loose: true } ]2021-09-06T20:51:41.276Z eslintrc:ignore-pattern processed: { basePath: '/Users/gabriel/Repos/typescript-eslint-bug-repro', patterns: [ '/**/node_modules/*', 'build/' ] }2021-09-06T20:51:41.277Z eslintrc:ignore-pattern Check { filePath: '/Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo/src/app.ts', dot: false, relativePath: 'packages/foo/src/app.ts', result: false}2021-09-06T20:51:41.277Z eslint:cli-engine Lint /Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo/src/app.ts2021-09-06T20:51:41.277Z eslint:linter Linting code for /Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo/src/app.ts (pass 1)2021-09-06T20:51:41.277Z eslint:linter Verify2021-09-06T20:51:41.277Z eslint:linter With ConfigArray: /Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo/src/app.ts2021-09-06T20:51:42.117Z eslint:linter Generating fixed text for /Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo/src/app.ts (pass 1)2021-09-06T20:51:42.117Z eslint:source-code-fixer Applying fixes2021-09-06T20:51:42.117Z eslint:source-code-fixer shouldFix parameter was false, not attempting fixes2021-09-06T20:51:42.118Z eslint:file-enumerator Complete iterating files: ["packages/foo/src/app.ts"]2021-09-06T20:51:42.118Z eslint:cli-engine Linting complete in: 1184ms/Users/gabriel/Repos/typescript-eslint-bug-repro/packages/foo/src/app.ts 9:7 error Unsafe assignment of an `any` value @typescript-eslint/no-unsafe-assignment✖ 1 problem (1 error, 0 warnings)
Relates to#3528
Versions
package | version |
---|---|
@typescript-eslint/typescript-estree | 4.30.0 |
@typescript-eslint/eslint-plugin | 4.30.0 |
@typescript-eslint/parser | 4.30.0 |
TypeScript | 4.4.2 |
node | 14.17.6 |