Skip to content
Permalink
Browse files

Replace JSHint with ESLint and JSCS

  • Loading branch information
tommy351 committed Nov 1, 2015
1 parent 62373ef commit 85240da3b4bc0ec47e630164829468a5558da538
Showing with 185 additions and 101 deletions.
  1. +3 −0 .eslintignore
  2. +45 −0 .eslintrc
  3. +85 −0 .jscsrc
  4. +0 −14 .jshintrc
  5. +0 −1 .npmignore
  6. +12 −2 .travis.yml
  7. +0 −39 gulpfile.js
  8. +4 −2 index.js
  9. +2 −2 lib/generator.js
  10. +11 −13 package.json
  11. +9 −0 test/.eslintrc
  12. +0 −15 test/.jshintrc
  13. +13 −13 test/index.js
  14. +1 −0 test/mocha.opts
@@ -0,0 +1,3 @@
node_modules/
coverage/
tmp/
@@ -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 .jscsrc
@@ -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
}

This file was deleted.

@@ -2,7 +2,6 @@ test/
tmp/
coverage/
*.log
.jshintrc
.travis.yml
gulpfile.js
.idea/
@@ -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:
- npm install coveralls
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js

This file was deleted.

@@ -1,10 +1,12 @@
/* global hexo */

'use strict';

var assign = require('object-assign');

hexo.config.index_generator = assign({
per_page: typeof hexo.config.per_page === "undefined" ? 10 : hexo.config.per_page,
per_page: typeof hexo.config.per_page === 'undefined' ? 10 : hexo.config.per_page,
order_by: '-date'
}, hexo.config.index_generator);

hexo.extend.generator.register('index', require('./lib/generator'));
hexo.extend.generator.register('index', require('./lib/generator'));
@@ -2,7 +2,7 @@

var pagination = require('hexo-pagination');

module.exports = function(locals){
module.exports = function(locals) {
var config = this.config;
var posts = locals.posts.sort(config.index_generator.order_by);
var paginationDir = config.pagination_dir || 'page';
@@ -15,4 +15,4 @@ module.exports = function(locals){
__index: true
}
});
};
};
@@ -4,7 +4,10 @@
"description": "Index generator for Hexo.",
"main": "index",
"scripts": {
"test": "gulp test"
"eslint": "eslint .",
"jscs": "jscs .",
"test": "mocha test/index.js",
"test-cov": "istanbul cover --print both _mocha -- test/index.js"
},
"directories": {
"lib": "./lib"
@@ -23,20 +26,15 @@
"author": "Tommy Chen <tommy351@gmail.com> (http://zespia.tw)",
"license": "MIT",
"devDependencies": {
"chai": "^1.9.1",
"coveralls": "^2.11.2",
"gulp": "^3.8.9",
"gulp-istanbul": "^0.5.0",
"gulp-jshint": "^1.8.6",
"gulp-load-plugins": "^0.8.0",
"gulp-mocha": "^2.0.0",
"chai": "^3.4.0",
"eslint": "^1.8.0",
"hexo": "^3.0.0",
"jshint-stylish": "^1.0.0",
"mocha": "^2.0.1",
"rimraf": "^2.2.8"
"istanbul": "^0.4.0",
"jscs": "^2.5.0",
"mocha": "^2.0.1"
},
"dependencies": {
"hexo-pagination": "0.0.2",
"object-assign": "^2.0.0"
"object-assign": "^4.0.1"
}
}
}
@@ -0,0 +1,9 @@
{
"extend": "../.eslintrc",
"rules": {
"no-unused-expressions": 0
},
"env": {
"mocha": true
}
}

This file was deleted.

0 comments on commit 85240da

Please sign in to comment.
You can’t perform that action at this time.