jshint

How do you configure JSHint options globally in Sublime Text 2?

拟墨画扇 提交于 2019-12-04 17:00:15
问题 I'd like to turn off particular warnings globally when using Sublime Text 2's JSHint plugin. For instance, "laxcomma". I tried editing the .jshintrc file in JSHint's Sublime Packages folder, but this did not work. { "laxcomma": true } Adding a project specific .jshintrc file with the same options solves the issue for that particular project, but I would like these options to be global. Any suggestions? 回答1: From the JSHint docs page: http://www.jshint.com/docs/ JSHint will look for this file

Cant make gulp-notify to pop up a error message when gulp-jshint fail

梦想与她 提交于 2019-12-04 12:08:57
So, was the whole day working on our new FE workflow, the main idea is to run a few tasks through a watcher, we will have our IDE's and a window with the browsers getting refreshed each time something change (scss, js, html, etc). So, we wont see nothing if all went good: the browser will get reload and we will keep working. But, we want to use gulp notify for errors, so in case we have something wrong, the notifier pop up will appear, and at that point, you can check the console and see the error. Example for our sass task when fail: For our styles tasks, everything works fine, but Im not

arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6')

情到浓时终转凉″ 提交于 2019-12-04 10:14:09
问题 Currently I'm running my tests with protractor/grunt but I'm getting the follow error message: 'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6'). I think my .jshintrc file is not being read, because I've added this condition. .jshintrc { "esversion": 6 } Gruntfile.js jshint : { all: ["tests/API/**/*.js"], options: { undef: true, mocha: true, node: true, jshintrc: true, esversion: 6, globals: { require: true, module: true, console: true, esversion: 6, } }, ui: ["tests

Running grunt-contrib-jshint only on recently modified files

橙三吉。 提交于 2019-12-04 09:08:21
We're going through refactoring the code on a very large site. I would like to enforce linting on any files that get changed, but ignore the rest (as many of them will end up being removed so it's a waste of time to tidy them up). I would like to have a grunt task that checks that a file's modified date is more recent than its created (*fetched from repo) date and lints it if this is the case (would be good also to have grunt update a json list of files to be linted). I haven't used node much apart from grunt and its plugins. I'm going to use http://gruntjs.com/creating-tasks as a starting

Suppress `Expected an identifier and instead saw 'default' (a reserved word)` in JSLint with Mongoose

五迷三道 提交于 2019-12-04 06:26:51
I'm using jshint to validate my JavaScript files. On the server-side I'm using node.js with Mongoose. In Mongoose I'm encouraged to write schemata in a fashion like: var UserSchema = new mongoose.Schema({ firstname : { type: String, default: '' } }); When running linting, I get error: Expected an identifier and instead saw 'default' (a reserved word). Is there a way to suppress this error? I really would prefer that behaviour instead of writing: var UserSchema = new mongoose.Schema({ firstname : { type: String, "default": '' } }); You can also use the "es5" option to disable this from

Is there an easy way to integrate jshint with netbeans?

廉价感情. 提交于 2019-12-04 06:26:01
Searched the net for a jshint plugin for netbeans, but found none... Can anyone describe or show an easy solution for jshint integration in netbeans? There is no good plugin for netbeans. Install node, use grunt and start rocking! :) I think this may work for you: jshint Netbeans has two plugins for Javascript code quality. JSHist : It is relatively new, It was added on Dic-2013 Only supports version 7.4 of Netbeans and JSLint : It seems that is working as plugin since a while, It was added on Nov-2011 and the last updated was on Oct-2013. Supports versions 7.4, 7.3, 7.2, 7.0 of Netbeans. It

JSHint and eclipse plugin

妖精的绣舞 提交于 2019-12-04 05:21:44
So I just installed JSHint in Eclipse Kepler I loaded my .jshintrc file . How do I run jshint on my javascript files? I do not see a menu item nor a place to specify filenames, etc... Can someone help? After adding a .jshintrc file to the root of the project you need to: Right-click on your project in the Project Explorer view -> properties -> JSHint -> Configuration -> Check enable. Also select the folders containing your js files (use slashes in the path). I split my js files into two folders custom and external and only check on custom (and all subfolders of custom). VonC As mentioned in

JSHint won't let me use 'forEach' in a 'for' loop

淺唱寂寞╮ 提交于 2019-12-04 02:30:15
I have an object with arrays as values. people = { 'steve':['foo','bar'], 'joe':['baz','boo'] } For each key, I would like to loop over the values in the corresponding array. Simple enough: for ( var person in people ) { person.forEach( function(item) { console.log(item) }) } But JSHint complains: Don't make functions within a loop. Is this truly an issue with my code? I quite like the short ES5 for loop syntax. Do I need to use the ES3 style or change my code in some other way? T.J. Crowder There are two issues there, the one that JSHint is warning you about, and a more fundamental one. The

Sublime Text 3 SublimeLinter plugin not able to find jshint

六眼飞鱼酱① 提交于 2019-12-04 01:56:20
For some reason, SublimeLinter3, or the SublimeLinter3 JSHint linter plugin, seems unable to parse the PATH environment variable and is thus unable to run jshint : SublimeLinter: Could not parse shell PATH output: <empty> error: SublimeLinter could not determine your shell PATH. It is unlikely that any linters will work. Please see the troubleshooting guide for info on how to debug PATH problems. SublimeLinter: WARNING: jshint deactivated, cannot locate 'jshint' Can't connect Unable to fetch update url contents The jshint binary is in the PATH , however: $ which jshint /home/path/to/bin/jshint

Extending jshint with custom checks

醉酒当歌 提交于 2019-12-04 01:29:06
In the Python world there are multiple static code analysis tools that can be easily extended with custom checks via writing plugins or extensions , for example: pylint flake8 In the JavaScript world, as far as I understand, jshint is the number one tool for static code analysis. I've been using it for a while and it definitely helps to find lots of code style violations, but, recently, I've encountered the need to extend jshint with a custom check. How can I do that? Is it extendable? I've looked through the documentation and the only thing I've found is how to write a custom reporter which