Intellicode / eslint-plugin-react-native

React Native plugin for ESLint
MIT License
722 stars 130 forks source link

Eslint 8.0 error when using --fix: Fixable rules must set the `meta.fixable` property to "code" or "whitespace" #298

Closed idolize closed 3 years ago

idolize commented 3 years ago

Just updated to eslint 8.0 and getting a new error with this plugin.

See: https://eslint.org/docs/8.0.0/user-guide/migrating-to-8.0.0#rules-require-metafixable-to-provide-fixes

Here is the error stack:

Oops! Something went wrong! :(

ESLint: 8.0.1

Error: Fixable rules must set the `meta.fixable` property to "code" or "whitespace".
Occurred while linting /Users/test/components/Test.tsx:51
Rule: "react-native/sort-styles"
    at Object.report (/Users/test/node_modules/eslint/lib/linter/linter.js:940:35)
    at report (/Users/test/node_modules/eslint-plugin-react-native/lib/rules/sort-styles.js:62:13)
    at checkIsSorted (/Users/test/node_modules/eslint-plugin-react-native/lib/rules/sort-styles.js:98:16)
    at /Users/test/node_modules/eslint-plugin-react-native/lib/rules/sort-styles.js:127:13
    at Array.forEach (<anonymous>)
    at /Users/test/node_modules/eslint-plugin-react-native/lib/rules/sort-styles.js:126:31
    at Array.forEach (<anonymous>)
    at /Users/test/node_modules/eslint-plugin-react-native/lib/rules/sort-styles.js:120:26
    at Array.forEach (<anonymous>)
    at CallExpression (/Users/test/node_modules/eslint-plugin-react-native/lib/rules/sort-styles.js:119:30)

I always run eslint with --fix, so this is breaking my current workflow.

janschloss commented 3 years ago

Thanks for opening the issue and the PR. I have the same problem.

In case anyone is blocked by this, you can just disable the rule until the PR is merged by @Intellicode

      rules: {
        // https://github.com/Intellicode/eslint-plugin-react-native/issues/298
        "react-native/sort-styles": 0,
      },