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

Support or ignore prop-types in mixed JS/TypeScript projects #1461

gpeal opened this issue Oct 3, 2017 · 2 comments


Copy link

commented Oct 3, 2017

I'm working on a project with mixed JS and TypeScript support. We heavily use eslint rules in js and our ts goes through the typescript-eslint-parser. However, the interface definition of the typescript -> js ast doesn't get picked up by the prop-types rule like it does for Flow.
This gist has some sample tsx code as well as the ast that is produced for it. This particular case would fail proptypes but I renamed the prop so it would be easier to identify in the ast for the purpose of this issue.

Unfortunately, the ast around the prop definition seems relatively unstructured. However, the typescript compiler itself makes this rule redundant anyway.

Instead of adding complexity to this rule, I propose that an option is added to either explicitly ignore ts/tsx files or make a config array to ignore specific extensions.

What do you think?

@yannickcr @jseminck @lelandrichardson


This comment has been minimized.

Copy link

commented Oct 3, 2017

eslint 4 already supports glob-based configuration; you can configure any rule to be disabled on ts/tsx files already.

@ljharb ljharb closed this Oct 3, 2017


This comment has been minimized.

Copy link

commented Jan 2, 2019

    "overrides": [
            "files": ["**/*.tsx"],
            "rules": {
                "react/prop-types": "off"

put above override in eslint config file will solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.