Skip to content

Commit dcfad61

Browse files
authored
fix: nicer error messages (#93)
* style: reformat code * refactor(cli): use babel for async/await * fix(cli): nice error message for missing input * chore: add npx * chore: add appropriate run scripts * chore: fix typo
1 parent 4165e8f commit dcfad61

File tree

10 files changed

+254
-252
lines changed

10 files changed

+254
-252
lines changed

@commitlint/cli/cli.test.js

-164
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
{"scripts":{"commitmsg":"commitlint -e"}}
1+
{
2+
"scripts": {},
3+
"devDependencies": {
4+
"husky": "0.14.3"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"scripts": {},
3+
"devDependencies": {
4+
"husky": "0.14.3"
5+
}
6+
}

@commitlint/cli/fixtures/parser-preset/commitlint.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
module.exports = {
2+
parserOpts: {
3+
parserPreset: './parser-preset'
4+
},
25
rules: {
36
'type-enum': [2, 'always', ['type']],
47
'scope-enum': [2, 'always', ['scope']],
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
parserOpts: {
3-
headerPattern: /^(\w*)\((\w*)\)-(\w*)\s(.*)$/,
4-
headerCorrespondence: ['type', 'scope', 'ticket', 'subject']
3+
headerPattern: /^----(\w*)\((\w*)\):\s(.*)$/,
4+
headerCorrespondence: ['type', 'scope', 'subject']
55
}
66
};

@commitlint/cli/package.json

+25-9
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,29 @@
33
"version": "4.2.0",
44
"description": "Lint your commit messages",
55
"bin": {
6-
"commitlint": "cli.js"
6+
"commitlint": "./lib/cli.js"
77
},
88
"scripts": {
9-
"build": "exit 0",
10-
"clean": "exit 0",
11-
"prepublish": "npm test",
12-
"pretest": "dep-check",
13-
"start": "ava --watch --verbose",
14-
"test": "ava $AVA_VERBOSE"
9+
"build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps",
10+
"clean": "rimraf lib",
11+
"prepublish": "npm run build",
12+
"prestart": "dep-check && npm run build",
13+
"pretest": "dep-check && npm run build",
14+
"start": "concurrently \"ava -c 4 --verbose --watch\" \"npm run watch\"",
15+
"test": "ava -c 4 $AVA_VERBOSE",
16+
"watch": "babel src --out-dir lib --watch --source-maps"
1517
},
1618
"ava": {
1719
"files": [
18-
"cli.test.js"
20+
"lib/**/*.test.js"
21+
],
22+
"source": [
23+
"lib/**/*.js"
24+
]
25+
},
26+
"babel": {
27+
"presets": [
28+
"babel-preset-commitlint"
1929
]
2030
},
2131
"xo": false,
@@ -41,13 +51,19 @@
4151
},
4252
"license": "MIT",
4353
"devDependencies": {
54+
"@commitlint/test": "^4.2.0",
4455
"@commitlint/utils": "^4.2.0",
4556
"ava": "^0.18.2",
57+
"babel-cli": "^6.26.0",
58+
"babel-preset-commitlint": "^4.2.0",
59+
"babel-register": "^6.26.0",
60+
"concurrently": "^3.5.0",
61+
"cross-env": "^5.0.5",
4662
"dependency-check": "^2.9.1",
4763
"execa": "^0.7.0",
4864
"mkdirp": "^0.5.1",
4965
"resolve-bin": "^0.4.0",
50-
"rimraf": "^2.6.1",
66+
"rimraf": "^2.6.2",
5167
"sander": "^0.6.0",
5268
"string-to-stream": "^1.1.0",
5369
"tmp": "0.0.33",

0 commit comments

Comments
 (0)