-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update v7.0 #155
Update v7.0 #155
Changes from 14 commits
5ec6794
c72cb65
c1d98b1
a3c9028
af3df75
51b8b6f
aef23ee
f7d6e13
710d2e0
6ed9e73
9426836
2a0e7b2
8478c3f
12562e5
0b56a92
747e596
3306b53
fcf4357
37228c9
12f1077
f25acbf
b3208bc
3d5f42c
0549674
29e9c56
62bb836
67bdeaf
8d7ba00
4d3f5b7
3be4591
805042c
60ee756
c6fff56
0eb5246
2477c7d
e19aa0b
8526032
591f15d
3bc4e8f
38b8a99
951e1fb
9508c41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"extends": "eslint:recommended", | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"rules": { | ||
"arrow-parens": "error", | ||
"arrow-spacing": "error", | ||
"generator-star-spacing": "error", | ||
"no-duplicate-imports": "error", | ||
"no-useless-computed-key": "error", | ||
"no-useless-constructor": "error", | ||
"no-useless-rename": "error", | ||
"no-var": "error", | ||
"object-shorthand": "error", | ||
"prefer-arrow-callback": "error", | ||
"prefer-const": "error", | ||
"prefer-rest-params": "error", | ||
"prefer-spread": "error", | ||
"prefer-template": "error", | ||
"rest-spread-spacing": "error", | ||
"template-curly-spacing": "error", | ||
"yield-star-spacing": "error" | ||
} | ||
} | ||
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
/* eslint no-console: "off" */ | ||
|
||
var fs = require('fs'); | ||
var chalk = require('chalk'); | ||
var program = require('commander'); | ||
|
||
var StyleStats = require('../lib/stylestats'); | ||
var Format = require('../lib/format'); | ||
var specs = require('../lib/specs'); | ||
var util = require('../lib/util'); | ||
const fs = require('fs'); | ||
const chalk = require('chalk'); | ||
const program = require('commander'); | ||
const StyleStats = require('../lib/stylestats'); | ||
const Format = require('../lib/format'); | ||
const specs = require('../lib/specs'); | ||
const util = require('../lib/util'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Next time! I believe you can do that :) |
||
|
||
program | ||
.version(require('../package.json').version) | ||
|
@@ -29,11 +28,13 @@ if (!program.args.length) { | |
} | ||
|
||
// Config | ||
var config = { | ||
requestOptions: {headers: {}} | ||
const config = { | ||
requestOptions: { | ||
headers: {} | ||
} | ||
}; | ||
var MOBILE_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.4 Version/8.0 Safari/600.1.4'; | ||
var numberConfig = { | ||
const MOBILE_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13F69 Safari/601.1'; | ||
const numberConfig = { | ||
"published": false, | ||
"paths": false, | ||
"mostIdentifierSelector": false, | ||
|
@@ -43,7 +44,7 @@ var numberConfig = { | |
"uniqueColors": false, | ||
"propertiesCount": false | ||
}; | ||
var userConfig = {}; | ||
let userConfig = {}; | ||
|
||
if (program.mobile) { | ||
config.requestOptions.headers['User-Agent'] = MOBILE_UA; | ||
|
@@ -52,7 +53,7 @@ if (program.number) { | |
Object.assign(config, numberConfig); | ||
} | ||
if (program.config && util.isFile(program.config)) { | ||
var configString = fs.readFileSync(program.config, { | ||
const configString = fs.readFileSync(program.config, { | ||
encoding: 'utf8' | ||
}); | ||
try { | ||
|
@@ -67,47 +68,48 @@ Object.assign(config, userConfig); | |
|
||
|
||
// Parse | ||
var stats = new StyleStats(program.args, config); | ||
stats.parse(function (error, result) { | ||
const stats = new StyleStats(program.args, config); | ||
stats.parse((error, result) => { | ||
if (error) { | ||
console.log(chalk.red(' [ERROR] ' + error.message)); | ||
console.log(chalk.red(` [ERROR] ${error.message}`)); | ||
} | ||
var format = new Format(result); | ||
const format = new Format(result); | ||
if (fs.existsSync(program.template)) { | ||
|
||
format.setTemplate(fs.readFileSync(program.template, { | ||
encoding: 'utf8' | ||
})); | ||
|
||
format.parseTemplate(function (text) { | ||
format.parseTemplate((text) => { | ||
console.log(text); | ||
}); | ||
|
||
} else if (!program.specs) { | ||
switch (program.format) { | ||
case 'json': | ||
format.toJSON(function (json) { | ||
format.toJSON((json) => { | ||
console.log(json); | ||
}); | ||
break; | ||
case 'csv': | ||
format.toCSV(function (csv) { | ||
format.toCSV((csv) => { | ||
console.log(csv); | ||
}); | ||
break; | ||
case 'html': | ||
format.toHTML(function (html) { | ||
format.toHTML((html) => { | ||
console.log(html); | ||
}); | ||
break; | ||
case 'md': | ||
format.toMarkdown(function (md) { | ||
format.toMarkdown((md) => { | ||
console.log(md); | ||
}); | ||
break; | ||
default: | ||
format.toTable(function (table) { | ||
console.log(' StyleStats!\n' + table); | ||
format.toTable((table) => { | ||
console.log(` StyleStats! | ||
${table}`); | ||
}); | ||
break; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
xo
instead ofeslint
and its config.