Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Invalid position given by 'W033' #422

Open
minimaxi-co opened this issue Jun 25, 2017 · 18 comments
Open

Invalid position given by 'W033' #422

minimaxi-co opened this issue Jun 25, 2017 · 18 comments
Labels

Comments

@minimaxi-co
Copy link

JSHint returned a point that did not exist in the document being edited.
Rule: W033
Requested start point: 2025:15

Debug information:

Atom version: 1.19.0-beta1
linter-jshint version: v3.1.4
JSHint version: jshint v2.9.5
Hours since last Atom restart: 0
Platform: darwin
Current file's scopes: [
  "source.js",
  "string.quoted.double.js",
  "punctuation.definition.string.begin.js"
]
linter-jshint configuration: {
  "lintInlineJavaScript": true,
  "executablePath": "",
  "disableWhenNoJshintrcFileInPath": false,
  "scopes": [
    "source.js",
    "source.js-semantic"
  ],
  "jshintFileName": ".jshintrc",
  "jshintignoreFilename": ".jshintignore"
}
@Arcanemagus
Copy link
Member

Is your file indented using tabs?

@minimaxi-co
Copy link
Author

minimaxi-co commented Jun 26, 2017 via email

@Arcanemagus
Copy link
Member

Please follow jshint/jshint#3151 then, this is a known issue with JSHint being broken with almost all files indented using tabs.

@Arcanemagus
Copy link
Member

Reopening this as a tracking issue so future users that update to v3.1.5 will get directed here and see the related JSHint issue.

If anyone is directed here and isn't using tabs to indent your file please file a new issue with a file to reproduce it on the JSHint repo, or file one here and I'll try to help you in getting one filed there where it can be fixed.

@seme1
Copy link

seme1 commented Jul 29, 2017

I'm also suffering from the same error. error is reported in the FIRST line of a javascript file. None of the presented solutions worked. This is so disappointing.

@Arcanemagus Arcanemagus marked this as a duplicate of #469 Jul 29, 2017
@AtomLinter AtomLinter deleted a comment from EthanSK Jul 29, 2017
@Arcanemagus
Copy link
Member

Arcanemagus commented Jul 29, 2017

@ETGgames I've removed your comment as it contributed nothing to the discussion and was simply a cuss filled rant.

In case you don't understand, this problem has nothing to do with the package here, the issue is a bug on JSHint's part.

@Arcanemagus
Copy link
Member

@seme1 The problem is that JSHint has a major bug with any file that is indented with tabs. You can work around this by indenting your files with spaces or switching to a different linter. I would highly recommend ESLint as it is by far the best linter of the dozens that I have worked with.

error is reported in the FIRST line of a javascript file

The entire problem is that JSHint is reporting points that don't exist in the file. Since the points don't exist in the file a range is generated for the entire first line of the file so you can still see that there is a problem.

If you want to help fix the problem please see the linked JSHint issue and help them solve it there so this can get fixed for everyone.

@EthanSK
Copy link

EthanSK commented Jul 29, 2017

Ok, well i'm calmer now because i have switched over to sublime and jshint works well there. Also sublime is a much less buggy ide and is more pleasant to use despite having fewer features. ESlint doesn't work as I want either, in fact, there are no atom packages that lint JS properly. I wasted a full 8 hours yesterday trying.

@Arcanemagus
Copy link
Member

@ETGgames I really don't think you understand this issue at all.

JSHint doesn't work anywhere. If you are indenting with tabs, it is giving you incorrect results, no matter where you are using it. The fact that it's "working" in Sublime just means the author of the integration there isn't telling you that JSHint is giving them invalid results.

If that solution works for you though, I'm glad you have something that works for you!

@NetOpWibby
Copy link

I got this error while editing a file I downloaded from a project. I unindented the entire file, saved, and quit Atom. Started Atom again, indented the file to my liking and saved. This fixed the issue.

@Arcanemagus
Copy link
Member

@NetOperatorWibby There is no fix for this other than using spaces for indentation. jshint is simply broken for any file that is indented with tabs currently until jshint/jshint#3151 is fixed. The above workaround forces jshint to consider tabs to be one character working around the bug with character counts.

@NetOpWibby
Copy link

@Arcanemagus I forgot to mention I prefer spaces to tabs so that explains why my issue was fixed. Welp.

JanDW pushed a commit to JanDW/ccsp-ui that referenced this issue Aug 8, 2019
- To circumvent this JSHINT issue AtomLinter/linter-jshint#422
Apparently, it doesn't like tab indentation. Boo!
@yeldarby
Copy link

yeldarby commented Nov 7, 2020

I don't know if this is still bugging anyone else but after 3 years I finally couldn't stand it anymore.

There's been a PR open here for 2 years that fixes jshint/jshint#3151 but hasn't been merged into jshint: jshint/jshint#3274

I cloned that fork to my local machine, pulled in the changes from upstream, merged the conflicts (they were all fine), and rebuilt the binary:

git clone https://github.com/tzvipm/jshint
git remote add upstream git@github.com:jshint/jshint.git
git fetch upstream
git stash
git merge upstream/master
git mergetool --tool=opendiff
npm run build

Then in linter-jshint's settings I set the Executable Path of jshint to the newly built binary which resides at /path/you/cloned/to/jshint/bin/jshint.

image

And that fixed the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants