I'm trying to sort props names alphabetically using the plugin eslint-plugin-react but I'm getting this error:
[Error ] .eslintrc.json: Configuration for rule "react/jsx-sort-props" is invalid: Value {"callbacksLast":true,"shorthandFirst":false,"shorthandLast":true,"multiline":"last","ignoreCase":true,"noSortAlphabetically":false} should NOT have additional properties. 
This is my .eslintrc.json file:
{
  "extends": [
    "eslint:recommended",
    "plugin:react/recommended",
    "next/core-web-vitals"
  ],
  "rules": {
    "react/jsx-sort-props": [
      "2",
      {
        "callbacksLast": true,
        "shorthandFirst": false,
        "shorthandLast": true,
        "multiline": "last",
        "ignoreCase": true,
        "noSortAlphabetically": false
      }
    ]
  }
}
What I'm missing?
There are two issues:
2, not "2". (Though, personally, I'd suggest using "error" instead - it makes it clearer from reading the config what the rule means for your project - "error" makes more intuitive sense than 2)jsx-sort-props.js - although the docs reference a multiline property, said property does not exist anywhere in the lint rule implementation, and so an error is thrown when you pass in an object containing that property. Remove it."rules": {
    "react/jsx-sort-props": [
        2,
        {
            "callbacksLast": true,
            "shorthandFirst": false,
            "shorthandLast": true,
            "ignoreCase": true,
            "noSortAlphabetically": false
        }
    ]
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With