Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

no-dupe-args and no-redeclare false positives in 20.1.0 #535

Closed
vkrol opened this issue Oct 31, 2018 · 8 comments · Fixed by #540
Closed

no-dupe-args and no-redeclare false positives in 20.1.0 #535

vkrol opened this issue Oct 31, 2018 · 8 comments · Fixed by #540
Labels

Comments

@vkrol
Copy link

vkrol commented Oct 31, 2018

What version of TypeScript are you using?
3.1.4

What version of typescript-eslint-parser are you using?
20.1.0

What code were you trying to parse?

function foo({ bar }: { bar: string }) {
	console.log(bar);
}

What did you expect to happen?
No errors.

What happened?

  1:1   error  Duplicate param 'bar'         no-dupe-args
  1:25  error  'bar' is already defined      no-redeclare
@chanlito
Copy link

chanlito commented Nov 1, 2018

I'm experiencing this issue as well after updating my vue-cli ts deps to latest.

@mysticatea
Copy link
Member

Thank you for this report.

I wonder we can disable both rules no-dupe-args and no-redeclare because TypeScript verifies those itself?

@chanlito
Copy link

chanlito commented Nov 1, 2018

That's my solution right now. Turn them off.

@milesj
Copy link

milesj commented Nov 1, 2018

This is happening for a ton of stuff, including no-shadow. Here's some output from my lints.

  3:90  error  'Theme' is already declared in the upper scope  no-shadow

  20:39  error  'Options' is already declared in the upper scope  no-shadow

  28:3   error  Duplicate param 'id'          no-dupe-args
  28:3   error  Duplicate param 'name'        no-dupe-args
  28:3   error  Duplicate param 'tagName'     no-dupe-args
  28:3   error  Duplicate param 'type'        no-dupe-args
  33:8   error  'id' is already defined       no-redeclare
  33:21  error  'name' is already defined     no-redeclare
  33:36  error  'tagName' is already defined  no-redeclare
  33:54  error  'type' is already defined     no-redeclare

And a code example:

import { Theme } from '../types';

export default function buildInputStyles(theme: Theme) {

Is this related to the eslint visitor keys change?

@mysticatea
Copy link
Member

Is this related to the eslint visitor keys change?

Yes. As I mentioned on #516 (comment), the change changed traversal in scope analysis, too. (I had assumed people has disabled rules of variables because tsc verifies it)

I will try to fix the scope analysis soon.

molant added a commit to webhintio/hint that referenced this issue Nov 2, 2018
There are issues with this rule and `typescript-eslint-parser` `v20.1.0`
and later
(eslint/typescript-eslint-parser#535). Because
`var` is not used through the code, this rule can be safely disabled,
avoid the false positives and stil use the latest version of the parser.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix: #1468
alrra pushed a commit to webhintio/hint that referenced this issue Nov 5, 2018
There are issues with this rule and `typescript-eslint-parser`
`v20.1.0` and later¹. Because `var` is not used through the code,
this rule can be safely disabled, avoid the false positives and
stil use the latest version of the parser.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

¹ eslint/typescript-eslint-parser#535

Fix #1468
mysticatea added a commit that referenced this issue Nov 8, 2018
@vkrol
Copy link
Author

vkrol commented Nov 9, 2018

I wonder we can disable both rules no-dupe-args and no-redeclare because TypeScript verifies those itself?

@mysticatea strictly speaking, TypeScript does not verify no-redeclare always. This is not an error in TS:

var a = 3;
var a = 10;

mysticatea added a commit that referenced this issue Nov 13, 2018
* Update: add proper scope analysis (fixes #535)

* add computed-properties-in-type fixture

* add computed-properties-in-interface fixture

* add function-overload fixture

* add method-overload fixture

* add class-properties fixture

* add decorators fixture

* update visitor-keys

* add declare-global fixture

* fix typo

* add test for typeof in array destructuring

* add namespace fixture

* add declare-module fixture

* fix crash

* add declare-function.ts fixture

* add abstract-class fixture

* add typeof-in-call-signature fixture

* add test for #416

* add test for #435

* add test for #437

* add test for #443

* add test for #459

* add test for #466

* add test for #471

* add test for #487

* add test for #535

* add test for #536

* add test for #476

* fix test to use `expect()`
@ffxsam
Copy link

ffxsam commented Nov 15, 2018

Just stumbled upon this too, would be great to have it ignore TS syntax.

@vkrol
Copy link
Author

vkrol commented Nov 15, 2018

@mysticatea thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants