From 0607ebda01b151a862583148ab75fe1bf2737d6e Mon Sep 17 00:00:00 2001 From: Brett Epps Date: Tue, 23 Feb 2016 10:40:11 -0600 Subject: [PATCH] Update to eslint 1.10.3 Also: - Make use of space after function keyword consistent - Update other dependencies to latest minor version --- .eslintrc | 22 ++++++++++++++-------- index.js | 14 +++++++------- package.json | 5 +++-- test/lint.js | 12 ++++++------ test/main.js | 42 +++++++++++++++++++++--------------------- 5 files changed, 51 insertions(+), 44 deletions(-) diff --git a/.eslintrc b/.eslintrc index 0eea4a1..38cc536 100644 --- a/.eslintrc +++ b/.eslintrc @@ -23,11 +23,11 @@ rules: # Disallow warning comments no-warning-comments: - 1 - - terms + - + terms: - todo - fixme - location - - anywhere + location: anywhere # Warns when variables are defined but never used no-unused-vars: 1 @@ -114,7 +114,11 @@ rules: space-after-keywords: - 2 - always - - checkFunctionKeyword: true + + # Disallow a space before function parenthesis + space-before-function-paren: + - 2 + - never # Enforces quoted property names quote-props: @@ -146,10 +150,12 @@ rules: - 2 - single - # Enforces space inside of brackets (except property name) - space-in-brackets: + # Enforces space inside of array brackets + array-bracket-spacing: - 2 - always - - propertyName: false - singleValue: false + # Enforces spaces inside of curly braces in objects + object-curly-spacing: + - 2 + - always diff --git a/index.js b/index.js index 8c02aac..9e28389 100644 --- a/index.js +++ b/index.js @@ -189,7 +189,7 @@ var parseJSON = function parseJSON(data, filename) { ////////////////////////////// colors = fileReturn.match(/"(#([0-9a-f]{3}){1,2})"/g); if (colors) { - colors.forEach(function (color) { + colors.forEach(function(color) { fileReturn = fileReturn.replace(color, color.slice(1, -1)); }); } @@ -200,7 +200,7 @@ var parseJSON = function parseJSON(data, filename) { ////////////////////////////// colors = fileReturn.match(/"(rgb|rgba)\((\d{1,3}), (\d{1,3}), (\d{1,3})\)"/g); if (colors) { - colors.forEach(function (color) { + colors.forEach(function(color) { fileReturn = fileReturn.replace(color, color.slice(1, -1)); }); } @@ -213,7 +213,7 @@ var parseJSON = function parseJSON(data, filename) { ////////////////////////////// colors = fileReturn.match(/"(hsl|hsla)\((\d{1,3}), (\d{1,3}), (\d{1,3})\)"/g); if (colors) { - colors.forEach(function (color) { + colors.forEach(function(color) { fileReturn = fileReturn.replace(color, color.slice(1, -1)); }); } @@ -306,9 +306,9 @@ var importer = function importer(uri, prev, done) { if (isRealFile) { file = path.resolve(path.dirname(prev), makeFsPath(uri)); - raf(uri, file, function (err, data) { + raf(uri, file, function(err, data) { if (err) { - console.log(err.toString()); + console.log(err.toString()); // eslint-disable-line no-console done({}); } else { @@ -317,9 +317,9 @@ var importer = function importer(uri, prev, done) { }); } else { - raf(uri, process.cwd(), function (err, data) { + raf(uri, process.cwd(), function(err, data) { if (err) { - console.log(err.toString()); + console.log(err.toString()); // eslint-disable-line no-console done({}); } else { diff --git a/package.json b/package.json index 954056e..2427f87 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,9 @@ }, "homepage": "https://github.com/at-import/node-sass-import-once", "devDependencies": { - "eslint": "^0.18.0", - "mocha": "^2.2.1", + "eslint": "^1.10.3", + "js-yaml": "^3.5.3", + "mocha": "^2.4.5", "node-sass": "^3.0.0-beta.5", "should": "^5.2.0" }, diff --git a/test/lint.js b/test/lint.js index ced68d3..326ca6f 100644 --- a/test/lint.js +++ b/test/lint.js @@ -15,9 +15,9 @@ describe('code style guide', function() { 'no-console': 0 } }); - report = cli.executeOnFiles(['index.js']); + report = cli.executeOnFiles([ 'index.js' ]); if (report.errorCount > 0 || report.warningCount > 0) { - console.log(formatter(report.results)); + console.log(formatter(report.results)); // eslint-disable-line no-console } should(report.errorCount).equal(0); @@ -31,9 +31,9 @@ describe('code style guide', function() { 'no-console': 2 } }); - report = cli.executeOnFiles(['test/main.js']); + report = cli.executeOnFiles([ 'test/main.js' ]); if (report.errorCount > 0 || report.warningCount > 0) { - console.log(formatter(report.results)); + console.log(formatter(report.results)); // eslint-disable-line no-console } should(report.errorCount).equal(0); @@ -47,9 +47,9 @@ describe('code style guide', function() { 'no-console': 0 } }); - report = cli.executeOnFiles(['test/lint.js']); + report = cli.executeOnFiles([ 'test/lint.js' ]); if (report.errorCount > 0 || report.warningCount > 0) { - console.log(formatter(report.results)); + console.log(formatter(report.results)); // eslint-disable-line no-console } should(report.errorCount).equal(0); diff --git a/test/main.js b/test/main.js index 78a4876..38699bf 100644 --- a/test/main.js +++ b/test/main.js @@ -6,15 +6,15 @@ var should = require('should'), fs = require('fs'), importer = require('../index'); -var filePath = function (file) { +var filePath = function(file) { return path.join(__dirname, 'sass', file); }; -var bowerPath = function (file) { +var bowerPath = function(file) { return path.join(__dirname, '../bower_components', file); }; -describe('import-once', function () { - it('should import files only once', function (done) { +describe('import-once', function() { + it('should import files only once', function(done) { var file = filePath('basic-import-once.scss'), expectedIncludes = [ file, @@ -25,7 +25,7 @@ describe('import-once', function () { sass.render({ 'file': file, 'importer': importer - }, function (err, result) { + }, function(err, result) { if (err) { throw err; } @@ -61,7 +61,7 @@ describe('import-once', function () { }); }) - it('should import `index` files from a folder', function (done) { + it('should import `index` files from a folder', function(done) { var file = filePath('import-index.scss'), expectedIncludes = [ file, @@ -74,7 +74,7 @@ describe('import-once', function () { 'importOnce': { 'index': true } - }, function (err, result) { + }, function(err, result) { if (err) { throw err; } @@ -87,7 +87,7 @@ describe('import-once', function () { }); }); - it('should import `css` files as Sass from a folder', function (done) { + it('should import `css` files as Sass from a folder', function(done) { var file = filePath('import-css.scss'), expectedIncludes = [ file, @@ -100,7 +100,7 @@ describe('import-once', function () { 'importOnce': { 'css': true } - }, function (err, result) { + }, function(err, result) { if (err) { throw err; } @@ -114,7 +114,7 @@ describe('import-once', function () { }); }); - it('should import `bower` files as Sass from a folder', function (done) { + it('should import `bower` files as Sass from a folder', function(done) { var file = filePath('import-bower.scss'), expectedIncludes = [ file, @@ -144,7 +144,7 @@ describe('import-once', function () { 'importOnce': { 'bower': true } - }, function (err, result) { + }, function(err, result) { if (err) { throw err; } @@ -158,7 +158,7 @@ describe('import-once', function () { }); }); - it('should import JSON files as a Sass map', function (done) { + it('should import JSON files as a Sass map', function(done) { var file = filePath('import-json.scss'), expectedIncludes = [ file, @@ -168,7 +168,7 @@ describe('import-once', function () { sass.render({ 'file': file, 'importer': importer - }, function (err, result) { + }, function(err, result) { if (err) { throw err; } @@ -183,7 +183,7 @@ describe('import-once', function () { }); }); - it('should import YAML files as a Sass map', function (done) { + it('should import YAML files as a Sass map', function(done) { var file = filePath('import-yaml.scss'), expectedIncludes = [ file, @@ -193,7 +193,7 @@ describe('import-once', function () { sass.render({ 'file': file, 'importer': importer - }, function (err, result) { + }, function(err, result) { if (err) { throw err; } @@ -208,7 +208,7 @@ describe('import-once', function () { }); }); - it('should support custom include paths', function (done) { + it('should support custom include paths', function(done) { var file = filePath('import-custom.scss'), expectedIncludes = [ file, @@ -222,7 +222,7 @@ describe('import-once', function () { 'includePaths': [ 'test/custom' ] - }, function (err, result) { + }, function(err, result) { if (err) { throw err; } @@ -237,7 +237,7 @@ describe('import-once', function () { }); }); - it('should import Bootstrap as Sass', function (done) { + it('should import Bootstrap as Sass', function(done) { var file = filePath('import-bootstrap.scss'), expectedIncludes = [ file, @@ -251,7 +251,7 @@ describe('import-once', function () { 'css': true, 'bower': true } - }, function (err, result) { + }, function(err, result) { if (err) { throw err; } @@ -265,7 +265,7 @@ describe('import-once', function () { }); }); - it('should fall back to import paths and bower if data is passed in instead of a file name', function (done) { + it('should fall back to import paths and bower if data is passed in instead of a file name', function(done) { var file = filePath('basic-import-once.scss'), expectedIncludes = [ filePath('_partial-with-selectors.scss'), @@ -278,7 +278,7 @@ describe('import-once', function () { 'includePaths': [ path.dirname(file) ] - }, function (err, result) { + }, function(err, result) { if (err) { throw err; }