Skip to content

Commit

Permalink
upgrade eslint & its ilk
Browse files Browse the repository at this point in the history
- also upgrade `lint-staged`, because it's broken for some reason
- reformat
- lint
- remove `prettier-eslint-cli`
- update formatting command to handle JSON & YAML files via prettier,
  and eslint for everything else
- update `.lintstagedrc` to deal as well

test file changes are related to deprecations of various `assert` methods
  • Loading branch information
boneskull committed Dec 18, 2018
1 parent 89169cd commit 68c24cc
Show file tree
Hide file tree
Showing 23 changed files with 728 additions and 919 deletions.
24 changes: 9 additions & 15 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ parserOptions:
ecmaVersion: 5
ecmaFeatures:
globalReturn: no
experimentalObjectRestSpread: no
jsx: no
sourceType: script
rules:
Expand All @@ -18,30 +17,25 @@ rules:
- safe
overrides:
- files:
- scripts/**/*.js
- package-scripts.js
- karma.conf.js
- .wallaby.js
- bin/*
- lib/cli/**/*.js
- test/node-unit/**/*.js
- scripts/**/*.js
- package-scripts.js
- karma.conf.js
- .wallaby.js
- bin/*
- lib/cli/**/*.js
- test/node-unit/**/*.js
parserOptions:
ecmaVersion: 6
env:
browser: no
- files:
- test/**/*.{js,mjs}
- test/**/*.{js,mjs}
env:
mocha: yes
globals:
expect: no
- files:
- doc/**/*.js
env:
node: no
- files:
- test/**/*.mjs
- test/**/*.mjs
parserOptions:
ecmaVersion: 6
sourceType: module

3 changes: 2 additions & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"linters": {
"(bin/*|*.{js,json}|**/*.{js,json})": ["prettier-eslint --write", "git add"]
"(bin/*|*.js|**/*.js)": ["eslint --fix", "git add"],
"(*.{json,yml}|**/*.{json,yml})": ["prettier --write", "git add"]
},
"ignore": ["docs/**/*.js", "test/**/*.fixture.js", "package*.json"]
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ node_js: '11'
addons:
apt:
packages:
- libnotify-bin
- libnotify-bin
# `nvm install` happens before the cache is restored, which means
# we must install our own npm elsewhere (`~/npm`)
before_install: |
Expand Down
3 changes: 1 addition & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ module.exports = config => {
browserify: {
debug: true,
configure: function configure(b) {
b
.ignore('glob')
b.ignore('glob')
.ignore('fs')
.ignore('path')
.ignore('supports-color')
Expand Down
2 changes: 1 addition & 1 deletion lib/reporters/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function HTML(runner) {

function updateStats() {
// TODO: add to stats
var percent = (stats.tests / runner.total * 100) | 0;
var percent = ((stats.tests / runner.total) * 100) | 0;
if (progress) {
progress.update(percent).draw(ctx);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/reporters/landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function Landing(runner) {

runner.on('test end', function(test) {
// check if the plane crashed
var col = crashed === -1 ? (width * ++n / total) | 0 : crashed;
var col = crashed === -1 ? ((width * ++n) / total) | 0 : crashed;

// show the crash
if (test.state === 'failed') {
Expand Down
6 changes: 3 additions & 3 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -710,9 +710,9 @@ Runner.prototype.uncaught = function(err) {
debug(
'uncaught exception %s',
err ===
function() {
return this;
}.call(err)
function() {
return this;
}.call(err)
? err.message || err
: err
);
Expand Down
3 changes: 1 addition & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ exports.files = function(dir, ext, ret) {

var re = new RegExp('\\.(' + ext.join('|') + ')$');

fs
.readdirSync(dir)
fs.readdirSync(dir)
.filter(ignored)
.forEach(function(path) {
path = join(dir, path);
Expand Down
Loading

0 comments on commit 68c24cc

Please sign in to comment.