Skip to content

Commit

Permalink
Replace JSHint with ESLint and JSCS
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy351 committed Nov 4, 2015
1 parent ee32f57 commit cb685f1
Show file tree
Hide file tree
Showing 39 changed files with 416 additions and 416 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
coverage/
tmp/
45 changes: 45 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"extends": "eslint:recommended",
"root": true,
"rules": {
"curly": [2, "multi-line"],
"no-console": 0,
"no-path-concat": 2,
"handle-callback-err": 2,
"no-use-before-define": [2, "nofunc"],
"no-shadow-restricted-names": 2,
"block-scoped-var": 2,
"dot-notation": 2,
"eqeqeq": [2, "allow-null"],
"no-else-return": 1,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-implied-eval": 2,
"no-lone-blocks": 2,
"no-loop-func": 2,
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-native-reassign": 2,
"no-new-wrappers": 2,
"no-redeclare": 2,
"no-return-assign": 2,
"no-throw-literal": 2,
"no-unused-expressions": [2, {
"allowShortCircuit": true,
"allowTernary": true
}],
"no-useless-call": 2,
"no-useless-concat": 2,
"no-with": 2,
"radix": 2,
"no-self-compare": 2,
"no-unused-vars": [2, {
"vars": "all",
"args": "none"
}],
"strict": [2, "global"]
},
"env": {
"node": true
}
}
85 changes: 85 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"excludeFiles": ["node_modules/**", "coverage/**", "tmp/**"],
"validateIndentation": 2,
"validateLineBreaks": "LF",
"validateQuoteMarks": "'",
"requireSemicolons": true,
"disallowEmptyBlocks": true,
"disallowKeywordsOnNewLine": ["else"],
"disallowKeywords": ["with"],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineBreaks": true,
"disallowMultipleLineStrings": true,
"disallowMultipleVarDecl": "exceptUndefined",
"disallowNewlineBeforeBlockStatements": true,
"disallowOperatorBeforeLineBreak": ["."],
"disallowSpaceBeforeBinaryOperators": [","],
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforeComma": true,
"disallowSpaceBeforePostfixUnaryOperators": true,
"disallowSpaceBeforeSemicolon": true,
"disallowSpacesInCallExpression": true,
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInsideParentheses": true,
"disallowSpacesInsideParenthesizedExpression": {
"allExcept": [ "{", "}" ]
},
"disallowTrailingComma": true,
"disallowTrailingWhitespace": true,
"disallowYodaConditions": true,
"requireBlocksOnNewline": true,
"requireCapitalizedConstructors": true,
"requireCommaBeforeLineBreak": true,
"requireCurlyBraces": [
"for",
"while",
"do",
"try",
"catch"
],
"requireDotNotation": true,
"requireLineBreakAfterVariableAssignment": true,
"requireLineFeedAtFileEnd": true,
"requirePaddingNewLinesAfterBlocks": true,
"requirePaddingNewLinesAfterUseStrict": true,
"requireParenthesesAroundIIFE": true,
"requireSpaceAfterBinaryOperators": true,
"requireSpaceAfterKeywords": [
"do",
"for",
"if",
"else",
"switch",
"case",
"try",
"catch",
"void",
"while",
"with",
"return",
"typeof"
],
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceBeforeBlockStatements": true,
"requireSpaceBetweenArguments": true,
"requireSpacesInFunction": {
"beforeOpeningCurlyBrace": true
},
"requireSpacesInConditionalExpression": true,
"requireSpacesInForStatement": true,
"requireSpacesInFunctionDeclaration": {
"beforeOpeningCurlyBrace": true
},
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"validateNewlineAfterArrayElements": true,
"validateParameterSeparator": ", ",
"disallowMultipleSpaces": true
}
14 changes: 0 additions & 14 deletions .jshintrc

This file was deleted.

16 changes: 13 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
language: node_js

sudo: false

cache:
apt: true
directories:
- node_modules

node_js:
- "0.10"
- "0.12"
- iojs
- "4"

script:
- npm test
- npm run eslint
- npm run jscs
- npm run test-cov

after_script:
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
- npm install coveralls
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
31 changes: 0 additions & 31 deletions benchmark/fixtures/q3.js

This file was deleted.

51 changes: 0 additions & 51 deletions benchmark/highlight.js

This file was deleted.

52 changes: 0 additions & 52 deletions gulpfile.js

This file was deleted.

8 changes: 4 additions & 4 deletions lib/escape_diacritic.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,19 @@ var defaultDiacriticsRemovalap = [

var diacriticsMap = {};

for (var i = 0; i < defaultDiacriticsRemovalap.length; i++){
for (var i = 0; i < defaultDiacriticsRemovalap.length; i++) {
var letters = defaultDiacriticsRemovalap[i].letters.split('');

for (var j = 0; j < letters.length ; j++){
for (var j = 0; j < letters.length; j++) {
diacriticsMap[letters[j]] = defaultDiacriticsRemovalap[i].base;
}
}

module.exports = function(str){
module.exports = function(str) {
if (typeof str !== 'string') throw new TypeError('str must be a string!');

// http://stackoverflow.com/a/18391901
return str.replace(/[^\u0000-\u007E]/g, function(a){
return str.replace(/[^\u0000-\u007E]/g, function(a) {
return diacriticsMap[a] || a;
});
};
4 changes: 2 additions & 2 deletions lib/escape_html.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ var htmlEntityMap = {
'/': '&#x2F;'
};

module.exports = function(str){
module.exports = function(str) {
if (typeof str !== 'string') throw new TypeError('str must be a string!');

// http://stackoverflow.com/a/12034334
return str.replace(/[&<>"'\/]/g, function(a){
return str.replace(/[&<>"'\/]/g, function(a) {
return htmlEntityMap[a];
});
};
2 changes: 1 addition & 1 deletion lib/escape_regexp.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

module.exports = function(str){
module.exports = function(str) {
if (typeof str !== 'string') throw new TypeError('str must be a string!');

// http://stackoverflow.com/a/6969486
Expand Down
Loading

0 comments on commit cb685f1

Please sign in to comment.