eslint-plugin-react-native icon indicating copy to clipboard operation
eslint-plugin-react-native copied to clipboard

Help with running the plugin?

Open ghost opened this issue 2 years ago • 0 comments

I'm using a simple Expo blank template on a Visual Studio Code with Prettier and I'm trying to run this plugin so the stylesheets of my project can be sorted alphabetically.

I've installed this module using the following commands:

npm install --save-dev eslint
npm install --save-dev eslint-plugin-react
npm install --save-dev eslint-plugin-react-native
npx eslint --init

Which generated .eslintrc.js in my project's root folder and I changed it's contents with:

module.exports = {
  extends: ["prettier"],
  plugins: ["prettier", "react", "react-native"],
  parserOptions: {
    ecmaVersion: 6,
    sourceType: "module",
    ecmaFeatures: {
      jsx: true,
    },
  },
  env: {
    "react-native/react-native": true,
  },
  rules: {
    "react-native/no-unused-styles": 2,
    "react-native/split-platform-components": 2,
    "react-native/no-inline-styles": 2,
    "react-native/no-color-literals": 2,
    "react-native/no-raw-text": 2,
    "react-native/no-single-element-style-arrays": 2,
  },
};

But now when I'm saving a file only Prettier works - I guess my .eslintrc.js is not correct or I need to run it manually somehow?

ghost avatar Apr 28 '22 21:04 ghost