Closed JohnPhamous closed 5 years ago
tslint-microsoft-contrib
public UNSAFE_componentWillReceiveProps(nextProps: IOnboardReleaseFormProps): void { ... }
Throws this error: Method name does not match /^[a-z][\w\d]+$/: UNSAFE_componentWillReceiveProps (function-name)
Method name does not match /^[a-z][\w\d]+$/: UNSAFE_componentWillReceiveProps (function-name)
React 16.9.0 added UNSAFE_* methods. The regex currently being used doesn't allow for the UNSAFE_ prefix.
UNSAFE_*
UNSAFE_
Not sure how yall want to handle this since it's a library dependent change. What do yall think of changing the regex to ([a-z]|UNSAFE)[\w\d]+?
([a-z]|UNSAFE)[\w\d]+
👋 @JohnPhamous good idea! Fortunately, the function-name rule supports overriding the regular expressions used already:
function-name
https://github.com/microsoft/tslint-microsoft-contrib/blob/bfc28e95dde1fab92aa457e79d338fb03b81d7cc/src/functionNameRule.ts#L73
Bug Report
tslint-microsoft-contrib
version: 6.2.0TypeScript code being linted
Actual behavior
Throws this error:
Method name does not match /^[a-z][\w\d]+$/: UNSAFE_componentWillReceiveProps (function-name)
Expected behavior
React 16.9.0 added
UNSAFE_*
methods. The regex currently being used doesn't allow for theUNSAFE_
prefix.Proposed Changes
Not sure how yall want to handle this since it's a library dependent change. What do yall think of changing the regex to
([a-z]|UNSAFE)[\w\d]+
?