162

I just updated Visual Studio 2017 from RC to final. I didn’t get the following error but recently I get this error. In building the project, I get the following error and it prevents the web project to start:

Severity    Code    Description Project File    Line    Suppression State
Error   eqeqeq  (ESLint) Expected '===' and instead saw '=='.   VistaBest.Shop.Web  C:\***\Request.js   21

JavaScript Error

How can I disable JavaScript building error in Visual Studio 2017?

7
  • 28
    It's not my code problem, I want to use '==' instead of '===' in my JavaScript code Commented Mar 10, 2017 at 17:58
  • 9
    JavaScript error not should prevent building MVC project in Visual Studio Commented Mar 10, 2017 at 17:59
  • Either share your code, or disable the javascript error message - read this: stackoverflow.com/questions/2125455/…
    – Koby Douek
    Commented Mar 10, 2017 at 18:01
  • 14
    @Koby Douek: It's not my code problem, I don't want to build error for JavaScript file in Visual Studio Commented Mar 10, 2017 at 18:59
  • 3
    I would particularly be interested in disabling this specific error. == is as valid a comparison operator as '==='. For me it doesn't prevent me from building, it just clutters up the error list when I have another error in my server code.
    – xr280xr
    Commented Sep 27, 2017 at 21:09

7 Answers 7

297

I think, find the solution:

  1. Open Tools > Options
  2. Navigate to Text Editor > JavaScript/TypeScript > EsLint (in VS2017 15.8 it is Linting not EsLint)
  3. Set Enable ESLint to False

Disable ESlint

Visual Studio >= 15.8.5 Disable ESlint Visual Studio 15.8.5

5
  • 2
    Worked for me in VS2017 Commented Sep 1, 2017 at 9:56
  • 3
    quick tip: the text box on the top left in screenshot can be used to search for any setting/option easily! Commented Jan 23, 2018 at 1:28
  • 6
    This didn't exactly work quite the same way in 15.8.0 - it's hidden under Linting>General Searching for eslint will still bring it up, but it will be labeled linting. See @Brad's answer below.
    – ahwm
    Commented Aug 20, 2018 at 19:54
  • 1
    This feature automatically started to work after the update to VS 2017 15.8.1. I had to turn it off again manually. Commented Aug 21, 2018 at 13:25
  • 1
    Thanks! That was pissing me off. For version 15.8.5 is just a checkbox now. Commented Oct 9, 2018 at 15:28
43

In Visual Studio 2017 (v 15.8.0):

Option 1: Options > JS Errors

  1. Open Tools > Options
  2. Navigate to Text Editor > JavaScript/TypeScript > Code Validation
  3. Set Enable JavaScript errors to false
  4. or, set Enable JavaScript errors to true and Show errors as warnings to true

I needed to restart Visual Studio for this to take effect.

Options > JS Errors

Option 2: Options > Linting

There is another option below which will let you edit your global linting settings:

Options > JS Linting

Option 3: .eslint file

You can also create a file named .eslintrc in the root of your project.

Option 4: ESLint commands in-file

See @user9153924's answer


Resources

16

I tried Mohammad`s solution but it didn't work. I managed to work doing the following:

  1. Righ click on your web .csproj file
  2. On the first <PropertyGroup> add the following entry: <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
1
  • 4
    I think you missed a couple steps there. Did you mean right click your web .csproj, unload project, right click it again, edit?
    – xr280xr
    Commented Sep 27, 2017 at 21:07
11

Add /*eslint eqeqeq: ["error", "smart"]*/ to the first line of your Javascript code to remove the errors. https://eslint.org/docs/rules/eqeqeq

Following Mohammad's solution will turn off ESLint for syntax checking. This works in VS2015 and should work in later versions.

2
  • Perfect & doesn't throw the baby out with the bathwater
    – ShrapNull
    Commented Apr 8, 2018 at 8:27
  • Thank you! This worked, but I am pretty sure that "error" should be "off" or 0 (zero, no quotes). I also got a package.json file to work thanks to the URL reference.
    – Stan
    Commented May 20, 2018 at 3:13
4

For Visual Studio 2019.

enter image description here

  1. Open Tools > Options
  2. Navigate to Text Editor > JavaScript/TypeScript
  3. => Linting > General.

Then unchecked ESLint check box. Please The bellow Image for reference.

enter image description here

3

I've just had to change the "eqeqeq" rule behaviour to include "smart":

Edit the .eslintrc file found in your user root folder mentioned in other answers already.

The change is made to the rules section by adding the smart rule

    "rules": {

    "eqeqeq": [2, "smart"],

Copied from the web article: This option enforces the use of === and !== except for these cases:

  1. Comparing two literal values
  2. Evaluating the value of typeof
  3. Comparing against null

I found the specifics at: https://eslint.org/docs/2.0.0/rules/eqeqeq

1
  • Thank you! I had to close and reopen Visual Studio for the change to take effect. Also, adding in the "smart" parameter didn't seem to clear the error in all cases, however removing the rule altogether did the trick.
    – zax
    Commented Feb 22, 2020 at 19:49
0

I tried Mohammad's solution but with no luck, I followed Rafeel answer and instead of adding his suggested code sample I removed below code from web .csproj and finally I was able to build and run my project. There were two places where you should remove that in the same file. Still, I don't have any clue how the removed code will affect my solution.

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />

Hope this will also help someone to save the day..!!!

Not the answer you're looking for? Browse other questions tagged or ask your own question.