question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

explicit-any plugins doesn't work

See original GitHub issue

Min repo setup: https://github.com/lkonya/ts-migrate-test-repo Result of running npx -p ts-migrate -c "ts-migrate-full src" can be found on https://github.com/lkonya/ts-migrate-test-repo/tree/ts-migrate.

Your default tsc path is ./node_modules/.bin/tsc.

[Step 1 of 4] Initializing ts-config for the "src"...

Config file created at /Users/laszlokonya/WebstormProjects/ts-migrate/src/tsconfig.json
[master 5e604ee] [ts-migrate][src] Init tsconfig.json file
 1 file changed, 71 insertions(+)
 create mode 100644 src/tsconfig.json
/Users/laszlokonya/WebstormProjects/ts-migrate

[Step 2 of 4] Renaming files from JS/JSX to TS/TSX and updating project.json\...

Renaming 1 JS/JSX files in /Users/laszlokonya/WebstormProjects/ts-migrate/src...
Done.
[master bfaaa3a] [ts-migrate][src] Rename files from JS/JSX to TS/TSX
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename src/{index.js => index.ts} (100%)
/Users/laszlokonya/WebstormProjects/ts-migrate

[Step 3 of 4] Fixing TypeScript errors...

TypeScript version: 4.1.2
Initialized tsserver project in 597ms.
Start...
[strip-ts-ignore] Plugin 1 of 14. Start...
[strip-ts-ignore] Finished in 10ms.
[hoist-class-statics] Plugin 2 of 14. Start...
[hoist-class-statics] Finished in 1ms.
[react-props] Plugin 3 of 14. Start...
[react-props] Finished in 1ms.
[react-class-state] Plugin 4 of 14. Start...
[react-class-state] Finished in 1ms.
[react-class-lifecycle-methods] Plugin 5 of 14. Start...
[react-class-lifecycle-methods] Finished in 1ms.
[react-default-props] Plugin 6 of 14. Start...
[react-default-props] Finished in 1ms.
[react-shape] Plugin 7 of 14. Start...
[react-shape] Finished in 1ms.
[declare-missing-class-properties] Plugin 8 of 14. Start...
[declare-missing-class-properties] Finished in 211ms.
[member-accessibility] Plugin 9 of 14. Start...
[member-accessibility] Finished in 1ms.
[explicit-any] Plugin 10 of 14. Start...
[explicit-any] Finished in 24ms.
[add-conversions] Plugin 11 of 14. Start...
[add-conversions] Finished in 13ms.
[eslint-fix] Plugin 12 of 14. Start...
Error occurred in eslint-fix plugin :(
[eslint-fix] Finished in 5ms.
[ts-ignore] Plugin 13 of 14. Start...
[ts-ignore] Finished in 3ms.
[eslint-fix] Plugin 14 of 14. Start...
Error occurred in eslint-fix plugin :(
[eslint-fix] Finished in 1ms.
Finished in 272ms, for 14 plugin(s).
Writing 1 updated file(s)...
Wrote 1 updated file(s) in 2ms.
[master a8c2731] [ts-migrate][src] Run TS Migrate
 1 file changed, 2 insertions(+)
/Users/laszlokonya/WebstormProjects/ts-migrate

[Step 4 of 4] Checking for TS compilation errors (there shouldn't be any).

./node_modules/.bin/tsc -p src/tsconfig.json
src/index.ts:8:35 - error TS7006: Parameter 'req' implicitly has an 'any' type.

8 const server = http.createServer((req, res) => {
                                    ~~~

src/index.ts:8:40 - error TS7006: Parameter 'res' implicitly has an 'any' type.

8 const server = http.createServer((req, res) => {
                                         ~~~

src/index.ts:18:25 - error TS7006: Parameter 'req' implicitly has an 'any' type.

18 function randomFunction(req, res) {
                           ~~~

src/index.ts:18:30 - error TS7006: Parameter 'res' implicitly has an 'any' type.

18 function randomFunction(req, res) {
                                ~~~

src/index.ts:24:14 - error TS7006: Parameter 'str' implicitly has an 'any' type.

24 function log(str){
                ~~~


Found 5 errors.

Function parameters doesn’t get : any type.

Any suggestions what should I do? I used ts-migrate 2 weeks ago, and it added : any everywhere, but now it doesn’t work. What do i miss?

Env: OS: MacOS 11.2.1 shell: fish 3.2.0 node: 14.16.0 ts-migrate: 0.16

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

1reaction
salemhilalcommented, Apr 21, 2021

@villesau weird — I can investigate my patch, and I’m totally cool with reverting my changes if that makes sense in the meantime.

0reactions
edsrzfcommented, Apr 26, 2021

I’ve created PR #108, which reverts #99 and fixes this issue. It also adds a test case for the problem so that we should not see the same regression in the future.

@salemhilal, assuming my PR gets merged, please open another issue for the original problem that #99 was trying to address and let’s try to find a way forward that fixes it. Without a test case or repro, I’m not entirely clear on what the issue was.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable typescript-eslint plugin rule (no-explicit-any) with ...
In just one file I want to disable that rule with a comment at the top of the file. The compiler complains if...
Read more >
no-explicit-any - TypeScript ESLint
TypeScript's --noImplicitAny compiler option prevents an implied any , but doesn't prevent any from being explicitly used the way this rule does.
Read more >
TypeScript with ESLint no-explicit-any - DEV Community ‍ ‍
TypeScript with ESLint no-explicit-any ... This rule doesn't allow any types to be defined. It aims to keep TypeScript maximally useful.
Read more >
eslint/eslint - Gitter
I would like to enable file level typescript-eslint rule using rule comments but the following is not working /*eslint @typescript-eslint/no-explicit-any: ...
Read more >
@typescript-eslint/eslint-plugin Code Examples | Snyk
ts'], parser: '@typescript-eslint/parser', // NOTE: Workaround for no nested extends possible. // See https://github.com/eslint/eslint/issues/8813. // Working ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found