(ESLint) Definition for rule 'react/jsx-sort-prop-types' was not found

Hooman Bahreini :

I have just updated my VS 2017 (version 15.8.2). Now when I open any .js file, I see a red squiggly line on the first line of the file... this is the warning message:

Definition for rule 'react/jsx-sort-prop-types' was not found

enter image description here

and when I hover over the squiggly line:

enter image description here

I am not sure why suddenly I am getting so many .js errors?

Hooman Bahreini :

ESLint (which is a JS code analyzer) is enabled by default in VS 2017 - from version 15.8:

ESLint support: ESLint support has been reimplemented in this release. So, Visual Studio will now lint JavaScript files as you edit. ESLint has been updated to use ESLint 4 by default, but if your project has a local installation of ESLint, it will use that version instead. You can easily disable ESLint globally in VS by unchecking the “Enable ESLint” setting in the “Tools / Options” dialog in the location shown below.

If you want to use ESLint coding guideline, then all you need to do is to Reset global .eslintrc file. In VS go to:

Tools > Options > Text Editor > JavaScript/TypeScript > Linting

And click on Reset global .eslintrc button:

enter image description here

Resetting .eslintrc will fix your settings file (it imports react plugin)

Note that the default plugin which comes with VS is react plugin, this does not mean that you are using react.js, but it means you are using react coding guidelines.

Also note that, the above step imports react plugin into the setting, and sets up ESLint correctly, but you would probably still get a lot of .js styling errors, because you probably have not been following react coding guideline or some of the .js libraries that you have included in your project do not follow the guideline (the linting errors may not appear if the .js files are not open in VS, open a couple .js files and recompile to get the linting errors).

As an example, I was getting some styling error on jquery.validate.js. You probably don't want to change jquery.validate.js code, see this question on how to configure ESLint to ignore certain .js files.


If you don't want to make all the modifications to your project, you can disable ESLint as shown in the picture above.

If you want to use a different plugin, this is the full list of predefined plugins.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

ESLint: '.map is missing in props validation' (eslint react/prop-types) in Typescript React

How to disable ESLint react/prop-types rule in a file?

ESLint autofix ignore rule

Disable warning message for eslint rule not being found

Eslint - 'match' is missing in props validation (react/prop-types)

eslint `forbid-prop-types` rule cause a warning in firefox console window

How to resolves "prop-types not found on request" error?

What is the problem with the propTypes object, string and array which makes eslint to have this rule: react/forbid-prop-types?

Run eslint for a single rule

How to use prop-types as type definition in typescript?

What is the ESLint rule to prevent newline after an object prop colon

Overriding eslint rule

How to fix 'Definition for rule '@typescript-eslint/no-use-before-declare' was not found.eslint(@typescript-eslint/no-use-before-declare)'

react/prop-types eslint error in typescript react component

Definition for rule '@typescript-eslint/no-implicit-any' was not found with Storybook js

Definition for rule 'react-hooks/exhaustive-deps' was not found

Definition for rule 'simple-import-sort/sort' was not found simple-import-sort/sort

React linting definition for rule display-name not found

OpenSeadragon missing prop in types definition

ESLint CLI with --rule option

Why am I getting "Definition for rule 'import/no-extraneous-dependencies' was not found" when running ESLint?

How to resolve "Definition for rule '@typescript-eslint/rule-name' was not found"

Angular & eslint - Definition for rule '@typescript-eslint/space-infix-ops' was not found

Object Destructuring eslint throws react/prop-types

ESLint: Can "react/sort-prop-types" errors be auto-fixed?

eslint "Definition for rule 'no-explicit-any' was not found" always shown

ESLint Definition for rule 'import/extensions' was not found

Is there an eslint rule to enforce types for useState()?

Why airbnb style guide force eslint rule react/function-component-definition