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

Detect not imported element

Open Baptiste-Garcin opened this issue 8 years ago • 2 comments

I often loose my mind looking for vicious a bug whereas I only forgot to import one of the native elements I am using... The no-undef classic rule is not triggering.

Is there a walk around ?

Thanks

Baptiste-Garcin avatar Jun 05 '17 19:06 Baptiste-Garcin

Hi, could you post an example of this? I personally have not had any issues related to this.

Intellicode avatar Jun 05 '17 21:06 Intellicode

Hi,

I am sorry, it took me ages... Bad news I had to change computer, good news I fully reinstalled my set up and so I can provide you with genuine information.

Eslint doesn't detect not imported native element (such as Text). I tested with atom linter and in command line, on Mac and on Debian.

I deleted Text from the imports and add an unused test variable in my code.

screenshot from 2017-06-16 22-41-25

Eslint detects the unused variable but not the missing Text element.

screenshot from 2017-06-16 23-11-39

Here is my eslintrc... pretty sure, it can help

{ "env": { "browser": true, "es6": true, "node": true }, "extends": "eslint:recommended", "parser": "babel-eslint", "parserOptions": { "ecmaFeatures": { "experimentalObjectRestSpread": true, "jsx": true }, "sourceType": "module" }, "plugins": [ "react", "react-native" ], "rules": { "no-unused-vars": ["error", { "varsIgnorePattern": "React" }], "react/jsx-uses-vars" : "error", "indent": [ "error", 2 ], "linebreak-style": [ "error", "unix" ], "quotes": [ "error", "single" ], "semi": [ "error", "always" ] } }

Thanks

Baptiste-Garcin avatar Jun 16 '17 21:06 Baptiste-Garcin