New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tab indentation breaks multiple rules #3151
Comments
Thanks for the report! The problem stems from line 1610 of
This seems pretty fundamental to how many of the style-related linting rules are implemented. Those have been deprecated for some time now, but we're still not ready to move on a new major version. So in the mean time, we'll need to design a solution that preserves that behavior. My initial thought is to track this "effective offset" as a new property of the token object named Does that sound good to you, @Arcanemagus? |
That sounds perfect to me, at least on the surface with no real knowledge of JSHint's internals 😛. Ideally I just need some method of getting the true column count (where each code point counts as one column). This was hidden for a while due to this warning essentially being ignored due to a workaround for some old parser bug with a semi-common error. When I re-implemented the warning to users in a much nicer manner I had accidentally hidden them, and just recently fixed it making this visible again. |
Looks like |
I got some time to do some digging today, and I believe setting the @Arcanemagus Are you able to over-ride the value of the |
Hmmm, currently this project uses the CLI interface it looks like. It's possible to rewrite it to use the Node.js API which would make that possible.
|
How about adding a command line argument that allows to override values from the configuration?
|
Does anyone know what version this was introduced in? 2.9.5? At least then we could downgrade for the moment as a temp. fix. |
@jaredatch Back in AtomLinter/linter-jshint#386 (released in v3.1.0 of There may be a "sweet spot" before this tab bug was introduced and after the major parser bugs that caused those workarounds to be put in place in the first place. |
@Arcanemagus gotcha, really appreciate the insight. Keep up the great work 👍 |
If you have a better / more useful message idea for how |
Looks like we're at at least 40 different rules affected by this bug now 😛. |
Any updates on this, it's some months since I'm having this errors, driving me nuts :) |
Hi @xcrap! I just checked the comment thread, and it doesn't look like anyone has posted any updates. The good news is that JSHint is an open source project, so you can help fix the problem if it's causing you stress! Would you like to lend a hand? I'd be happy to advise you. |
@jugglinmike I wish! I always try in tiny projects but my js skills are super basic and limited :) |
I placed a $50 bounty on this bug, others can contribute to increase the bounty via this link: https://www.bountysource.com/issues/46533252-tab-indentation-breaks-multiple-rules |
By tracking the column number both with and without soft tabs, we enable better messages for errors and warnings. This is especially useful for editor linting integrations. Fixed jshint#3151
By tracking the column number both with and without soft tabs, we enable better messages for errors and warnings. This is especially useful for editor linting integrations. Fixed jshint#3151
By tracking the column number both with and without soft tabs, we enable better messages for errors and warnings. This is especially useful for editor linting integrations. Fixed jshint#3151
By tracking the column number both with and without soft tabs, we enable better messages for errors and warnings. This is especially useful for editor linting integrations. Fixed jshint#3151
By tracking the column number both with and without soft tabs, we enable better messages for errors and warnings. This is especially useful for editor linting integrations. Fixed jshint#3151
Pulling in @TzviPM's fork locally and rebuilding jshint worked to fix the issue for me if anyone else is stumbling across this:
|
It seems that indentation using tabs breaks the position reported by at least 3 rules, likely more.
All of the following was linted using this
.jshintrc
file:The JSHint version tested is v2.9.5.
If you want me to refile these as separate issues I can do that as well.
W032
If you lint this code:
There is an error reported on line 4, col 6, but line 4 only has 4 characters in it.
W098
If you lint this code:
There is an error reported on line 4, col 9, but line 4 only has 7 characters in it.
W117
If you lint this code:
There is an error reported on line 5, col 13, but line 4 only has 11 characters in it.
The character position reported seems to go further and further out the more tabs there are at the beginning of the line in question.
Raw files can be found here: linter-jshint_GH416.zip
Originally discovered while investigating AtomLinter/linter-jshint#416.
Rules known to be affected:
W009
W014
E015
W024
W027
W030
W032
W033
W040
W043
W069
W075
W098
W116
W119
W140
E041
The text was updated successfully, but these errors were encountered: