How to use 'jshint es6' in JavaScript

Every line of 'jshint es6' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
20function execJshint( fileName, options ){
21 var source = fs.readFileSync(fileName,'utf8');
22 var shortFileName = fileName.replace(path.join(modulePath, 'dist', '_'), '');
23 var options = options || {
24 globalstrict: true,
25 globals: {
26 "require": false,
27 "module": false,
28 "console": false,
29 "__dirname": false,
30 "process": false,
31 "exports": false
32 }
33 }
34 //console.log(options)
35 JSHINT(source, options);
36 var data = JSHINT.data();
37 //console.log(data)
38 if( data.errors && data.errors.length ){
39 hasErr = true;
40 $.util.log($.util.colors.cyan('file: ' + shortFileName));
41 }
42 data.errors && data.errors.forEach(function( message, index ){
43 $.util.log($.util.colors.yellow( 'line: '+(index+1) ));
44 $.util.log($.util.colors.yellow('>>'), 'line: ' + message.line + ', column: ' + message.character);
45 $.util.log($.util.colors.yellow('>>'), 'msg: ' + message.reason);
46 })
47 //console.log(JSHINT.data());
48}
851jshint: function jshint(output) {
852 output.JSHint = {
853 // Prohibit explicitly undefined variables
854 undef: true,
855
856 // No empty code blocks
857 noempty: true,
858
859 // Prohibits the use of ++ and --
860 plusplus: true,
861
862 // Prohibits the use of arguments.callee and caller
863 noarg: true,
864
865 // Prohibit the use of variables before they were defined
866 latedef: true,
867
868 // Requires the use of === instead of ==
869 eqeqeq: true,
870
871 // Requires you to specify curly braces on loops
872 // and conditionals
873 curly: true,
874
875 // Allow variable shadowing. Declaring a var multiple times
876 // is allowed.
877 shadow: true,
878
879 // Allow mixing spaces and tabs. We can add a prettify one day
880 // if we want to fix things up.
881 smarttabs: true
882 };
883},

Related snippets