Skip to content

Commit

Permalink
add jscs and code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Oct 11, 2015
1 parent 94b4404 commit 2e80309
Show file tree
Hide file tree
Showing 13 changed files with 307 additions and 123 deletions.
207 changes: 207 additions & 0 deletions .jscsrc
@@ -0,0 +1,207 @@
{
"excludeFiles": [
"./docs",
"./dist",
"./node_modules",
"./lib/parser"
],

"disallowEmptyBlocks": true,

"disallowImplicitTypeConversion": ["numeric", "boolean", "binary", "string"],

"disallowKeywords": ["with"],

"disallowKeywordsOnNewLine": ["else", "catch", "finally"],

"disallowMixedSpacesAndTabs": true,

"disallowMultipleLineBreaks": true,

"disallowMultipleLineStrings": true,

"disallowNewlineBeforeBlockStatements": true,

"disallowOperatorBeforeLineBreak": ["."],

"disallowSpaceAfterObjectKeys": true,

"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],

"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],

"disallowSpacesInCallExpression": true,

"disallowSpacesInFunction": {
"beforeOpeningRoundBrace": true
},

"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},

"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},

"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},

"disallowSpacesInsideArrayBrackets": "all",

"disallowSpacesInsideParentheses": true,

"disallowTrailingComma": true,

"disallowTrailingWhitespace": true,

"disallowYodaConditions": true,

"requireBlocksOnNewline": true,

"requireCamelCaseOrUpperCaseIdentifiers": true,

"requireCapitalizedConstructors": true,

"requireCommaBeforeLineBreak": true,

"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch",
"finally"
],

"requireDotNotation": true,

"requireKeywordsOnNewLine": ["return", "for", "try", "do", "switch", "case"],

"requireLineBreakAfterVariableAssignment": true,

"requireLineFeedAtFileEnd": true,

"disallowMultipleVarDecl": true,

"requireOperatorBeforeLineBreak": [
"=",
"+",
"-",
"/",
"*",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],

"requireParenthesesAroundIIFE": true,

"requireSpaceAfterBinaryOperators": [
"=",
",",
"+",
"-",
"/",
"*",
"==",
"===",
"!=",
"!==",
"<",
">",
"<=",
">=",
"%"
],

"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"case",
"return",
"try",
"catch",
"finally",
"typeof"
],

"requireSpaceAfterLineComment": true,

"requireSpaceBeforeBinaryOperators": [
"=",
"+",
"-",
"/",
"*",
"==",
"===",
"!=",
"!==",
"<",
">",
"<=",
">=",
"%"
],

"requireSpaceBeforeBlockStatements": true,

"requireSpaceBeforeKeywords": [
"else",
"while",
"catch",
"finally"
],

"requireSpaceBeforeObjectValues": true,

"requireSpaceBetweenArguments": true,

"requireSpacesInConditionalExpression": {
"afterTest": true,
"beforeConsequent": true,
"afterConsequent": true,
"beforeAlternate": true
},

"requireSpacesInForStatement": true,

"requireSpacesInFunction": {
"beforeOpeningCurlyBrace": true
},

"requireSpacesInFunctionDeclaration": {
"beforeOpeningCurlyBrace": true
},

"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},

"requireSpacesInNamedFunctionExpression": {
"beforeOpeningCurlyBrace": true
},

"requireSpacesInsideObjectBrackets": "all",

"validateIndentation": 4,

"validateLineBreaks": "LF",

"validateParameterSeparator": ", ",

"validateQuoteMarks": { "mark": "'", "escape": true }
}
4 changes: 2 additions & 2 deletions bin/csso
Expand Up @@ -4,13 +4,13 @@ var cli = require('../lib/cli.js');

try {
cli.run();
} catch(e) {
} catch (e) {
// output user frendly message if cli error
if (cli.isCliError(e)) {
console.error(e.message || e);
process.exit(2);
}

// otherwise re-throw exception
throw e;
}
5 changes: 0 additions & 5 deletions docs/.bem/level.js

This file was deleted.

19 changes: 0 additions & 19 deletions docs/.bem/techs/md.js

This file was deleted.

4 changes: 2 additions & 2 deletions lib/cli.js
Expand Up @@ -33,7 +33,7 @@ var command = cli.create('csso', '[input] [output]')
var structureOptimisationOff = this.values.restructureOff;
var debug = this.values.debug;
var input = inputFile ? fs.createReadStream(inputFile) : process.stdin;

readFromStream(input, function(source) {
var result = csso.minify(source, {
restruturing: !structureOptimisationOff,
Expand All @@ -50,7 +50,7 @@ var command = cli.create('csso', '[input] [output]')

module.exports = {
run: command.run.bind(command),
isCliError: function(err){
isCliError: function(err) {
return err instanceof cli.Error;
}
};
76 changes: 38 additions & 38 deletions lib/compressor/const.js
Expand Up @@ -411,42 +411,42 @@ exports.colorNameToHex = {
};

exports.colorHexToName = {
"800000": "maroon",
"800080": "purple",
"808000": "olive",
"808080": "gray",
"00ffff": "cyan",
"f0ffff": "azure",
"f5f5dc": "beige",
"ffe4c4": "bisque",
"000000": "black",
"0000ff": "blue",
"a52a2a": "brown",
"ff7f50": "coral",
"ffd700": "gold",
"008000": "green",
"4b0082": "indigo",
"fffff0": "ivory",
"f0e68c": "khaki",
"00ff00": "lime",
"faf0e6": "linen",
"000080": "navy",
"ffa500": "orange",
"da70d6": "orchid",
"cd853f": "peru",
"ffc0cb": "pink",
"dda0dd": "plum",
"f00": "red",
"ff0000": "red",
"fa8072": "salmon",
"a0522d": "sienna",
"c0c0c0": "silver",
"fffafa": "snow",
"d2b48c": "tan",
"008080": "teal",
"ff6347": "tomato",
"ee82ee": "violet",
"f5deb3": "wheat",
"ffffff": "white",
"ffff00": "yellow"
'800000': 'maroon',
'800080': 'purple',
'808000': 'olive',
'808080': 'gray',
'00ffff': 'cyan',
'f0ffff': 'azure',
'f5f5dc': 'beige',
'ffe4c4': 'bisque',
'000000': 'black',
'0000ff': 'blue',
'a52a2a': 'brown',
'ff7f50': 'coral',
'ffd700': 'gold',
'008000': 'green',
'4b0082': 'indigo',
'fffff0': 'ivory',
'f0e68c': 'khaki',
'00ff00': 'lime',
'faf0e6': 'linen',
'000080': 'navy',
'ffa500': 'orange',
'da70d6': 'orchid',
'cd853f': 'peru',
'ffc0cb': 'pink',
'dda0dd': 'plum',
'f00': 'red',
'ff0000': 'red',
'fa8072': 'salmon',
'a0522d': 'sienna',
'c0c0c0': 'silver',
'fffafa': 'snow',
'd2b48c': 'tan',
'008080': 'teal',
'ff6347': 'tomato',
'ee82ee': 'violet',
'f5deb3': 'wheat',
'ffffff': 'white',
'ffff00': 'yellow'
};

0 comments on commit 2e80309

Please sign in to comment.