react-unused-props-and-state doesn't count actual usages
karol-majewski opened this issue ยท 2 comments
karol-majewski commented
Bug Report
tslint-microsoft-contrib
version: 6.2.0- TSLint version: 5.17.0
- TypeScript version: 3.5.1
- Running TSLint via: (pick one) Visual Studio Code
TypeScript code being linted
import * as React from 'react';
declare const Avatar: React.FC<{ name: string; label: number }>;
interface Props {
name: string;
age: number;
}
const User: React.FunctionComponent<Props> = ({ name }) =>
<Avatar name={name} label={42} />;
const Client: React.FunctionComponent<Props> = ({ age }) =>
<Avatar name="Bob" label={age} />;
with tslint.json
configuration:
{
"rules": {
"react-unused-props-and-state": [
true,
{
"props-interface-regex": "Props$",
"state-interface-regex": "State$"
}
]
}
}
Actual behavior
No error.
Expected behavior
There should be errors for both components. Neither of them uses all props it's given. From the Props
interface perspective everything is okay (all props are referenced), but from the component's perspective, some props are unused.
JoshuaKGoldberg commented
JoshuaKGoldberg commented
๐ It's time! ๐
TSLint is being deprecated; therefore, it and tslint-microsoft-contrib are no longer accepting pull requests for major new changes or features. See palantir/tslint#4534. ๐ฑ
If you'd like to see this change implemented, you have two choices:
- Recommended: Check if this is available in ESLint + typescript-eslint โ
- Not Recommended: Fork TSLint or tslint-microsoft-contrib locally ๐คทโโ๏ธ
๐ It was a pleasure open sourcing with you!
If you believe this message was posted here in error, please comment so we can re-open the issue!