mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 07:40:10 +00:00
feat: add @commitlint/load (#42616)
* feat: add @commitlint/load * fix: remove trailing comma in json * fix: allow optional const enum This const enum is not required for the definition to be useful.
This commit is contained in:
12
types/commitlint__load/commitlint__load-tests.ts
Normal file
12
types/commitlint__load/commitlint__load-tests.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import commitlintLoad, { Level } from '@commitlint/load';
|
||||
|
||||
// $ExpectType Promise<CommitlintConfig>
|
||||
commitlintLoad();
|
||||
|
||||
commitlintLoad().then(config => {
|
||||
config.rules["body-leading-blank"] = [Level.Warn, 'always', undefined];
|
||||
config.rules["body-max-length"] = [1, 'never', 72];
|
||||
config.rules["header-case"] = [Level.Disable, 'always', 'camel-case'];
|
||||
config.rules["type-enum"] = [Level.Error, 'always', ['foo', 'bar', 'baz']];
|
||||
config.extends = ['foo'];
|
||||
});
|
||||
68
types/commitlint__load/index.d.ts
vendored
Normal file
68
types/commitlint__load/index.d.ts
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
// Type definitions for @commitlint/load 8.3
|
||||
// Project: https://github.com/conventional-changelog/commitlint
|
||||
// Definitions by: Martin McWhorter <https://github.com/martinmcwhorter>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export default function commitlintLoad(): Promise<CommitlintConfig>;
|
||||
|
||||
export type Case =
|
||||
| 'lower-case'
|
||||
| 'lowercase'
|
||||
| 'lowerCase'
|
||||
| 'upper-case'
|
||||
| 'uppercase'
|
||||
| 'camel-case'
|
||||
| 'kebab-case'
|
||||
| 'pascal-case'
|
||||
| 'sentence-case'
|
||||
| 'sentencecase'
|
||||
| 'start-case'
|
||||
| 'snake-case';
|
||||
|
||||
export type Applicability = 'always' | 'never';
|
||||
|
||||
export type Rule<T> = [Level | 0 | 1 | 2, Applicability, T];
|
||||
|
||||
export interface Rules {
|
||||
'body-leading-blank'?: Rule<undefined>;
|
||||
'body-max-length'?: Rule<number>;
|
||||
'body-max-line-length'?: Rule<number>;
|
||||
'body-min-length'?: Rule<number>;
|
||||
'footer-leading-blank'?: Rule<undefined>;
|
||||
'footer-max-length'?: Rule<number>;
|
||||
'footer-min-length'?: Rule<number>;
|
||||
'footer-max-line-length'?: Rule<number>;
|
||||
'header-case'?: Rule<Case>;
|
||||
'header-full-stop'?: Rule<string>;
|
||||
'header-max-length'?: Rule<number>;
|
||||
'header-min-length'?: Rule<number>;
|
||||
'references-empty'?: Rule<undefined>;
|
||||
'scope-enum'?: Rule<string[]>;
|
||||
'scope-case'?: Rule<Case>;
|
||||
'scope-empty'?: Rule<undefined>;
|
||||
'scope-max-length'?: Rule<number>;
|
||||
'scope-min-length'?: Rule<number>;
|
||||
'subject-case'?: Rule<Case | Case[]>;
|
||||
'subject-empty'?: Rule<undefined>;
|
||||
'subject-full-stop'?: Rule<string>;
|
||||
'subject-max-length'?: Rule<number>;
|
||||
'subject-min-length'?: Rule<number>;
|
||||
'type-enum'?: Rule<string[]>;
|
||||
'type-case'?: Rule<Case>;
|
||||
'type-empty'?: Rule<undefined>;
|
||||
'type-max-length'?: Rule<number>;
|
||||
'type-min-length'?: Rule<number>;
|
||||
'signed-off-by'?: Rule<string>;
|
||||
}
|
||||
|
||||
export interface CommitlintConfig {
|
||||
extends?: string[];
|
||||
rules: Rules;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:no-const-enum
|
||||
export const enum Level {
|
||||
Disable = 0,
|
||||
Warn = 1,
|
||||
Error = 2,
|
||||
}
|
||||
26
types/commitlint__load/tsconfig.json
Normal file
26
types/commitlint__load/tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@commitlint/load": ["commitlint__load"]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"commitlint__load-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/commitlint__load/tslint.json
Normal file
1
types/commitlint__load/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user