Comments (11)
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.
why would you ever want to allow tabs and spaces together? I've always hated that so much.
from jshint.
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.
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.
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.
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.
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.
Maybe this common comment banner could be an exception to the tabs/spaces rule:
function foo() {
/**
TAB * @private
TAB */
function bar() {
// something
}
}
from jshint.
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.
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.
Reason for closing?
from jshint.
Related Issues (20)
- Getting errors while adding as dev-dependancy HOT 1
- JSHint doesn't recognize bitwise operators like & | >> etc... HOT 2
- is there any kind of way to get the console log outputs using this tool? HOT 1
- can i customize the error messages generated by JSHINT? is there any locale files i can override? HOT 1
- Not work in VS Code's Terminal HOT 1
- 'fetch' is not defined. (W117) - Although it is a base feature of Node 18 (although experimental) HOT 3
- Error: JSHINT is not defined HOT 2
- False error on static property HOT 1
- W080 incorrect message for initializing const with undefined HOT 2
- jshint doesn't expect regexp literals in one-liners following if/while/for conditions, and also else HOT 3
- `jshint` breaks on experimental feature `import * as file_json from 'file.json' assert { 'type': 'json' };` HOT 11
- JShint in VScode HOT 1
- If variable is assigned but never used it should cause warning HOT 1
- esversion beyond 11 HOT 2
- Generate error on specific object properties HOT 1
- jshint 2.13.6 is not warning me about mixing tabs and spaces HOT 1
- No warnings about undefined variable when doing typeof yyy
- VSCode HOT 1
- Jshint doest trigger hint when access non exist property of an object HOT 1
- "Invalid regular expression" when /s flag is used on long RegExps
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jshint.