Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(parser): fix regression with no-unused-vars for jsx attributes #161

Merged
merged 2 commits into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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