@@ -7,7 +7,7 @@ import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
77 * @param methodName The lifecycle method name
88 * @param isStatic Whether the method is static
99 */
10- function createLifecycleChecker ( methodName : string , isStatic : boolean ) {
10+ function createLifecycleChecker ( methodName : string , isStatic = false ) {
1111 return function ( node : TSESTree . Node ) : node is AST . TSESTreeMethodOrProperty {
1212 return (
1313 AST . isMethodOrProperty ( node )
@@ -19,21 +19,21 @@ function createLifecycleChecker(methodName: string, isStatic: boolean) {
1919}
2020
2121// Non-static lifecycle method checkers
22- export const isRender = createLifecycleChecker ( "render" , false ) ;
23- export const isComponentDidCatch = createLifecycleChecker ( "componentDidCatch" , false ) ;
24- export const isComponentDidMount = createLifecycleChecker ( "componentDidMount" , false ) ;
25- export const isComponentDidUpdate = createLifecycleChecker ( "componentDidUpdate" , false ) ;
26- export const isComponentWillMount = createLifecycleChecker ( "componentWillMount" , false ) ;
27- export const isComponentWillReceiveProps = createLifecycleChecker ( "componentWillReceiveProps" , false ) ;
28- export const isComponentWillUnmount = createLifecycleChecker ( "componentWillUnmount" , false ) ;
29- export const isComponentWillUpdate = createLifecycleChecker ( "componentWillUpdate" , false ) ;
30- export const isGetChildContext = createLifecycleChecker ( "getChildContext" , false ) ;
31- export const isGetInitialState = createLifecycleChecker ( "getInitialState" , false ) ;
32- export const isGetSnapshotBeforeUpdate = createLifecycleChecker ( "getSnapshotBeforeUpdate" , false ) ;
33- export const isShouldComponentUpdate = createLifecycleChecker ( "shouldComponentUpdate" , false ) ;
34- export const isUnsafeComponentWillMount = createLifecycleChecker ( "UNSAFE_componentWillMount" , false ) ;
35- export const isUnsafeComponentWillReceiveProps = createLifecycleChecker ( "UNSAFE_componentWillReceiveProps" , false ) ;
36- export const isUnsafeComponentWillUpdate = createLifecycleChecker ( "UNSAFE_componentWillUpdate" , false ) ;
22+ export const isRender = createLifecycleChecker ( "render" ) ;
23+ export const isComponentDidCatch = createLifecycleChecker ( "componentDidCatch" ) ;
24+ export const isComponentDidMount = createLifecycleChecker ( "componentDidMount" ) ;
25+ export const isComponentDidUpdate = createLifecycleChecker ( "componentDidUpdate" ) ;
26+ export const isComponentWillMount = createLifecycleChecker ( "componentWillMount" ) ;
27+ export const isComponentWillReceiveProps = createLifecycleChecker ( "componentWillReceiveProps" ) ;
28+ export const isComponentWillUnmount = createLifecycleChecker ( "componentWillUnmount" ) ;
29+ export const isComponentWillUpdate = createLifecycleChecker ( "componentWillUpdate" ) ;
30+ export const isGetChildContext = createLifecycleChecker ( "getChildContext" ) ;
31+ export const isGetInitialState = createLifecycleChecker ( "getInitialState" ) ;
32+ export const isGetSnapshotBeforeUpdate = createLifecycleChecker ( "getSnapshotBeforeUpdate" ) ;
33+ export const isShouldComponentUpdate = createLifecycleChecker ( "shouldComponentUpdate" ) ;
34+ export const isUnsafeComponentWillMount = createLifecycleChecker ( "UNSAFE_componentWillMount" ) ;
35+ export const isUnsafeComponentWillReceiveProps = createLifecycleChecker ( "UNSAFE_componentWillReceiveProps" ) ;
36+ export const isUnsafeComponentWillUpdate = createLifecycleChecker ( "UNSAFE_componentWillUpdate" ) ;
3737
3838// Static lifecycle method checkers
3939export const isGetDefaultProps = createLifecycleChecker ( "getDefaultProps" , true ) ;
0 commit comments