Skip to content

Commit

Permalink
fix(parser): fix regression with no-unused-vars for jsx attributes (#161
Browse files Browse the repository at this point in the history
)
  • Loading branch information
armano2 authored Jan 29, 2019
1 parent 38abc28 commit 6147de1
Show file tree
Hide file tree
Showing 4 changed files with 483 additions and 2 deletions.
16 changes: 15 additions & 1 deletion packages/eslint-plugin/tests/lib/rules/no-unused-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,8 @@ import foo from 'foo';
import bar from 'foo';
export interface Bar extends foo.i18n<bar> {}
`,
// https://github.com/typescript-eslint/typescript-eslint/issues/141
{
// https://github.com/typescript-eslint/typescript-eslint/issues/141
filename: 'test.tsx',
code: `
import { TypeA } from './interface';
Expand All @@ -570,6 +570,20 @@ export const a = <GenericComponent<TypeA> />;
jsx: true
}
}
},
{
// https://github.com/typescript-eslint/typescript-eslint/issues/160
filename: 'test.tsx',
code: `
const text = 'text';
export function Foo() {
return (
<div>
<input type="search" size={30} placeholder={text} />
</div>
);
}
`
}
],

Expand Down
2 changes: 1 addition & 1 deletion packages/parser/src/analyze-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class Referencer extends OriginalReferencer {
JSXOpeningElement(node: any) {
this.visit(node.name);
this.visitTypeParameters(node);
this.visit(node.attributes);
node.attributes.forEach(this.visit, this);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const text = 'text';
export function Foo() {
return (
<div>
<input type="search" size={30} placeholder={text} />
</div>
);
}
Loading

0 comments on commit 6147de1

Please sign in to comment.