Skip to content

Commit

Permalink
refactor: port load to typescript (#786)
Browse files Browse the repository at this point in the history
* 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 <armano2@users.noreply.github.com>

* 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 <marionebl@users.noreply.github.com>
Co-authored-by: Armano <armano2@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 3, 2020
1 parent a474224 commit ac71331
Show file tree
Hide file tree
Showing 26 changed files with 874 additions and 717 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Expand Up @@ -4,7 +4,7 @@ insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[{.*rc,*.yml,*.md,package.json,lerna.json,*.svg}]
[{.*rc,*.yml,*.md,package.json,lerna.json,tsconfig.json,tsconfig.*.json,*.svg}]
indent_style = space

[*.md]
Expand Down
4 changes: 2 additions & 2 deletions @commitlint/ensure/src/index.ts
@@ -1,4 +1,4 @@
import ensureCase from './case';
import ensureCase, {TargetCaseType} from './case';
import ensureEnum from './enum';
import maxLength from './max-length';
import maxLineLength from './max-line-length';
Expand All @@ -7,5 +7,5 @@ import notEmpty from './not-empty';

export {ensureCase as case};
export {ensureEnum as enum};
export {TargetCaseType};
export {maxLength, maxLineLength, minLength, notEmpty};
export {TargetCaseType} from './case';
2 changes: 1 addition & 1 deletion @commitlint/execute-rule/src/index.ts
Expand Up @@ -7,7 +7,7 @@ type ExecutedRule<T> = readonly [string, T];
export default execute;

export async function execute<T = unknown>(
rule: Rule<T>
rule?: Rule<T>
): Promise<ExecutedRule<T> | null> {
if (!Array.isArray(rule)) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion @commitlint/load/fixtures/basic/commitlint.config.js
@@ -1,5 +1,5 @@
module.exports = {
rules: {
basic: true
'body-case': [1, 'never', 'camel-case']
}
};
41 changes: 5 additions & 36 deletions @commitlint/load/package.json
Expand Up @@ -2,42 +2,14 @@
"name": "@commitlint/load",
"version": "8.3.5",
"description": "Load shared commitlint configuration",
"main": "lib/index.js",
"main": "lib/load.js",
"types": "lib/load.d.ts",
"files": [
"lib/"
],
"scripts": {
"build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps",
"deps": "dep-check",
"pkg": "pkg-check --skip-import",
"start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"",
"test": "ava -c 4 --verbose && ava src/index.serial-test.js --verbose",
"watch": "babel src --out-dir lib --watch --source-maps"
},
"ava": {
"files": [
"src/**/*.test.js",
"!lib/**/*"
],
"source": [
"src/**/*.js",
"!lib/**/*"
],
"babel": {
"testOptions": {
"presets": [
"babel-preset-commitlint"
]
}
},
"require": [
"@babel/register"
]
},
"babel": {
"presets": [
"babel-preset-commitlint"
]
"pkg": "pkg-check --skip-import"
},
"engines": {
"node": ">=4"
Expand All @@ -62,13 +34,9 @@
},
"license": "MIT",
"devDependencies": {
"@babel/core": "7.7.7",
"@babel/cli": "7.7.7",
"@babel/register": "7.7.7",
"@commitlint/test": "8.2.0",
"@commitlint/utils": "^8.3.4",
"ava": "2.4.0",
"babel-preset-commitlint": "^8.2.0",
"@types/cosmiconfig": "^5.0.3",
"concurrently": "3.6.1",
"cross-env": "6.0.3",
"execa": "0.11.0",
Expand All @@ -77,6 +45,7 @@
"dependencies": {
"@commitlint/execute-rule": "^8.3.4",
"@commitlint/resolve-extends": "^8.3.5",
"@commitlint/rules": "^8.3.4",
"chalk": "2.4.2",
"cosmiconfig": "^5.2.0",
"lodash": "4.17.15",
Expand Down
164 changes: 0 additions & 164 deletions @commitlint/load/src/index.js

This file was deleted.

19 changes: 0 additions & 19 deletions @commitlint/load/src/index.serial-test.js

This file was deleted.

0 comments on commit ac71331

Please sign in to comment.