Skip to content

Commit

Permalink
Update to eslint 1.10.3
Browse files Browse the repository at this point in the history
Also:

- Make use of space after function keyword consistent
- Update other dependencies to latest minor version
  • Loading branch information
eppsilon committed Feb 23, 2016
1 parent fa2b0fa commit 0607ebd
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 44 deletions.
22 changes: 14 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
}
Expand All @@ -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));
});
}
Expand All @@ -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));
});
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
12 changes: 6 additions & 6 deletions test/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
42 changes: 21 additions & 21 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -25,7 +25,7 @@ describe('import-once', function () {
sass.render({
'file': file,
'importer': importer
}, function (err, result) {
}, function(err, result) {
if (err) {
throw err;
}
Expand Down Expand Up @@ -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,
Expand All @@ -74,7 +74,7 @@ describe('import-once', function () {
'importOnce': {
'index': true
}
}, function (err, result) {
}, function(err, result) {
if (err) {
throw err;
}
Expand All @@ -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,
Expand All @@ -100,7 +100,7 @@ describe('import-once', function () {
'importOnce': {
'css': true
}
}, function (err, result) {
}, function(err, result) {
if (err) {
throw err;
}
Expand All @@ -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,
Expand Down Expand Up @@ -144,7 +144,7 @@ describe('import-once', function () {
'importOnce': {
'bower': true
}
}, function (err, result) {
}, function(err, result) {
if (err) {
throw err;
}
Expand All @@ -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,
Expand All @@ -168,7 +168,7 @@ describe('import-once', function () {
sass.render({
'file': file,
'importer': importer
}, function (err, result) {
}, function(err, result) {
if (err) {
throw err;
}
Expand All @@ -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,
Expand All @@ -193,7 +193,7 @@ describe('import-once', function () {
sass.render({
'file': file,
'importer': importer
}, function (err, result) {
}, function(err, result) {
if (err) {
throw err;
}
Expand All @@ -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,
Expand All @@ -222,7 +222,7 @@ describe('import-once', function () {
'includePaths': [
'test/custom'
]
}, function (err, result) {
}, function(err, result) {
if (err) {
throw err;
}
Expand All @@ -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,
Expand All @@ -251,7 +251,7 @@ describe('import-once', function () {
'css': true,
'bower': true
}
}, function (err, result) {
}, function(err, result) {
if (err) {
throw err;
}
Expand All @@ -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'),
Expand All @@ -278,7 +278,7 @@ describe('import-once', function () {
'includePaths': [
path.dirname(file)
]
}, function (err, result) {
}, function(err, result) {
if (err) {
throw err;
}
Expand Down

0 comments on commit 0607ebd

Please sign in to comment.