Giter Site home page Giter Site logo

Comments (11)

dascritch avatar dascritch commented on July 28, 2024

I wrote about this to Mr Crockford. He responded me this:
«Those are all bad practices. JSLint is trying to help you, if you will let it.»

So no, i don't think this is configurable yet ;)

from jshint.

GarrettS avatar GarrettS commented on July 28, 2024

why would you ever want to allow tabs and spaces together? I've always hated that so much.

from jshint.

knbknb avatar knbknb commented on July 28, 2024

In my personal development workflow, I tolerate mixed spaces and tabs, because:

When I am done, or about to commit to SVN/git, I send the javascript code through a pretty-printer, (v8 for example has a commandline option for this), which turns tabs into spaces. However, I much more often run my JS code through JSlint, which produces lots of these mixed-space-and-tabs warnings which I find so distracting. This output turns attention away from other issues which are more important (superfluous trailing commas for instance).

In any case, this was just a whishlist feature, or enhancement request, that came to mind after I read about this project on hacker news.

from jshint.

GarrettS avatar GarrettS commented on July 28, 2024

I understand you asked for the option but to me, mixing TAB and space sounds like a really bad option. I still don't see why y9ou mix TAB with space?

Mixing is a problem because many editors' TAB width is four spaces sometimes it is 8 spaces or or otherwise. Autoformatters may convert TAB to a certain number of spaces, too, e.g. 2, 4, 8, or even 3.

When TAB and space are mixed, what looks good in one editor usually will look improperly indented in another.

from jshint.

knbknb avatar knbknb commented on July 28, 2024

I don't mix tab and space deliberately, but it just happens, e.g when I indent a selection blockwise (Shift+Tab in eclipse) .

It is reported as an error. Error messages should be reserved for something causing really serious trouble. Mixed spaces and tabs aren't errors; I consider this a warning at best.

from jshint.

GarrettS avatar GarrettS commented on July 28, 2024

Eclipse, yah, there is definitely a way to change TAB so that it indends with spaces but it depends on which JS editor you use. I'll show you how the built-in one works. Launching eclipse, that'll take a couple mins...

window > preferences
. > General > Editors > File Associations... ".js" --> JavaScript Editor (default)

Next:
. > JavaScript > Code Style > Formatter > Edit... "Tab Policy: Spaces only"

Next:
. > JavaScript > Editor > Typing, checkbox: [*] Tab key adjusts the indentation of the current line.

from jshint.

derekdata avatar derekdata commented on July 28, 2024

This should be a warning instead of an error, as to the best of my knowledge it does not impact the execution of the code.

JSHint should focus on things that break the code, not on codestyle issues. Otherwise we might as well just use JSLint

from jshint.

timmywil avatar timmywil commented on July 28, 2024

Maybe this common comment banner could be an exception to the tabs/spaces rule:

function foo() {
    /**
TAB  * @private
TAB  */
    function bar() {
        // something
    }
}

from jshint.

 avatar commented on July 28, 2024

I've just hit exactly the same thing as timmywil notes. I'm getting hundreds of errors just because I like the 's in my comments to line up. I'd say an exception to the rule should be something like "\t? *".

from jshint.

 avatar commented on July 28, 2024

Just hit an extension to this issue as well - my comments are being flagged up for having tailing white space when I've got something like:

*{space}

Might it be possible to not check tailing white space in comments?

from jshint.

timmywil avatar timmywil commented on July 28, 2024

Reason for closing?

from jshint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.