Skip to content

Commit

Permalink
Use eslint-config-hexo and jscs-preset-hexo
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy351 committed Feb 6, 2016
1 parent 8d1734c commit fac27c0
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 83 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/
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "hexo",
"root": true
}
4 changes: 4 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"excludeFiles": ["node_modules/**", "coverage/**", "tmp/**"],
"preset": "hexo"
}
13 changes: 0 additions & 13 deletions .jshintrc

This file was deleted.

1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ test/
tmp/
coverage/
*.log
.jshintrc
.travis.yml
gulpfile.js
.idea/
Expand Down
18 changes: 14 additions & 4 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"
- "5"

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
37 changes: 0 additions & 37 deletions gulpfile.js

This file was deleted.

3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* global hexo */
'use strict';

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

Expand Down
2 changes: 2 additions & 0 deletions lib/generator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var nunjucks = require('nunjucks');
var env = new nunjucks.Environment();
var pathFn = require('path');
Expand Down
23 changes: 10 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"description": "Feed generator plugin 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"
},
"engines": {
"node": ">= 0.10.0"
},
"repository": "hexojs/hexo-generator-feed",
"keywords": [
"hexo",
Expand All @@ -29,15 +29,12 @@
"devDependencies": {
"chai": "^3.2.0",
"cheerio": "^0.19.0",
"coveralls": "^2.11.2",
"gulp": "^3.8.9",
"gulp-istanbul": "^0.10.0",
"gulp-jshint": "^1.8.6",
"gulp-load-plugins": "^0.10.0",
"gulp-mocha": "^2.0.0",
"eslint": "^1.10.3",
"eslint-config-hexo": "^1.0.2",
"hexo": "^3.0.0",
"jshint-stylish": "^2.0.1",
"jscs": "^2.9.0",
"jscs-preset-hexo": "^1.0.1",
"mocha": "^2.0.1",
"rimraf": "^2.2.8"
"istanbul": "^0.4.2"
}
}
}
3 changes: 3 additions & 0 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "hexo/test"
}
24 changes: 9 additions & 15 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
var should = require('chai').should();
'use strict';

var should = require('chai').should(); // eslint-disable-line
var Hexo = require('hexo');
var nunjucks = require('nunjucks');
var env = new nunjucks.Environment();
Expand Down Expand Up @@ -36,19 +38,11 @@ describe('Feed generator', function() {
var locals;

before(function() {
return Post.insert([{
source: 'foo',
slug: 'foo',
date: 1e8
}, {
source: 'bar',
slug: 'bar',
date: 1e8 + 1
}, {
source: 'baz',
slug: 'baz',
date: 1e8 - 1
}]).then(function(data) {
return Post.insert([
{source: 'foo', slug: 'foo', date: 1e8},
{source: 'bar', slug: 'bar', date: 1e8 + 1},
{source: 'baz', slug: 'baz', date: 1e8 - 1}
]).then(function(data) {
posts = Post.sort('-date');
locals = hexo.locals.toObject();
});
Expand Down Expand Up @@ -124,7 +118,7 @@ describe('Feed generator', function() {

$('feed>id').text().should.eql(valid);
$('feed>entry>link').attr('href').should.eql(valid);
}
};

checkURL('http://localhost/', '/', 'http://localhost/');

Expand Down
1 change: 1 addition & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--reporter spec

0 comments on commit fac27c0

Please sign in to comment.