Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Commit

Permalink
Lint tweaks found with ESLint.
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Apr 13, 2015
1 parent 7bf1442 commit 191d180
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
14 changes: 8 additions & 6 deletions Gruntfile.js
@@ -1,12 +1,14 @@
'use strict';

module.exports = function (grunt) {
grunt.initConfig({

jshint: {
options: {
jshintrc: '.jshintrc'
},
grunt: {
src: ['Gruntfile.js']
gruntfile: {
src: 'Gruntfile.js'
},
core: {
src: ['lib/**/*.js', 'tasks/*.js']
Expand All @@ -20,14 +22,14 @@ module.exports = function (grunt) {
options: {
config: '.jscsrc'
},
grunt: {
src: ['<%= jshint.grunt.src %>']
gruntfile: {
src: '<%= jshint.gruntfile.src %>'
},
core: {
src: ['<%= jshint.core.src %>']
src: '<%= jshint.core.src %>'
},
test: {
src: ['<%= jshint.test.src %>']
src: '<%= jshint.test.src %>'
}
},

Expand Down
2 changes: 1 addition & 1 deletion lib/config/requirejs.js
Expand Up @@ -24,7 +24,7 @@ exports.createConfig = function (context, block) {
var out = path.join(context.outDir, block.requirejs.dest);
var cfgFile = path.join(context.inDir, block.requirejs.baseUrl, block.requirejs.name);
if (!cfgFile.match(/\.js/)) {
cfgFile = cfgFile + '.js';
cfgFile += '.js';
}

options.name = block.requirejs.name;
Expand Down
3 changes: 1 addition & 2 deletions lib/fileprocessor.js
Expand Up @@ -212,7 +212,7 @@ FileProcessor.prototype.replaceWithRevved = function replaceWithRevved(lines, as

var res = match.replace(src, filterOut(file));
if (srcFile !== file) {
self.log(chalk.cyan(src) + ' changed to ' + chalk.cyan(file));
self.log(chalk.cyan(src) + ' changed to ' + chalk.cyan(file));
}
return res;
});
Expand All @@ -222,7 +222,6 @@ FileProcessor.prototype.replaceWithRevved = function replaceWithRevved(lines, as
};



FileProcessor.prototype.process = function (filename, assetSearchPath) {
debug('processing file %s', filename, assetSearchPath);

Expand Down
2 changes: 1 addition & 1 deletion lib/revvedfinder.js
Expand Up @@ -164,7 +164,7 @@ RevvedFinder.prototype.find = function find(ofile, searchDirs) {

debug('Looking for revved version of %s in ', ofile, searchPaths);

//do not touch external files or the root
// do not touch external files or the root
// FIXME: Should get only relative files
if (ofile.match(/:\/\//) || ofile === '') {
return ofile;
Expand Down
30 changes: 15 additions & 15 deletions test/test-file.js
Expand Up @@ -17,7 +17,7 @@ describe('File', function () {
});

it('should *not* skip blank lines', function () {
var filename = __dirname + '/fixtures/block_with_empty_line.html';
var filename = path.join(__dirname, '/fixtures/block_with_empty_line.html');
var file = new File(filename);

assert.equal(1, file.blocks.length);
Expand All @@ -28,7 +28,7 @@ describe('File', function () {
});

it('should return the right number of blocks with the right number of lines', function () {
var filename = __dirname + '/fixtures/usemin.html';
var filename = path.join(__dirname, '/fixtures/usemin.html');
var file = new File(filename);
assert.equal(2, file.blocks.length);
var b1 = file.blocks[0];
Expand All @@ -42,7 +42,7 @@ describe('File', function () {
});

it('should also detect block that use alternate search dir', function () {
var filename = __dirname + '/fixtures/alternate_search_path.html';
var filename = path.join(__dirname, '/fixtures/alternate_search_path.html');
var file = new File(filename);
assert.equal(1, file.blocks.length);
var b1 = file.blocks[0];
Expand All @@ -58,7 +58,7 @@ describe('File', function () {
});

it('should also detect block that has IE conditionals on same line', function () {
var filename = __dirname + '/fixtures/block_with_IEconditionals_inline.html';
var filename = path.join(__dirname, '/fixtures/block_with_IEconditionals_inline.html');
var file = new File(filename);
assert.equal(1, file.blocks.length);
assert.ok(file.blocks[0].conditionalStart);
Expand All @@ -68,7 +68,7 @@ describe('File', function () {
});

it('should also detect block that has IE conditionals within block', function () {
var filename = __dirname + '/fixtures/block_with_IEconditionals_within.html';
var filename = path.join(__dirname, '/fixtures/block_with_IEconditionals_within.html');
var file = new File(filename);
assert.equal(1, file.blocks.length);
assert.ok(file.blocks[0].conditionalStart);
Expand All @@ -78,14 +78,14 @@ describe('File', function () {
});

it('should throw an exception if it finds RequireJS blocks', function () {
var filename = __dirname + '/fixtures/requirejs.html';
var filename = path.join(__dirname, '/fixtures/requirejs.html');
assert.throws(function () {
new File(filename);
}, Error);
});

it('should not take into consideration path of the source file', function () {
var filename = __dirname + '/fixtures/usemin.html';
var filename = path.join(__dirname, '/fixtures/usemin.html');
var file = new File(filename);

assert.equal(2, file.blocks.length);
Expand All @@ -95,23 +95,23 @@ describe('File', function () {
});

it('should not take into consideration source files referenced from root', function () {
var filename = __dirname + '/fixtures/root_path.html';
var filename = path.join(__dirname, '/fixtures/root_path.html');
var file = new File(filename);

assert.equal(1, file.blocks.length);
assert.equal('/scripts/foo.js', file.blocks[0].dest);
});

it('should detect the async attribute', function () {
var filename = __dirname + '/fixtures/block_with_async.html';
var filename = path.join(__dirname, '/fixtures/block_with_async.html');
var file = new File(filename);
assert.equal(1, file.blocks.length);
assert.ok(file.blocks[0].async);
assert.equal(true, file.blocks[0].async);
});

it('should throw error if non-asynced script follows a asynced one in one block', function () {
var filename = __dirname + '/fixtures/block_with_mixed_async.html';
var filename = path.join(__dirname, '/fixtures/block_with_mixed_async.html');
try {
new File(filename);
} catch (e) {
Expand All @@ -122,23 +122,23 @@ describe('File', function () {
});

it('should detect the defer attribute', function () {
var filename = __dirname + '/fixtures/block_with_defer.html';
var filename = path.join(__dirname, '/fixtures/block_with_defer.html');
var file = new File(filename);
assert.equal(1, file.blocks.length);
assert.ok(file.blocks[0].defer);
assert.equal(true, file.blocks[0].defer);
});

it('should not detect the defer string in file path', function () {
var filename = __dirname + '/fixtures/block_with_fake_defer_in_path.html';
var filename = path.join(__dirname, '/fixtures/block_with_fake_defer_in_path.html');
var file = new File(filename);
assert.equal(1, file.blocks.length);
assert.ok(!file.blocks[0].defer);
assert.equal(false, file.blocks[0].defer);
});

it('should throw error if non-deferred script follows a deferred one in one block', function () {
var filename = __dirname + '/fixtures/block_with_mixed_defer.html';
var filename = path.join(__dirname, '/fixtures/block_with_mixed_defer.html');
try {
new File(filename);
} catch (e) {
Expand All @@ -149,7 +149,7 @@ describe('File', function () {
});

it('should throw error if deferred script follows a non-deferred one in one block', function () {
var filename = __dirname + '/fixtures/block_with_mixed_defer.html';
var filename = path.join(__dirname, '/fixtures/block_with_mixed_defer.html');
try {
new File(filename);
} catch (e) {
Expand All @@ -160,7 +160,7 @@ describe('File', function () {
});

it('should detect the media attribute', function () {
var filename = __dirname + '/fixtures/block_with_media.html';
var filename = path.join(__dirname, '/fixtures/block_with_media.html');
var file = new File(filename);
assert.equal(1, file.blocks.length);
assert.ok(file.blocks[0].media);
Expand Down
1 change: 0 additions & 1 deletion test/test-fileprocessor.js
Expand Up @@ -269,7 +269,6 @@ describe('FileProcessor', function () {
});



describe('absolute paths', function () {
var fp;

Expand Down

0 comments on commit 191d180

Please sign in to comment.