Skip to content

Commit

Permalink
Update JSHint's rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Oct 17, 2015
1 parent 9c93893 commit 7d7ecf2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
15 changes: 8 additions & 7 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"curly": false,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 4,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"node": true,
"noempty": true,
"quotmark": "single",
"strict": true,
"undef": true,
"unused": false,
"boss": true,
"eqnull": true,
"node": true
"unused": true
}
8 changes: 4 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
nodeunit: {
files: ['test/**/*_test.js']
files: 'test/**/*_test.js'
},
jshint: {
options: {
Expand All @@ -20,16 +20,16 @@ module.exports = function (grunt) {
src: 'Gruntfile.js'
},
lib: {
src: ['lib/*.js']
src: 'lib/*.js'
},
test: {
src: ['test/*.js']
src: 'test/*.js'
}
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
tasks: 'jshint:gruntfile'
},
test: {
files: [
Expand Down
3 changes: 2 additions & 1 deletion lib/css-url-rewriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

'use strict';

var extend = require('extend');

// Regex to find CSS properties that contain URLs
Expand All @@ -32,7 +33,7 @@ module.exports = function rewriteCSSURLs(css, settings, rewriterFn) {
settings = extend({}, defaults, settings);

// Return the modified CSS
var result = css.toString().replace(cssPropertyMatcher, function(property, urlValue) {
var result = css.toString().replace(cssPropertyMatcher, function(property) {
// This function deals with an individual CSS property.

// If this property is excluded, return it unchanged
Expand Down
12 changes: 7 additions & 5 deletions test/css-url-rewriter_test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
'use strict';

var SAVE = true;

var fs = require('fs'),
path = require('path'),
rewriteCSSURLs = require('../lib/css-url-rewriter.js'),
rewriteCSSURLs = require('../lib/css-url-rewriter.js');

var SAVE = true,
files = [];

module.exports = {
'rewriteCSSURLs function': {
setUp: function(done) {
if (!fs.existsSync(path.join(__dirname, 'results')))
if (!fs.existsSync(path.join(__dirname, 'results'))) {
fs.mkdirSync(path.join(__dirname, 'results'));
}

fs.readdir(path.join(__dirname, 'fixtures'), function (err, _files) {
files = _files || [];
Expand All @@ -34,8 +35,9 @@ module.exports = {
expected = fs.readFileSync(expectedFile).toString();

var result = rewriteCSSURLs(fixture, rewrite);
if (SAVE)
if (SAVE) {
fs.writeFileSync(path.join(__dirname, 'results', basename), result);
}

test.strictEqual(result, expected, basename);
}
Expand Down

0 comments on commit 7d7ecf2

Please sign in to comment.