Skip to content

Commit ac71331

Browse files
byCedricmarioneblarmano2
authored
refactor: port load to typescript (#786)
* refactor: port load to typescript [wip] * refactor: port load to typescript [wip] * refactor(load): finish port to typescript * fix(cli): unpack load from default when importing * refactor(load): beef up typings * fix(load): repair botched merge * test: port load tests from ava to jest Co-authored-by: Armano <[email protected]> * fix: propagate tightened types * refactor: move out helper functions * test: match prompt-cli tests correctly * fix: add missing dependency on @commitlint/rules * fix: add missing reference * fix: add missing references Co-authored-by: Mario Nebl <[email protected]> Co-authored-by: Armano <[email protected]>
1 parent a474224 commit ac71331

26 files changed

+874
-717
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ insert_final_newline = true
44
trim_trailing_whitespace = true
55
indent_style = tab
66

7-
[{.*rc,*.yml,*.md,package.json,lerna.json,*.svg}]
7+
[{.*rc,*.yml,*.md,package.json,lerna.json,tsconfig.json,tsconfig.*.json,*.svg}]
88
indent_style = space
99

1010
[*.md]

@commitlint/ensure/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ensureCase from './case';
1+
import ensureCase, {TargetCaseType} from './case';
22
import ensureEnum from './enum';
33
import maxLength from './max-length';
44
import maxLineLength from './max-line-length';
@@ -7,5 +7,5 @@ import notEmpty from './not-empty';
77

88
export {ensureCase as case};
99
export {ensureEnum as enum};
10+
export {TargetCaseType};
1011
export {maxLength, maxLineLength, minLength, notEmpty};
11-
export {TargetCaseType} from './case';

@commitlint/execute-rule/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ type ExecutedRule<T> = readonly [string, T];
77
export default execute;
88

99
export async function execute<T = unknown>(
10-
rule: Rule<T>
10+
rule?: Rule<T>
1111
): Promise<ExecutedRule<T> | null> {
1212
if (!Array.isArray(rule)) {
1313
return null;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
rules: {
3-
basic: true
3+
'body-case': [1, 'never', 'camel-case']
44
}
55
};

@commitlint/load/package.json

+5-36
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,14 @@
22
"name": "@commitlint/load",
33
"version": "8.3.5",
44
"description": "Load shared commitlint configuration",
5-
"main": "lib/index.js",
5+
"main": "lib/load.js",
6+
"types": "lib/load.d.ts",
67
"files": [
78
"lib/"
89
],
910
"scripts": {
10-
"build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps",
1111
"deps": "dep-check",
12-
"pkg": "pkg-check --skip-import",
13-
"start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"",
14-
"test": "ava -c 4 --verbose && ava src/index.serial-test.js --verbose",
15-
"watch": "babel src --out-dir lib --watch --source-maps"
16-
},
17-
"ava": {
18-
"files": [
19-
"src/**/*.test.js",
20-
"!lib/**/*"
21-
],
22-
"source": [
23-
"src/**/*.js",
24-
"!lib/**/*"
25-
],
26-
"babel": {
27-
"testOptions": {
28-
"presets": [
29-
"babel-preset-commitlint"
30-
]
31-
}
32-
},
33-
"require": [
34-
"@babel/register"
35-
]
36-
},
37-
"babel": {
38-
"presets": [
39-
"babel-preset-commitlint"
40-
]
12+
"pkg": "pkg-check --skip-import"
4113
},
4214
"engines": {
4315
"node": ">=4"
@@ -62,13 +34,9 @@
6234
},
6335
"license": "MIT",
6436
"devDependencies": {
65-
"@babel/core": "7.7.7",
66-
"@babel/cli": "7.7.7",
67-
"@babel/register": "7.7.7",
6837
"@commitlint/test": "8.2.0",
6938
"@commitlint/utils": "^8.3.4",
70-
"ava": "2.4.0",
71-
"babel-preset-commitlint": "^8.2.0",
39+
"@types/cosmiconfig": "^5.0.3",
7240
"concurrently": "3.6.1",
7341
"cross-env": "6.0.3",
7442
"execa": "0.11.0",
@@ -77,6 +45,7 @@
7745
"dependencies": {
7846
"@commitlint/execute-rule": "^8.3.4",
7947
"@commitlint/resolve-extends": "^8.3.5",
48+
"@commitlint/rules": "^8.3.4",
8049
"chalk": "2.4.2",
8150
"cosmiconfig": "^5.2.0",
8251
"lodash": "4.17.15",

@commitlint/load/src/index.js

-164
This file was deleted.

@commitlint/load/src/index.serial-test.js

-19
This file was deleted.

0 commit comments

Comments
 (0)