microsoft / vscode-jshint

VSCode extension to integrate jshint into VSCode
https://marketplace.visualstudio.com/items?itemName=dbaeumer.jshint
MIT License
72 stars 58 forks source link

globals attribute in package.json not recognized by JSHint #68

Closed s3anmorrow closed 5 years ago

s3anmorrow commented 5 years ago

Love this extension - have my entire group of students using it.

But the globals attribute in package.json doesn't seem to be working: "jshintConfig": { "esversion": 6, "strict": "implied", "browser": true, "devel": true, "node": true, "globals": { "Headers": true } Headers will still be flagged by JSHint as undefined

/ globals Headers / at top is a workaround (or including a .jshintrc) Am I overlooking something?

Thanks in advance!

RMacfarlane commented 5 years ago

That config looks right to me. Can you open the output panel is VSCode and select jshint from the dropdown and paste any text from there?

screen shot 2019-02-12 at 9 29 50 am
s3anmorrow commented 5 years ago

Sure thing - jshint certainly is reading from package.json... but globals seems to be ignored, maybe?

screen shot 2019-02-12 at 1 41 19 pm

Any other thoughts? Thanks in advance!

RMacfarlane commented 5 years ago

Hmm. What version of jshint are you using? Could you also include the error message you're seeing for Headers?

s3anmorrow commented 5 years ago

Version: jshint@2.10.1 Error message - 'Headers' is not defined. (W117) Never had a problem when using .jshintrc :(

package.json:

{ "name": "sass-babel-with-gulp-nscc", "version": "1.0.0", "description": "Starter template for an ES2015 app implementing Sass/Babel and Gulp", "main": "app.js", "author": "Sean Morrow / NSCC Truro Campus", "license": "", "dependencies": {}, "devDependencies": { "gulp": "^3.9.1", "gulp-concat": "^2.6.0", "gulp-sass": "^3.1.0", "gulp-sourcemaps": "^2.6.0", "merge-stream": "^1.0.0", "babelify": "^7.3.0", "babel-core": "^6.26.3", "babel-preset-env": "^1.7.0", "browserify": "^12.0.2", "vinyl-buffer": "^1.0.0", "vinyl-source-stream": "^1.1.0", "gulp-webserver": "^0.9.1" }, "browserify": { "transform": [ [ "babelify", { "presets": [ "env" ] } ] ] }, "jshintConfig": { "esversion": 6, "strict": "implied", "browser": true, "devel": true, "node": true, "globals": { "Headers": false
} } }

RMacfarlane commented 5 years ago

Sorry for the delay in looking at this!

I think the issue is that the extension isn't listening for updates to the package.json file. I see the same error when I add something to globals for the first time, but not after reloading VSCode. The extension does correctly listen for changes to .jshintrc files.

Thanks for catching this, I'll prepare a fix!

s3anmorrow commented 5 years ago

Awesome – glad I could help! Thanks Rachel :)

Sean Morrow Faculty IT Web Programming / Game Development Nova Scotia Community College 902.893.7891 @s3anmorrow www.seanmorrow.ca

From: Rachel Macfarlane notifications@github.com Reply-To: Microsoft/vscode-jshint reply@reply.github.com Date: Friday, February 22, 2019 at 7:38 PM To: Microsoft/vscode-jshint vscode-jshint@noreply.github.com Cc: Sean Patrick Morrow Sean.Morrow@nscc.ca, Author author@noreply.github.com Subject: Re: [Microsoft/vscode-jshint] globals attribute in package.json not recognized by JSHint (#68)

Sorry for the delay in looking at this!

I think the issue is that the extension isn't listening for updates to the package.json file. I see the same error when I add something to globals for the first time, but not after reloading VSCode. The extension does correctly listen for changes to .jshintrc files.

Thanks for catching this, I'll prepare a fix!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Microsoft/vscode-jshint/issues/68#issuecomment-466585917, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFSHvmCwhCc7GpXFuRFwtE7eSgU7pjctks5vQH9wgaJpZM4a0DVX.