Skip to content

Commit

Permalink
Build: More linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Jun 17, 2017
1 parent de6046e commit 2ec6a54
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
36 changes: 18 additions & 18 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,29 @@ function loadSourceMap(file, state, callback) {

if (state.map) {
state.map = state.map.toObject();
// sources in map are relative to the source file
// Sources in map are relative to the source file
state.path = file.dirname;
state.content = convert.removeComments(state.content);
// remove source map comment from source
// Remove source map comment from source
file.contents = new Buffer(state.content, 'utf8');
return callback();
}

// look for source map comment referencing a source map file
// Look for source map comment referencing a source map file
var mapComment = convert.mapFileCommentRegex.exec(state.content);

var mapFile;
if (mapComment) {
mapFile = path.resolve(file.dirname, mapComment[1] || mapComment[2]);
state.content = convert.removeMapFileComments(state.content);
// remove source map comment from source
// Remove source map comment from source
file.contents = new Buffer(state.content, 'utf8');
} else {
// if no comment try map file with same name as source file
// If no comment try map file with same name as source file
mapFile = file.path + '.map';
}

// sources in external map are relative to map file
// Sources in external map are relative to map file
state.path = path.dirname(mapFile);

fs.readFile(mapFile, 'utf8', onRead);
Expand All @@ -68,7 +68,7 @@ function loadSourceMap(file, state, callback) {
}
}

// fix source paths and sourceContent for imported source map
// Fix source paths and sourceContent for imported source map
function fixImportedSourceMap(file, state, callback) {
if (!state.map) {
return callback();
Expand Down Expand Up @@ -108,11 +108,11 @@ function fixImportedSourceMap(file, state, callback) {
state.map.sources[idx] = unixRelPath;

if (absPath !== file.path) {
// load content from file async
// Load content from file async
return fs.readFile(absPath, 'utf8', onRead);
}

// if current file: use content
// If current file: use content
assignSourcesContent(state.content, idx);
cb();

Expand Down Expand Up @@ -171,25 +171,25 @@ function createSourceMapFile(opts) {
path: opts.path,
contents: new Buffer(JSON.stringify(opts.content)),
stat: {
isFile: function () {
isFile: function() {
return true;
},
isDirectory: function () {
isDirectory: function() {
return false;
},
isBlockDevice: function () {
isBlockDevice: function() {
return false;
},
isCharacterDevice: function () {
isCharacterDevice: function() {
return false;
},
isSymbolicLink: function () {
isSymbolicLink: function() {
return false;
},
isFIFO: function () {
isFIFO: function() {
return false;
},
isSocket: function () {
isSocket: function() {
return false;
},
},
Expand All @@ -212,7 +212,7 @@ function writeSourceMaps(file, destPath, callback) {

var comment;
if (destPath == null) {
// encode source map into comment
// Encode source map into comment
comment = convert.fromObject(file.sourceMap).toComment(commentOpts);
} else {
var mapFile = path.join(destPath, file.relative) + '.map';
Expand All @@ -235,7 +235,7 @@ function writeSourceMaps(file, destPath, callback) {
comment = convert.generateMapFileComment(sourcemapLocation, commentOpts);
}

// append source map comment
// Append source map comment
file.contents = appendBuffer(file.contents, comment);

callback(null, file, sourceMapFile);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"lib/"
],
"scripts": {
"lint": "eslint index.js lib/ test/add.js test/write.js && jscs index.js test/add.js test/write.js",
"lint": "eslint index.js lib/ test/add.js test/write.js && jscs index.js lib/ test/add.js test/write.js",
"pretest": "npm run lint",
"test": "mocha --async-only",
"cover": "istanbul cover _mocha --report lcovonly",
Expand Down

0 comments on commit 2ec6a54

Please sign in to comment.