I'm trying to lint certain rules via the eslint CLI in my create-react-app. The rule I'd like to fix is react/jsx-sort-props
.
At first I tried the format for fixing single rules provided here: How to fix just one rule using eslint
"fix-style":"eslint --fix --rule 'react/jsx-sort-props"
But this gives error:
Invalid value for option 'rule' - expected type Object, received value: 'react/jsx-sort-props.
This error is discussed in ESLint CLI with --rule option but none of the solutions seem to work.
Running:
//package.json
"scripts": {
"fix-style": "eslint --fix --rule 'react/jsx-sort-props: ['warn']'",
}
Gives:
$ eslint --fix --rule 'react/jsx-sort-props: ['warn']'
Oops! Something went wrong! :(
ESLint: 7.32.0
No files matching the pattern "['warn']'" were found.
Please check for typing mistakes in the pattern.
So what's the correct way to fix a single rule?
OS: Windows 10