3

Currently, I'm getting these linting errors:

ESLint: UNSAFE_componentWillUpdate should be placed after someFunction (react/sort-comp)

and

ESLint: Identifier 'UNSAFE_componentWillUpdate' is not in camel case. (camelcase)

Currently, I'm not able to find the correct rules to add to .eslintrc to apply to the prepended UNSAFE_ component lifecycles. I'm trying to make it apply to both react/sort-comp and camelcase rules, any clues/help would be appreciated

1 Answer 1

6

You can add this to your eslint

"camelcase": [
  "error", {
    "ignoreDestructuring": true,
    "allow": [ "^UNSAFE_" ]
  }
],

This basically just allows all the renamed UNSAFE_ lifecycle methods.

1
  • Where is the eslint config file ? Edit:In the project root folder: /.eslintrc The code needs to be added under the rules: part
    – FMaz008
    Commented Dec 12, 2020 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.