Skip to content

Commit e0dd9bc

Browse files
committed
Upgrade dependencies and fix TS errors
Fix security vulnerability Handle private identifiers from TypeScript 3.8 Private identifiers cannot be hooks. Private identifiers can only appear in classes, whereas hooks cannot be used in class components. Also, the React namespace will not contain any accessible private properties.
1 parent 6e3dfe0 commit e0dd9bc

File tree

4 files changed

+57
-55
lines changed

4 files changed

+57
-55
lines changed

package-lock.json

Lines changed: 52 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
"author": "Grzegorz Rozdzialik <voreny.gelio@gmail.com>",
2424
"license": "MIT",
2525
"devDependencies": {
26-
"@types/node": "^12.0.7",
27-
"tslint": "^5.17.0",
28-
"typescript": "^3.5.1"
26+
"@types/node": "^12.12.30",
27+
"tslint": "^5.20.1",
28+
"typescript": "^3.8.3"
2929
},
3030
"homepage": "https://github.com/Gelio/tslint-react-hooks",
3131
"repository": {

src/react-hooks-nesting-walker/is-hook-call.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export function isHookCall(
2323
return true;
2424
} else if (
2525
isPropertyAccessExpression(expression) &&
26+
isIdentifier(expression.name) &&
2627
isHookIdentifier(expression.name)
2728
) {
2829
if (ruleOptions[detectHooksFromNonReactNamespaceOptionName]) {

src/react-hooks-nesting-walker/is-react-api-expression.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const isReactApiExpression = (predicate: Predicate<Identifier>) => (
2727
return (
2828
isIdentifier(expression.expression) &&
2929
expression.expression.text === 'React' &&
30+
isIdentifier(expression.name) &&
3031
predicate(expression.name)
3132
);
3233
}

0 commit comments

Comments
 (0)