jshint

Is there an easy way to integrate jshint with netbeans?

南笙酒味 提交于 2019-12-06 02:06:14
问题 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? 回答1: There is no good plugin for netbeans. Install node, use grunt and start rocking! :) 回答2: I think this may work for you: jshint 回答3: 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,

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

僤鯓⒐⒋嵵緔 提交于 2019-12-05 15:48:53
问题 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? 回答1: There

Detecting typos in JavaScript code

纵然是瞬间 提交于 2019-12-05 11:51:09
In Python world, one of the most widely-used static code analysis tools, pylint has a special check , that detects typos in comments and docstrings. Is there a way to detect typos in JavaScript code using static code analysis? To make the question more specific, here is an example code I want to cause a warning: // enter credntials and log in scope.loginPage.logIn(browser.params.regularUser.login, browser.params.regularUser.password); Here credntials is misspelled. There is a eslint plugin built specifically for the task - eslint-plugin-spellcheck : eslint plugin to spell check words on

How to run JSHint on files with Django template markup in them?

ⅰ亾dé卋堺 提交于 2019-12-05 10:44:22
I would like to run JSHint on all my Javascript source files but several of them have some embedded Django template markup. JSHint throws a ton of errors on this markup. Is there a way to either... Tell JSHint to ignore this markup Run the Djnago template parser with some dummy data to generate all permutations of the rendered js file and then run JSHint on that? I assume I could write a bunch of code to do #2 but i'm wondering if there's an easier way. Depending on a markup you can get away with "hiding" Django markup with JavaScript comments. We do this, for example: // {% if cond %}

grunt-contrib-jshint ignores has no effect

▼魔方 西西 提交于 2019-12-05 08:50:34
问题 I would like to exclude libs directory from being lint'ed. However, ignores in options and planted .jshintignore file in project directory won't make libs to be excluded. jshint: { options: { smarttabs: true, ignores: ['public/js/libs/**/*.js'] }, all: [ 'Gruntfile.js', 'public/js/**/*.js' ] }, grunt version: grunt-cli v0.1.11 grunt v0.4.2 grunt-contrib-jshint@0.7.2 What did I miss out? 回答1: ignores is a jshint option and expects specific files. It's better to use the idiomatic Grunt negate !

Cannot use GLOB with JSHint in Windows?

偶尔善良 提交于 2019-12-05 08:02:05
I'm doing a PoC of NPM as a build tool ( http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/ ). I'm fairly new using NPM. For now, I only have JSHint and Mocha installed. My packagae.json is attached. Now, when I run "npm run lint" in the command line (Windows 7), it gives me an error: c:\project>npm run list MyNPMProject@1.0.0 lint c:\project jshint test/*.js ERROR: Can't open test/*.js It works when I change the script "lint": "jshint test/test.js". Can I use glob with jshint? Please advise and thank you in advanced. You shouldn't need the glob, just give it the directory and it

This function has too many statements. (41)

旧时模样 提交于 2019-12-05 07:48:19
I have this controller .controller('ctrl', function($scope, $rootScope, $timeout, $alert, $location, $tooltip, $popover, BetSlipFactory, AccordionsFactory, AuthFactory, RiskWinCalculations) {...}); and, I am getting this error due to jshint : line 10 col 44 This function has too many statements. (41) so, what should I do to avoid it ? Reacting It doesn't mean poorly managed code as @pankajparkar says before, it could be because you have something like this, lets say this from one of my projects: $scope.betLoader = false; $scope.showIfbetAlerts = true; $scope.displayStraight = true; $scope

How can I force JSHint running in grunt to always use the --verbose flag

一笑奈何 提交于 2019-12-05 06:00:15
I have a particular JSHint/Grunt setup in which I would like to accomplish the following: Load from a single .jshintrc file to allow my IDE linter to pick up my settings Be able to override single options from the .jshintrc in other grunt tasks Have JSHint always run in verbose mode so that I can always see the warning numbers, without needing to run all of grunt with --verbose The following allows me to load from the .jshintrc and always run in verbose, but does not allow option overrides. The docs mention that this should be the case, but don't say anything about the verbose option, which

How do I pass global config to jshint?

我们两清 提交于 2019-12-05 00:53:54
How do I pass global config to jshint? I didn't find the answer in the documentation. My config file: >type tests\jshint_options.js /*jshint globalstrict:true */ This is what I've tried so far: >jshint myfile.js --config=tests\jshint_options.js myfile.js: line 1, col 1, Use the function form of "use strict". myfile.js: line 4, col 24, Unescaped '['. myfile.js: line 4, col 49, Unescaped '['. 3 errors >jshint myfile.js --config tests\jshint_options.js node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ SyntaxError: Unexpected end of input at Object.parse (native) at

Complete list of default values for JSHint options?

*爱你&永不变心* 提交于 2019-12-04 23:37:46
Where can I get the complete list of JSHint default options. I tried searching online but couldn't find anything. EDIT: I mean a list of default values for all options, in case it wasn't clear :) Mikhail Chernykh You can look on boolOptions , valOptions and invertedOptions objects directly in jshint sources: https://github.com/jshint/jshint/blob/master/examples/.jshintrc If you are confused with comments, you can refer to options section in jshint help: http://jshint.com/docs/options/ J.D. Actually, that page contains the list of default options, and that file mentioned in @netme's answer has