stephenmathieson-boneyard / grunt-jslint Goto Github PK
View Code? Open in Web Editor NEWA Grunt task for running JSLint
License: Do What The F*ck You Want To Public License
A Grunt task for running JSLint
License: Do What The F*ck You Want To Public License
Hi,
Could the grunt dependency could be moved to a devDependencies to reduce npm install time?
Thanks for your work!
I used to write get, set function which is in es5 feature.
I found some articles that it covers over 1.1.0 version.
Sadly, the jslint that is in grunt-jslint is 0.8.1 version.
That's why everytime I check grunt-jslint, it faild because of these reasons.
I gotta question that is this package has possibility to update for new version?
Hope your positive feedback.
At this line jslint throws an error
window.__wbuxq = __wbux;
I see this error:
Expected ';' and instead saw '.'
Why does it expect ; after window when that should not be the case?
As of the very recent update to 0.2.3, many of the templating calls in jslint.js do not work, with the error
Warning: An error occurred while processing a template (report is not defined). Use --force to continue.
I believe the calls to grunt.template.process
should in fact be calls to underscore.template
, or it is possible that some dependency is missing from the package configuration.
For example the following output is invalid XML:
It should be:
<> might also need encoding too.
so we can:
grunt.initConfig({
jslint: {
whatever: {
src: [ '*.js' ],
options: {
jslint: '/path/to/jslint.js'
}
}
}
});
Failing JSLint tests does not fail the build as the JSHint plugin does.
This needs to work the same way as JSHint does in that regard, does it not?
Running "jslint" task
FAIL src/public/media/js/tests/logger/logger.test.js (1)
src/public/media/js/tests/logger/logger.test.js:2:1 Use the function form of 'use strict'.
# JSLint failed, 1 violations in 1 files. 1 files scanned.
Running "qunit:all" (qunit) task
Testing src/public/media/js/tests/logger/logger.test.html test
..OK
>> 2 assertions passed (52ms)
Done, without errors.
It's only here for fs.Stats#isDirectory()
.
/cc @smikes
This is what I use for the jslint grunt task.
jslint: {
all: {
src: [
'./js/**/*.js'
],
exclude: [
'./js/bundle*.js'
]
}
}
[email protected] excludes bundle.min.js and bundle.js from JSLinting. However in 1.1.6, it does not exclude those files. I have also tried explicitly listing both ./js/bundle.min.js and ./js/bundle.js in the array, but they are not excluded.
Is there a way to ignore specific warnings?
For example, I am trying to use Bluebird in my latest project and it's causing "Read only" errors everywhere it's included. I would like to set a global option in my Gruntfile to ignore the warning but the following does not work.
jslint: {backend: {directives: { W020: true // or false }}}
The other solution, suggested by the JSLint/Hint documentation does not work either. It actually causes more errors.
/*jslint -W020 */
Results in:
file.js:3:10 Expected '*/' and instead saw '-'. file.js:3:11 Expected 'W020' at column 1, not column 11. file.js:3:15 Expected ';' and instead saw '*/'. file.js:3:16 Expected '*/' at column 1, not column 16. file.js:3:16 Unexpected '*/'.
I'm updating a project to grunt 0.4 and so I need to use release 0.2.3-1 of grunt-jslint. Unfortunately this version isn't available via npm install yet.
I tried adding the git URL as a dependency in my package.json
:
"grunt-jslint": "git://github.com/stephenmathieson/grunt-jslint.git#0.2.3-1",
However this dies with:
Loading "jslint.js" tasks and helpers...ERROR
>> TaskError: Unable to read "[path]node_modules/grunt-jslint/tasks/JSLint/jslint.js" file (Error code: ENOENT).
Looking at it I think this is because the JSLint submodule is not available. Is there a workaround for this or is it possible to make 0.2.3-1 available via npm?
Thanks!
Running a build with the version of grunt throws the following error:
Warning: Object # has no method 'expandFiles' Use --force to continue.
When configured like following:
jslint: {
client: {
src: ['*.js', 'src/**/*.js'],
exclude: ['src/thirdparty/*', 'src/widgets/*'],
directives: {
"vars": true,
"plusplus": true,
"devel": true,
"nomen": true,
"maxerr": 50
},
options: {
errorsOnly: false, // only display errors
failOnError: false, // defaults to true
}
}
},
I get this error in my project
$ grunt jslint
Running "jslint:client" (jslint) task
>> Error: EISDIR, read
Warning: Task "jslint:client" failed. Use --force to continue.
Aborted due to warnings.
Hello guys
I try to use...
jslint: {
dev: {
files: ['source/**/*.js'],
directives: {
browser: true,
indent: 4,
predef: [
'jQuery'
]
}
},
grunt: {
files: ['Gruntfile.js'],
directives: {
node: true,
indent: 4
}
}
},
Running grunt jslint:grunt
the output is >> NO FILES?!?
The module is looking the files in the root of the object, like:
jslint: {
files: ['source/**/*.js'],
directives: {
browser: true,
indent: 4,
predef: [
'jQuery'
]
}
},
But, I want to make two or more setups. How can I do this?
Hey all,
Having the same issue described here reid/node-jslint#36 -- seems that you need to pass this:
--es5=false
to node-jslint to get it to pick up trailing commas. However, passing the option in through directives doesn't work in the Grunt task. Is there a fix for this (and/or has anyone else ran into this)?
I ran npm install grunt-jslint
and got an error like this:
ENOENT, no such file or directory
. Turns out the grunt-jslint\jslint directory is missing.I can copy the folder from elsewhere, but the package seems to be wrong.
Currently grunt-jslint does not require anything in particular as an engine. Node-jslint will be using streams soon (from v 0.4.0, out next week), which means node-jslint will require version >= 0.10.0.
I see two options for grunt-jslint -
Do you have a preference? I'd choose 1., because nobody should be running node 0.8 or older in production anymore...
Wanted to start a discussion here first before doing a pull-request or fork. I'd like to have the ability to define a custom function to run if JSLint fails. I'm working on moving my team's build processes into Grunt; having some flexibility on extending this plugin will be necessary to get buy-in.
For my particular use case, I'm simply trying to invoke a say command so I receive an audible notification when linting fails. Our team uses JSLint + a file watcher for continual linting during development, so we don't always have the console in the foreground.
The 0.2.5 version published on npm does not support grunt 0.4.0.
But the current version in master does.
Any chance of publishing a new version to npm?
Error seems to be that xml2js is unable to load sax, see travis report at https://travis-ci.org/stephenmathieson/grunt-jslint/jobs/16186811
try to replicate outside of CI
First cut - creating an issue. Will commit my changes on a branch for review
Trying to remove some formatting errors from the linting for all files...
e.g.
options: {
jslint white: false,
}
this gives an error
Not sure if this could be a possibility, useful when doing a large javascript project with many directories for structure. As well for example in a root of a node.js project to exclude the node_modules directory.
grunt-jslint does’t report all errors of missing space between function keyword and parenthesis of an anonymous function.
Example:
(function () {
'use strict';
module.exports = {
start: function () {
this.router.on('action:start', function() { this.set({loading: false}); });
}
};
}());
The callback function violates clearly jslint rules but this error doesn’t get reported.
This issue is probably fixed by ba6642aa85 commit of jslint
I'm executing grunt from MSBuild in Visual Studio with an Exec command like this:
<Exec ContinueOnError="true"
WorkingDirectory="%(GruntDir.Fullpath)"
Command="grunt.cmd --no-color > logs\grunt-output.log">
Grunt output is not displayed properly in the Visual Studio output window, so the only way to see errors from jslint is to send them to an external file. With the --no-color option set, grunt errors are sent without colour codes. However, the grunt-jslint errors are still sent with colour codes. e.g:
[31m../debug/js/src/jquery.ui.menubar.js:16�[39m�[31m:10�[39m Expected exactly one space between 'function' and '('.
�See grunt issue 510 for a relevant discussion. How can I switch off these colour codes when running grunt-jslint from tool other than the command line?
It would be great if their was a way that the plugin could read and process UTF8 files with a Byte Order Mark (BOM) such is the default saved by Visual Studio and many other Windows applications by default.
Hi,
Just a heads up that there is a newer version of JSLint available now. I was trying to use the options available at jslint.com and failing.
This is my code structure:
jslint: { client: { src: [ 'js/**/*.js' ], exclude: [ 'js/jsDocs/**/*.js', 'js/lib/**/*.js', 'js/scripts.min.js' ], directives: { browser: true, predef: [ 'jQuery', 'window', 'document', 'alert' ] } } },
It still brings in the jsDocs and lib js files. How come?
Thanks
Hi, first I wanna thank you for developing grunt-jslint!
I'm using grunt-jslint 1.1.12 with
and get the following warning when i want to use jslint in my build process:
Warning: grunt-jslint's interface has changed since 0.2.x; see https://github.com/stephenmathieson/grunt-jslint for update instructions. Use --force to continue.
here is my Grunt configuration:
jslint: {
options: {
edition: 'latest',
errorsOnly: false,
failOnError: true,
checkstyle: 'build/checkstyle.xml'
},
all: {
src: [
'Gruntfile.js',
'src/main/js/**/*.js',
'src/test/js/**/*.js'
]
}
},
Does anybody know the reason for that message? Am I using it wrong? and noo! I don't always want to use "--force"
I'm using the following code:
module.exports = function( grunt ) {
"use strict";
grunt.initConfig({
pkg: grunt.file.readJSON( "package.json" ),
jshint: {
files: [
"Gruntfile.js",
"compile.js",
"scripts/MathFunction/*.js"
],
excludes: [
"scripts/MathFunction/*_*.js"
]
}
});
grunt.loadNpmTasks( "grunt-contrib-jshint" );
grunt.registerTask( "default", [ "jshint" ]);
};
However, running this with grunt yields:
Running "jshint:files" (jshint) task
Linting scripts/MathFunction/MathFunction_footer.js...ERROR
[L2:C1] W116: Expected '(end)' and instead saw '}'.
}(window, document, window.console, MathJax, isNaN, Math.pow));
Linting scripts/MathFunction/MathFunction_header.js...ERROR
[L4:C74] E019: Unmatched '{'.
(function loadMathParser(window, document, console, MathJax, isNaN, pow) {
[L4:C1] E019: Unmatched '('.
(function loadMathParser(window, document, console, MathJax, isNaN, pow) {
>> Expected an assignment or function call and instead saw an expression.
>> Missing semicolon.
Warning: Task "jshint:files" failed. Used --force, continuing.
Despite being told to exclude these two files, it still jslints them. Even turning the excludes array into those two specific files still gets them linted.
build failure due to array.forEach iteration of files in version 1.1.15
//in tasks/jslint.js
excludedFiles = grunt.file.expand(excludedFiles);
files = grunt.file
.expand(files)
.filter(function (file) {
return excludedFiles.indexOf(file) === -1;
});
This is a big-O of (n^2) algorithm for file exclusion and is taking 10 seconds on my relatively small project which excludes '/node_modules/'. By contrast, grunt-contrib-jshint takes a handful of milliseconds to do the same thing.
Please accept my related pull request.
It happened again: to deal with a node/windows/stdout bug that's present in 0.10 and (maybe?) fixed in 0.12, I need node-jslint to require a package that depends on node >= 0.10.
I'm going to split node-jslint into two parts: node-jslint will remain the frontend, and there will be a new package, the backend, that just provides the different jslint editions and the loading logic.
So node-jslint will require node >= 0.10, but this new package will not have an engine dependency. I'll switch grunt-jslint to depend on the new package; grunt-jslint's engine requirement won't change.
This will go out as node-jslint 0.6, probably tomorrow.
I'm posting this issue to let you know that we will be publishing Grunt 0.4 on Monday, February 18th.
If your plugin is not already Grunt 0.4 compatible, would you please consider updating it? For an overview of what's changed, please see our migration guide.
If you'd like to develop against the final version of Grunt before Monday, please specify "grunt": "0.4.0rc8"
as a devDependency in your project. After Monday's release, you'll be able to use "grunt": "~0.4.0"
to actually publish your plugin. If you depend on any plugins from the grunt-contrib series, please see our list of release candidates for compatible versions. All of these will be updated to final status when Grunt 0.4 is published.
Also, in an effort to reduce duplication of effort and fragmentation in the developer community, could you review the grunt-contrib series of plugins to see if any of your functionality overlaps significantly with them? Grunt-contrib is community maintained with 40+ contributors—we'd love to discuss any additions you'd like to make.
Finally, we're working on a new task format that doesn't depend on Grunt: it's called node-task. Once this is complete, there will be one more conversion, and then we'll never ask you to upgrade your plugins to support our changes again. Until that happens, thanks for bearing with us!
If you have any questions about how to proceed, please respond here, or join us in #grunt on irc.freenode.net.
Thanks, we really appreciate your work!
Example:
5 passing (20ms)
Done, without errors.
like mocha
Much appreciate this great application. I want to use a specific version: JSLint 2012-02-03. I cannot find it in node_modules/grunt-jslint/node_modules/jslint/lib/, so I specified a absolute path to 'edition', then the following error occurred:
$ grunt
Running "jslint:server" (jslint) task
Warning: Object /tmp/jslint.js has no method 'resolve' Use --force to continue.Aborted due to warnings.
I run the make test
on local for grunt-jslint, no error was found.
But I noticed that there was a variable named path
in the function loadJSLintFromPath
and the object path
created from requrie('path')
had the same name. I changed the name of one of them as following, it seems work.
var path = require('path');
...
function loadJSLintFromPath(jslintpath, cb) {
var ctx = vm.createContext();
var f = fs.readFileSync(path.resolve(process.cwd(), jslintpath));
...
Could you please take a look on this issue? Thanks!
For example:
npm install grunt-jslint
grunt jslint
Error: ENOENT, no such file or directory 'xxx/node_modules/grunt-jslint/jslint/jslint.js'
Warning: Task "jslint" not found. Use --force to continue.
While debugging an issue where JSLint would not honor the directive "unparam" I came across some code I believe to be dead.
if (!directives.unused) {
violations.concat(data.unused);
}
There is no property unused
in the data structure returned by JSLINT.data()
. Was there such in previous versions of JSLINT? Also there is no directive named unused
in JSLINT. How was this construct suppose to work and what was its purpose?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.