Skip to content

Commit 302f9f7

Browse files
committed
ci: Lint with XO
1 parent 32b0b17 commit 302f9f7

File tree

3 files changed

+17
-31
lines changed

3 files changed

+17
-31
lines changed

lib/index.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ const compareReleaseTypes = require('./compare-release-types');
88
const RELEASE_TYPES = require('./default/release-types');
99
const DEFAULT_RELEASE_RULES = require('./default/release-rules');
1010

11-
/**
12-
* @callback commitAnalyzerCallback
13-
* @param {Error} error error object.
14-
* @param {string} changelog changelog generated by the plugin.
15-
*/
16-
1711
/**
1812
* Determine the type of release to create based on a list of commits.
1913
*
@@ -24,9 +18,8 @@ const DEFAULT_RELEASE_RULES = require('./default/release-rules');
2418
* @param {Object} pluginConfig.parserOpts additional `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`.
2519
* @param {Object} options semantic-release options
2620
* @param {Array} options.commits array of commits
27-
* @param {commitAnalyzerCallback} callback The callback called with the release type.
2821
*/
29-
async function commitAnalyzer(pluginConfig, {commits, logger}, callback) {
22+
async function commitAnalyzer(pluginConfig, {commits, logger}) {
3023
const releaseRules = loadReleaseRules(pluginConfig);
3124
const config = await loadParserConfig(pluginConfig);
3225
let releaseType = null;

lib/load/release-rules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = ({releaseRules}) => {
2020
: releaseRules;
2121

2222
if (!Array.isArray(loadedReleaseRules)) {
23-
throw new Error('Error in commit-analyzer configuration: "releaseRules" must be an array of rules');
23+
throw new TypeError('Error in commit-analyzer configuration: "releaseRules" must be an array of rules');
2424
}
2525

2626
loadedReleaseRules.forEach(rule => {

package.json

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,18 @@
3232
"conventional-changelog-express": "^0.2.0",
3333
"conventional-changelog-jshint": "^0.2.0",
3434
"cz-conventional-changelog": "^2.0.0",
35-
"eslint": "^4.5.0",
3635
"eslint-config-prettier": "^2.3.0",
37-
"eslint-config-standard": "^10.2.1",
38-
"eslint-plugin-import": "^2.7.0",
39-
"eslint-plugin-node": "^5.1.1",
4036
"eslint-plugin-prettier": "^2.3.0",
41-
"eslint-plugin-promise": "^3.5.0",
42-
"eslint-plugin-standard": "^3.0.1",
4337
"nyc": "^11.1.0",
4438
"prettier": "~1.8.0",
4539
"rimraf": "^2.6.1",
4640
"semantic-release": "^9.0.2",
47-
"sinon": "^4.0.2"
41+
"sinon": "^4.0.2",
42+
"xo": "^0.18.2"
4843
},
4944
"engines": {
5045
"node": ">=4"
5146
},
52-
"eslintConfig": {
53-
"extends": [
54-
"standard",
55-
"prettier"
56-
],
57-
"plugins": [
58-
"prettier"
59-
],
60-
"rules": {
61-
"prettier/prettier": 2
62-
}
63-
},
6447
"files": [
6548
"lib"
6649
],
@@ -107,12 +90,22 @@
10790
"url": "https://github.com/semantic-release/commit-analyzer.git"
10891
},
10992
"scripts": {
110-
"clean": "rimraf coverage && rimraf .nyc_output",
11193
"cm": "git-cz",
11294
"codecov": "codecov -f coverage/coverage-final.json",
113-
"lint": "eslint lib test",
114-
"pretest": "npm run clean && npm run lint",
95+
"lint": "xo",
96+
"pretest": "npm run lint",
11597
"semantic-release": "semantic-release",
11698
"test": "nyc ava -v"
99+
},
100+
"xo": {
101+
"extends": [
102+
"prettier"
103+
],
104+
"plugins": [
105+
"prettier"
106+
],
107+
"rules": {
108+
"prettier/prettier": 2
109+
}
117110
}
118111
}

0 commit comments

Comments
 (0)