Skip to content

Commit a3601b5

Browse files
committed
ci: Lint with XO
1 parent 55c1014 commit a3601b5

File tree

7 files changed

+29
-37
lines changed

7 files changed

+29
-37
lines changed

lib/verify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const verifyPkg = require('./verify-pkg');
2-
const setNpmrcAuth = require('./set-npmrc-auth');
31
const execa = require('execa');
42
const SemanticReleaseError = require('@semantic-release/error');
3+
const verifyPkg = require('./verify-pkg');
4+
const setNpmrcAuth = require('./set-npmrc-auth');
55

66
module.exports = async (pkg, logger) => {
77
verifyPkg(pkg);

package.json

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,39 +32,21 @@
3232
"cz-conventional-changelog": "^2.0.0",
3333
"delay": "^2.0.0",
3434
"dockerode": "^2.5.3",
35-
"eslint": "^4.11.0",
3635
"eslint-config-prettier": "^2.5.0",
37-
"eslint-config-standard": "^10.2.1",
38-
"eslint-plugin-import": "^2.7.0",
39-
"eslint-plugin-node": "^5.2.0",
4036
"eslint-plugin-prettier": "^2.3.0",
41-
"eslint-plugin-promise": "^3.5.0",
42-
"eslint-plugin-standard": "^3.0.1",
4337
"get-stream": "^3.0.0",
4438
"got": "^8.0.0",
4539
"nock": "^9.1.0",
4640
"nyc": "^11.2.1",
4741
"prettier": "~1.8.2",
48-
"rimraf": "^2.5.0",
4942
"semantic-release": "^9.1.1",
5043
"sinon": "^4.1.2",
51-
"tempy": "^0.2.1"
44+
"tempy": "^0.2.1",
45+
"xo": "^0.18.2"
5246
},
5347
"engines": {
5448
"node": ">=4"
5549
},
56-
"eslintConfig": {
57-
"extends": [
58-
"standard",
59-
"prettier"
60-
],
61-
"plugins": [
62-
"prettier"
63-
],
64-
"rules": {
65-
"prettier/prettier": 2
66-
}
67-
},
6850
"files": [
6951
"lib",
7052
"index.js"
@@ -105,12 +87,22 @@
10587
"url": "https://github.com/semantic-release/npm.git"
10688
},
10789
"scripts": {
108-
"clean": "rimraf coverage && rimraf .nyc_output",
10990
"cm": "git-cz",
11091
"codecov": "codecov -f coverage/coverage-final.json",
111-
"lint": "eslint test lib index.js",
112-
"pretest": "npm run clean && npm run lint",
92+
"lint": "xo",
93+
"pretest": "npm run lint",
11394
"semantic-release": "semantic-release",
11495
"test": "nyc ava -v"
96+
},
97+
"xo": {
98+
"extends": [
99+
"prettier"
100+
],
101+
"plugins": [
102+
"prettier"
103+
],
104+
"rules": {
105+
"prettier/prettier": 2
106+
}
115107
}
116108
}

test/get-last-release.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ import test from 'ava';
33
import nock from 'nock';
44
import {stub} from 'sinon';
55
import tempy from 'tempy';
6-
import {registry, mock, available, unpublished} from './helpers/mock-registry';
76
import lastRelease from '../lib/get-last-release';
7+
import {registry, mock, available, unpublished} from './helpers/mock-registry';
88

99
let processStdout;
1010
let processStderr;
1111

12-
test.before(t => {
12+
test.before(() => {
1313
// Disable npm logger during tests
1414
processStdout = stub(process.stdout, 'write');
1515
processStderr = stub(process.stderr, 'write');
1616
});
1717

18-
test.beforeEach(async t => {
18+
test.beforeEach(t => {
1919
// Save the current process.env
2020
t.context.env = Object.assign({}, process.env);
2121
process.env.NPM_TOKEN = 'npm_token';
@@ -43,7 +43,7 @@ test.afterEach.always(t => {
4343
process.chdir(t.context.cwd);
4444
});
4545

46-
test.after.always(t => {
46+
test.after.always(() => {
4747
// Restore stdout and stderr
4848
processStdout.restore();
4949
processStderr.restore();

test/helpers/npm-registry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async function start() {
4242
const url = `http://${SERVER_HOST}:${SERVER_PORT}/registry/_design/app/_rewrite/`;
4343

4444
const authEnv = {
45-
npm_config_registry: url,
45+
npm_config_registry: url, // eslint-disable-line camelcase
4646
NPM_USERNAME,
4747
NPM_PASSWORD,
4848
NPM_EMAIL,

test/integration.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import npmRegistry from './helpers/npm-registry';
1111
let processStderr;
1212
let processStdout;
1313

14-
test.before(async t => {
14+
test.before(async () => {
1515
// Start the local NPM registry
1616
await npmRegistry.start();
1717
// Disable npm logger during tests
1818
processStderr = stub(process.stderr, 'write');
1919
processStdout = stub(process.stdout, 'write');
2020
});
2121

22-
test.beforeEach(async t => {
22+
test.beforeEach(t => {
2323
// Save the current process.env
2424
t.context.env = Object.assign({}, process.env);
2525
// Delete env paramaters that could have been set on the machine running the tests
@@ -48,7 +48,7 @@ test.beforeEach(async t => {
4848
t.context.logger = {log: t.context.log};
4949
});
5050

51-
test.afterEach.always(async t => {
51+
test.afterEach.always(t => {
5252
// Clear `rc` from the npm cache as it cache the relative path of .npmrc files, preventing to load a new file after changing current working directory
5353
clearModule('rc');
5454
// Restore process.env
@@ -57,7 +57,7 @@ test.afterEach.always(async t => {
5757
process.chdir(t.context.cwd);
5858
});
5959

60-
test.after.always(async t => {
60+
test.after.always(async () => {
6161
// Stop the local NPM registry
6262
await npmRegistry.stop();
6363
// Restore stdout and stderr

test/set-npmrc-auth.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import clearModule from 'clear-module';
66
import SemanticReleaseError from '@semantic-release/error';
77
import setNpmrcAuth from '../lib/set-npmrc-auth';
88

9-
test.beforeEach(async t => {
9+
test.beforeEach(t => {
1010
// Save the current process.env
1111
t.context.env = Object.assign({}, process.env);
1212
// Delete env paramaters that could have been set on the machine running the tests
@@ -113,7 +113,7 @@ test.serial('Throw error if "NPM_USERNAME" is missing', async t => {
113113
t.is(error.code, 'ENONPMTOKEN');
114114
});
115115

116-
test.serial('Throw error if "NPM_USERNAME" is missing', async t => {
116+
test.serial('Throw error if "NPM_PASSWORD" is missing', async t => {
117117
process.env.NPM_USERNAME = 'npm_username';
118118
process.env.NPM_EMAIL = 'npm_email';
119119
const error = await t.throws(setNpmrcAuth({name: 'package-name'}, t.context.logger));

test/update-package-version.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import execa from 'execa';
55
import {stub} from 'sinon';
66
import updatePackageVersion from '../lib/update-package-version';
77

8-
test.beforeEach(async t => {
8+
test.beforeEach(t => {
99
t.context.cwd = process.cwd();
1010
process.chdir(tempy.directory());
1111

0 commit comments

Comments
 (0)