Permalink
Browse files

Enable `requireSpacesInFunctionExpression`.

  • Loading branch information...
1 parent 4c6453e commit ef4107223af1895381661943abfa73d97c7a2320 @XhmikosR XhmikosR committed Mar 9, 2014
Showing with 55 additions and 54 deletions.
  1. +2 −1 .jscsrc
  2. +8 −8 dist/htmlminifier.js
  3. +1 −1 master.js
  4. +3 −3 src/htmlminifier.js
  5. +5 −5 src/htmlparser.js
  6. +1 −1 test.js
  7. +2 −2 tests/lint.js
  8. +33 −33 tests/minifier.js
View
@@ -2,7 +2,8 @@
"requireCurlyBraces": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireSpaceAfterBinaryOperators": ["+", "-", "*", "=", "==", "===", "!=", "!=="],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
- "requireSpaceBeforeBinaryOperators": ["+", "-", "*", "=", "==", "===", "!=", "!=="],
+ "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="],
+ "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true },
"requireCamelCaseOrUpperCaseIdentifiers": true,
"requireCapitalizedConstructors": true,
View
@@ -33,7 +33,7 @@
/* global ActiveXObject, DOMDocument */
-(function(global){
+(function(global) {
'use strict';
// Regular Expressions for parsing tags and attributes
@@ -64,11 +64,11 @@
// Special Elements (can contain anything)
var special = makeMap('script,style');
- var reCache = { }, stackedTag, reStackedTag, tagMatch;
+ var reCache = {}, stackedTag, reStackedTag, tagMatch;
var HTMLParser = global.HTMLParser = function( html, handler ) {
var index, chars, match, stack = [], last = html, prevTag, nextTag;
- stack.last = function(){
+ stack.last = function() {
return this[ this.length - 1 ];
};
@@ -329,7 +329,7 @@
// If we're dealing with an empty document then we
// need to pre-populate it with the HTML document structure
if ( !documentElement && doc.createElement ) {
- (function(){
+ (function() {
var html = doc.createElement('html');
var head = doc.createElement('head');
head.appendChild( doc.createElement('title') );
@@ -397,7 +397,7 @@
return doc;
};
- function makeMap(str){
+ function makeMap(str) {
var obj = {}, items = str.split(',');
for ( var i = 0; i < items.length; i++ ) {
obj[ items[i] ] = true;
@@ -407,7 +407,7 @@
}
})(typeof exports === 'undefined' ? this : exports);
-(function(global){
+(function(global) {
'use strict';
var log, HTMLParser;
@@ -418,7 +418,7 @@
};
}
else {
- log = function(){ };
+ log = function() {};
}
if (global.HTMLParser) {
@@ -695,7 +695,7 @@
function minify(value, options) {
- options = options || { };
+ options = options || {};
value = trimWhitespace(value);
setDefaultTesters(options);
View
@@ -1,5 +1,5 @@
/* global HTMLLint, minify */
-(function(){
+(function() {
'use strict';
function byId(id) {
View
@@ -1,4 +1,4 @@
-(function(global){
+(function(global) {
'use strict';
var log, HTMLParser;
@@ -9,7 +9,7 @@
};
}
else {
- log = function(){ };
+ log = function() {};
}
if (global.HTMLParser) {
@@ -286,7 +286,7 @@
function minify(value, options) {
- options = options || { };
+ options = options || {};
value = trimWhitespace(value);
setDefaultTesters(options);
View
@@ -28,7 +28,7 @@
/* global ActiveXObject, DOMDocument */
-(function(global){
+(function(global) {
'use strict';
// Regular Expressions for parsing tags and attributes
@@ -59,11 +59,11 @@
// Special Elements (can contain anything)
var special = makeMap('script,style');
- var reCache = { }, stackedTag, reStackedTag, tagMatch;
+ var reCache = {}, stackedTag, reStackedTag, tagMatch;
var HTMLParser = global.HTMLParser = function( html, handler ) {
var index, chars, match, stack = [], last = html, prevTag, nextTag;
- stack.last = function(){
+ stack.last = function() {
return this[ this.length - 1 ];
};
@@ -324,7 +324,7 @@
// If we're dealing with an empty document then we
// need to pre-populate it with the HTML document structure
if ( !documentElement && doc.createElement ) {
- (function(){
+ (function() {
var html = doc.createElement('html');
var head = doc.createElement('head');
head.appendChild( doc.createElement('title') );
@@ -392,7 +392,7 @@
return doc;
};
- function makeMap(str){
+ function makeMap(str) {
var obj = {}, items = str.split(',');
for ( var i = 0; i < items.length; i++ ) {
obj[ items[i] ] = true;
View
@@ -12,7 +12,7 @@ testrunner.run({
'./tests/lint.js',
]
}, function(err, report) {
- if(report.failed > 0){
+ if(report.failed > 0) {
process.on('exit', function() {
process.exit(1);
});
View
@@ -1,5 +1,5 @@
/* global test, ok, equal */
-(function(global){
+(function(global) {
'use strict';
var minify = global.minify || require('../dist/htmlminifier.js').minify,
@@ -22,7 +22,7 @@
equal('function', typeof lint.testAttribute, '`testAttribute` method exists');
});
- test('deprecated element (font)', function(){
+ test('deprecated element (font)', function() {
minify('<font>foo</font>', { lint: lint });
var log = lint.log.join('');
Oops, something went wrong.

0 comments on commit ef41072

Please sign in to comment.