Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-jslint

Package Overview
Dependencies
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-jslint - npm Package Compare versions

Comparing version 1.1.8 to 1.1.10

.editorconfig

17

History.md

@@ -1,4 +0,17 @@

1.1.8 / 2104-03-19
1.1.10 / 2014-05-05
===================
* lib/jslint.js: remove BOM when present
* test/jslint.js: unit tests for new fn preprocessScript
1.1.9 / 2014-04-13
==================
* Readme.md: document new feature, specify edition of jslint by path
* lib/jslint.js: new function loadJSLintFromPath
* test/editions.js: add unit test for loadJSLintFromPath
1.1.8 / 2014-03-19
==================
* Makefile: factor unit tests

@@ -134,2 +147,2 @@ * exclude: factor, add tests, speed up exclude function

- Added an exclude option
- Added number of files in violation to standard output
- Added number of files in violation to standard output

@@ -46,2 +46,15 @@

function loadJSLintFromPath(path, cb) {
var ctx = vm.createContext();
var f = fs.readFileSync(path.resolve(process.cwd(), path));
vm.runInContext(f, ctx);
JSLINT = jslint.JSLINT = ctx.JSLINT;
if (cb) {
cb(null, path);
}
}
/**

@@ -52,2 +65,3 @@ * Expose `loadJSLint`.

jslint.loadJSLint = loadJSLint;
jslint.loadJSLintFromPath = loadJSLintFromPath;

@@ -78,3 +92,7 @@ // default - can be overridden by setting 'edition' in grunt options

if (opts.edition) {
loadJSLint(opts.edition);
if (opts.edition.indexOf(".js") === opts.edition.length - 3) {
loadJSLintFromPath(opts.edition);
} else {
loadJSLint(opts.edition);
}
}

@@ -116,2 +134,18 @@

jslint.preprocessScript = function preprocessScript(source, stripShebang) {
if (source.charCodeAt(0) === 0xFEFF) {
source = source.slice(1);
}
if (stripShebang) {
// remove shebang lines for executable files
// e.g. `#!/usr/bin/env node`
/*jslint regexp: true*/
source = source.replace(/^\#\!.*/, '');
/*jslint regexp: false*/
}
return source;
};
jslint.validate = function (file, opts, cb) {

@@ -131,9 +165,3 @@ var directives = opts.directives || {};

if (opts.shebang) {
// remove shebang lines for executable files
// e.g. `#!/usr/bin/env node`
/*jslint regexp: true*/
source = source.replace(/^\#\!.*/, '');
/*jslint regexp: false*/
}
source = jslint.preprocessScript(source, opts.shebang);

@@ -140,0 +168,0 @@ JSLINT(source, directives);

4

package.json
{
"name": "grunt-jslint",
"description": "Validates JavaScript files with JSLint",
"version": "1.1.8",
"version": "1.1.10",
"homepage": "https://github.com/stephenmathieson/grunt-jslint",

@@ -37,3 +37,3 @@ "author": {

"dependencies": {
"jslint": ">=0.2.11"
"jslint": ">=0.3.3"
},

@@ -40,0 +40,0 @@ "devDependencies": {

@@ -33,2 +33,3 @@

- **shebang** Ignore shebang lines (`#!/usr/bin/whatever`) from files
- **edition** Specify edition of jslint to use. Either a date which is a JSLint edition (see node_modules/jslint/lib for valid choices), or 'latest' for the latest version, or a path (absolute *or* relative to process current directory) to the JSLint

@@ -62,2 +63,3 @@

options: {
edition: 'latest', // specify an edition of jslint or use 'dir/mycustom-jslint.js' for own path
junit: 'out/server-junit.xml', // write the output to a JUnit XML

@@ -64,0 +66,0 @@ log: 'out/server-lint.log',

@@ -108,4 +108,29 @@ 'use strict';

}
}).addBatch({
'load specific path': {
topic: function () {
var file = getFixture('es5.js'),
opts = {
directives: {
es5: true
}
};
jslint.loadJSLintFromPath('node_modules/jslint/lib/jslint-2013-08-26.js', function () {
validate(file, opts, this.callback);
}.bind(this));
},
'should not error': function (err, report) {
assert.ifError(err);
},
'should be a correct edition': function (err, report) {
assert.ok(jslint.edition === '2013-08-26');
},
'should have no violations': function (err, report) {
assert.lengthOf(report, 0);
}
}
});
suite.export(module);

@@ -203,2 +203,23 @@ 'use strict';

'preprocessScript strip shebang': {
topic: function () {
var source = jslint.preprocessScript('\ufeff#!/usr/bin/env node\nvar x = 1;', true);
this.callback(null, source);
},
'should strip bom and shebang but not newline': function (err, report) {
assert.ifError(err);
assert(report === '\nvar x = 1;');
}
},
'preprocessScript no strip shebang': {
topic: function () {
var source = jslint.preprocessScript('\ufeff#!/usr/bin/env node\nvar x = 1;', false);
this.callback(null, source);
},
'should strip bom': function (err, report) {
assert.ifError(err);
assert(report === '#!/usr/bin/env node\nvar x = 1;');
}
},
'unused option': {

@@ -205,0 +226,0 @@ topic: function () {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc