ESLint: Can "react/sort-prop-types" errors be auto-fixed?

Viewed 1829

I am using Eslint: v7.26.0 and have the following rule added to it:

'react/sort-prop-types': [
  2,
  {
    callbacksLast: true,
    ignoreCase: false,
    requiredFirst: true,
    sortShapeProp: true,
    noSortAlphabetically: false,
  },
],

However, when I run the command to fix the ESLint issues, the issues thrown by this rule are not auto-fixed.

eslint --fix --format table someFile.js

Is there a way to auto-fix the errors thrown by this rule?

2 Answers

Sadly, this rule is not auto-fixable.

You can check the list of all the supported rules here.
It also tells you if the rule fixable with eslint --fix and if it is enabled by default.

If you are using VSCode and have installed the ESLint extension, then it will show you all the errors during active development which you can then fix.

The only con of this is that you will have to manually fix the errors if you are in the middle of development

Related