jshint

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

我只是一个虾纸丫 提交于 2019-12-03 06:10:18
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/UI/**/*.js"], options: { undef: true, mocha: true, node: true, jshintrc: true, esversion: 6, globals: {

webpack3 jshint-loader does not work

☆樱花仙子☆ 提交于 2019-12-03 05:45:19
I'm trying to follow this instruction https://webpack.js.org/loaders/jshint-loader/ and get an error: My config file: const path = require('path'); module.exports = { entry: { app: './index.js' }, output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist') }, module: { rules: [ { test: /\.js$/, // include .js files enforce: "pre", // preload the jshint loader exclude: /node_modules/, // exclude any and all files in the node_modules folder use: [ { loader: "jshint-loader" } ] } ] }, // more options in the optional jshint object jshint: { // any jshint option http://www.jshint.com

AngularJS controllers and “use strict”

别来无恙 提交于 2019-12-03 05:36:45
问题 I recently started using JSHint and it is requiring me to use the function form of "use strict". Since then, AngularJS throws an error: "Error: Argument 'webAddressController' is not a function, got undefined" When I remove the function form of "use strict" the controller loads fine. Controller: (function () { "use strict"; function webAddressController($scope, $rootScope, web_address_service) { // Do things } }()); Does anyone have any insight on what's going on here? 回答1: First off, I want

Disable JSHint warning: Expected an assignment or function call and instead saw an expression [duplicate]

半城伤御伤魂 提交于 2019-12-03 05:34:08
问题 This question already has answers here : Expected an assignment or function call and instead saw an expression (4 answers) Why does jshint not recognize an assignment as an expression? (8 answers) Closed 4 years ago . I have the following line: imageUrl && (data.imageUrl = imageUrl); For this line, JSHint complains: Expected an assignment or function call and instead saw an expression. I understand the warning, but I want to disable it. I can’t find the way how to do it. Any idea? 回答1: If it

How can I check JavaScript code for syntax errors ONLY from the command line?

寵の児 提交于 2019-12-03 05:26:15
问题 JavaScript programs can be checked for errors in IDEs or using online web apps but I'm looking for a way to detect syntax errors alone . I've tried JSLint and JSHint and looked at their options but I haven't been able to find a combination that would exclude warnings and just shows the syntax errors. How do I check JavaScript code for syntax errors only from the command line? 回答1: I use acorn: $ acorn --silent tests/files/js-error.js; echo $? Unexpected token (1:14) 1 $ acorn --silent tests

How to configure Syntastic with JSHint?

自古美人都是妖i 提交于 2019-12-03 04:54:14
问题 How to use the Syntastic Vim plugin with JSHint to validate JavaScript code? Environment: Ubuntu 11.04 VIM - Vi IMproved 7.3 What I have installed, following the solution at VIM + JSLint?: Vundle node.js Node Package Manager jshint, globally Syntastic installed through Vundle (Used the :BundleInstall command inside Vim to make sure Syntastic was installed.) .vimrc: set nocompatible " be iMproved filetype off " required! set rtp+=~/.vim/bundle/vundle/ call vundle#rc() " let Vundle manage

Adobe Brackets disable jslint but allow jshint

点点圈 提交于 2019-12-03 04:31:03
问题 My basic question: In the Adobe Brackets editor how do I use jshint while turning off or disabling jslint? My tl;dr: When linting javascript in the Adobe Brackets editor I find that I get results for both jslint and jshint. While I have jshint configured to my liking I can never avoid the warning symbol that appears indicating I have failed to pass jslint so it always looks like there are problems with my linting. I only want to use jshint as the ability to globally configure it via the

How do I configure jshint to not give me the error “Bad line breaking before”?

一曲冷凌霜 提交于 2019-12-03 04:17:50
It's giving me the error "Bad line breaking before ','" because I have code like the following var one = 1 , two = 2 , three = 3 ; If I put the , at the end of the line instead of the beginning of the next, it doesn't complain. But I want to code this way. Is there a way I can make it not show this warning? I looked though JSHint's options but there isn't anything pertaining to this error. zappan As mentioned in the comments of the laxbreak answer, laxcomma option should actually be used for this particular situation (it has been implemented in the meantime). See http://jshint.com/docs/options

Where can I find a list of JSHint numeric error codes?

天涯浪子 提交于 2019-12-03 04:06:58
问题 I'm using JSHint for Visual Studio. It's not uncommon for JSHint to issue a warning about an issue that I know it safe to ignore. I have been putting // ignore jslint on the relevant line, but I see that we can also ignore specific error codes. From the 1.0.0 rc1 release notes: This version adds a unique numeric code to every warning and error message produced by JSHint. That means that you can now ignore any warning produced by JSHint even when there is no corresponding option for it. You

Expressions in JavaScript Ternary Operator and JSLint

不问归期 提交于 2019-12-03 01:22:06
I recently received a comment on one of my blog posts about JSLint asking why JSLint threw an error with the following: s === "test" ? MyFunc() : MyFunc2(); The error generated was: "Expected an assignment or function call and instead saw an expression." Clearly JSLint is expecting an assignment here, somthing more like: var y = (s === "test") ? MyFunc() : MyFunc2(); But, I don't really see the problem with the first example. Is it really the case that ternary operators should only be used for assignments? I couldn't see anything on JSLint.com , nor was there anything apparent in the book