palantir / tslint-react

:orange_book: Lint rules related to React & JSX for TSLint.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New Rule: No used props

bluerface opened this issue · comments

Useful for dead code elimination

Hi there @bluerface,

Can you go into a little more detail as to how you would expect this rule to work, perhaps with some examples?

I believe they meant unused props, something like

const Foo = (props: {name: string; unusedProp: number}) => <div>Hi, {props.name}</div>
                                   ~~~~~~~~~~ The prop 'unusedProp' is not used anywhere in the component.

The previous issue proposed the same thing: #150. There is a rule like this in tslint-microsoft-contrib, but it doesn't work with stateless components.

Given that React is moving towards SFCs over Class's, is this not something that could / should become part of this repos scope?

This request doesn't look any different from no-unused-variable, which is deprecated for maintenance reasons.