Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "semistandard",
"rules": {
"brace-style": [2, "stroustrup", { "allowSingleLine": true }],
"space-before-function-paren": [2, "never"]
}
}
18 changes: 0 additions & 18 deletions .jscsrc

This file was deleted.

6 changes: 0 additions & 6 deletions .jshintrc

This file was deleted.

7 changes: 3 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var error = gutil.PluginError;
var through = require('through2');
var csslint = require('csslint').CSSLint;
var RcLoader = require('rcloader');
Expand Down Expand Up @@ -46,7 +45,7 @@ var cssLintPlugin = function(options) {

return through.obj(function(file, enc, cb) {
if (file.isNull()) return cb(null, file); // pass along
if (file.isStream()) return cb(new error('gulp-csslint: Streaming not supported'), file);
if (file.isStream()) return cb(new gutil.PluginError('gulp-csslint: Streaming not supported'), file);

var content = file.contents.toString(enc);

Expand Down Expand Up @@ -127,7 +126,7 @@ cssLintPlugin.reporter = function(customReporter) {
};

cssLintPlugin.addRule = function(rule) {
if(typeof rule !== 'object') {
if (typeof rule !== 'object') {
throw new Error('Invalid rule: rules need to be objects.');
}
csslint.addRule(rule);
Expand All @@ -140,7 +139,7 @@ cssLintPlugin.failReporter = function() {
return cb(null, file);
}

return cb(new gutil.PluginError('gulp-csslint', 'CSSLint failed for '+file.relative), file);
return cb(new gutil.PluginError('gulp-csslint', 'CSSLint failed for ' + file.relative), file);
});
};

Expand Down
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,31 @@
},
"devDependencies": {
"coveralls": "^2.11.2",
"eslint": "^1.1.0",
"eslint-config-semistandard": "^5.0.0",
"eslint-config-standard": "^4.1.0",
"eslint-plugin-standard": "^1.2.0",
"istanbul": "^0.3.14",
"jscs": "^1.13.1",
"jshint": "^2.7.0",
"mocha": "^2.2.5",
"rimraf": "^2.3.4",
"should": "^7.0.3",
"sinon": "^1.15.4"
},
"scripts": {
"clean": "rimraf coverage/",
"lint": "jscs index.js test/ && jshint index.js test/",
"pretest": "npm run lint",
"test": "mocha",
"cover": "istanbul cover _mocha",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this and the ones further down is npm alphabetizing

"lint": "eslint index.js test/main.js",
"precover": "npm run lint && npm run clean",
"cover": "istanbul cover _mocha"
"pretest": "npm run lint",
"test": "mocha"
},
"repository": {
"type": "git",
"url": "git://github.com/lazd/gulp-csslint.git"
},
"keywords": [
"gulpplugin",
"csslint"
"csslint",
"gulpplugin"
],
"author": "Larry Davis <lazdnet@gmail.com>",
"license": "MIT",
Expand Down
4 changes: 0 additions & 4 deletions test/.jshintrc

This file was deleted.

22 changes: 11 additions & 11 deletions test/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*jshint expr: true*/
/* eslint-env mocha */

var cssLintPlugin = require('../');
var should = require('should');
Expand All @@ -8,7 +8,7 @@ var path = require('path');
var sinon = require('sinon');

var getFile = function(filePath) {
filePath = 'test/'+filePath;
filePath = 'test/' + filePath;
return new gutil.File({
path: filePath,
cwd: 'test/',
Expand All @@ -18,7 +18,7 @@ var getFile = function(filePath) {
};

var getContents = function(filePath) {
filePath = 'test/'+filePath;
filePath = 'test/' + filePath;
return fs.readFileSync(filePath, 'utf8');
};

Expand Down Expand Up @@ -191,23 +191,23 @@ describe('gulp-csslint', function() {
desc: 'Class names must follow pattern',
browsers: 'All',

//initialization
// initialization
init: function(parser, reporter) {
'use strict';
var rule = this;
parser.addListener('startrule', function(event) {
var line = event.line,
col = event.col;
var line = event.line;
var col = event.col;

for (var i=0,len=event.selectors.length; i < len; i++) {
for (var i = 0, len = event.selectors.length; i < len; i++) {
var selectors = event.selectors[i].text.split(/(?=\.)/);
for (var s=0,l=selectors.length; s < l; s++){
for (var s = 0, l = selectors.length; s < l; s++) {
var selector = selectors[s].trim();
if(selector.charAt(0) !== '.'){
if (selector.charAt(0) !== '.') {
return;
}
if(!selector.match(/^\.(_)?(o|c|u|is|has|js|qa)-[a-z0-9]+$/)){
reporter.warn('Bad naming: '+selector, line, col, rule);
if (!selector.match(/^\.(_)?(o|c|u|is|has|js|qa)-[a-z0-9]+$/)) {
reporter.warn('Bad naming: ' + selector, line, col, rule);
}
}
}
Expand Down