Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8996593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:46:30+00:00 2026-06-15T23:46:30+00:00

Problem I have made a sample JavaScript file to illustrate my confusion. (function() {

  • 0

Problem

I have made a sample JavaScript file to illustrate my confusion.

(function() { console.log(true == true); })()

This should trip two errors; first the use of == instead of ===, and second, a missing semicolon. However, when I run

var jshint = require('jshint').JSHINT;
jshint('(function() { console.log(true == true); })()');

on in the Node REPL I get errors when I don’t expect to. The reason I expect no errors is because in the JSHint documents, it says:

The second parameter [to jshint] is an optional object of options which control
the operation of JSHINT. Most of the options are booleans: They are
all optional and have a default value of false.

I would expect this to produce no errors as I’ve defined no options so all should be false. The final part of unexpected behavior is that setting options seems to do nothing. The following two calls to jshint also produce the same errors:

var myFile = '(function() { console.log(true == true); })()';
jshint(myFile, {eqeqeq: false, asi: false});
jshint('/*jshint eqeqeq:false, asi:false */\n' + myFile);

Question

I’m not sure how the JSHint options work and I very well may be misinterpreting the documentation. I’d appreciate knowing what in either my invocation of jshint above or in my assumptions is incorrect or if there actually is a problem with JSHint.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:46:31+00:00Added an answer on June 15, 2026 at 11:46 pm

    Not all options are off by default. In our docs (http://www.jshint.com/docs/) you can see that some options are ‘enforcing’ and some ‘relaxing'[1]. This means that some warnings will be displayed by default and you need to enable ‘relaxing’ option to turn them off.

    Now, with this information, let’s look at your second question:

    /*jshint eqeqeq:false, asi:false */
    (function () { console.log(true == true); })()
    

    This code will trigger an unsafe comparison warning for == true and a missing semicolon. You tried to fix that by turning off two options eqeqeq and asi. The former, when set to true, requires strict comparison everywhere and is turned off by default so you can omit it. You get a warning because JSHint considers == true/false/0/null comparisons unsafe and currently there is no way to turn that off (there won’t be warning for a == b for example)[2]. And the latter option (asi) is a relaxing option so you actually need to turn it on to tell JSHint that it’s okay to tolerate missing semicolons. So to make your example pass you will need to change it this way:

    /*jshint asi:true */
    (function () { console.log(true === true); }()
    

    [1] — I understand that this is confusing. Because of backwards compatibility I can’t just change how options work but I’m working towards making it less confusing. I will add default values for each option to the docs soon-ish.

    [2] — The upcoming 1.0.0 release will allow you to ignore any warnings by their code, even if there’s no corresponding named option.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem creating and executing a JAR file. I have already made
I have made a very simple AppleScript to close tabs in Safari. The problem
Problem: Have made a small mail program which works perfectly on my developer pc
I have made a swings application but there is one problem in that which
I have a weird problem with my mysql query syntax. I have made a
I have come across an annoying problem. I have made a system and now
So I have a bit of a performance problem. I have made a java
I have already made an algorithm for the problem but it still got a
Here's my problem: I have an unmanaged dll that I made.I'm calling one of
I have a problem with my self-made search page. There is 2 tables: **name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.