Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# deps
node_modules
packages/**/node_modules
packages/**/node_modules

# dist
dist
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
"commitlint-wizardoc-e2e-tests"
],
"dependencies": {}
}
}
12 changes: 2 additions & 10 deletions packages/commitlint-config-wizardoc/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
import { LexicalElement } from "./typings";
declare const config: {
parserOpts: {
headerPattern: RegExp;
headerCorrespondence: LexicalElement[];
};
rules: {
"body-leading-blank": (string | number)[];
};
};
import { UserConfig } from "@commitlint/types";
declare const config: UserConfig;
export = config;
32 changes: 23 additions & 9 deletions packages/commitlint-config-wizardoc/dist/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
"use strict";
const typings_1 = require("./typings");
const constants_1 = require("./constants");
const enum_1 = require("./utils/enum");
const config = {
parserOpts: {
headerPattern: /^\[(\w*)::(\w*)\]\s(.*)$/,
headerCorrespondence: [
typings_1.LexicalElement.TYPE,
typings_1.LexicalElement.SCOPE,
typings_1.LexicalElement.SUBJECT,
],
parserPreset: {
name: "",
path: "",
parserOpts: {
headerPattern: constants_1.CONVERSION_MATCH_REGEX,
headerCorrespondence: [
constants_1.LexicalElement.TYPE,
constants_1.LexicalElement.SCOPE,
constants_1.LexicalElement.SUBJECT,
],
},
},
rules: {
"body-leading-blank": [1, "always"],
// 'subject-exclamation-mark': [2, 'never'],
"footer-leading-blank": [1, "always"],
"header-max-length": [2, "always", 72],
// 'scope-case': [2, 'always', 'lower-case'],
"subject-case": [2, "never", ["upper-case"]],
// 'subject-empty': [2, 'never'],
"subject-full-stop": [2, "never", "."],
"type-empty": [2, "never"],
"scope-empty": [1, "never"],
"type-enum": [2, "always", enum_1.enumerateValues(constants_1.CommitType)],
},
};
module.exports = config;
6 changes: 0 additions & 6 deletions packages/commitlint-config-wizardoc/dist/typings.d.ts

This file was deleted.

9 changes: 0 additions & 9 deletions packages/commitlint-config-wizardoc/dist/typings.js

This file was deleted.

8 changes: 7 additions & 1 deletion packages/commitlint-config-wizardoc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@
"license": "MIT",
"scripts": {
"compile": "tsc"
}
},
"devDependencies": {
"@commitlint/config-conventional": "^12.1.4",
"@commitlint/parse": "^12.1.4",
"@commitlint/types": "^12.1.4"
},
"dependencies": {}
}
22 changes: 22 additions & 0 deletions packages/commitlint-config-wizardoc/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export enum LexicalElement {
SUBJECT = "subject",
TYPE = "type",
SCOPE = "scope",
TICKET = "ticket",
}

export enum CommitType {
FEAT = "Feat",
INIT = "Init",
REMOVE = "Remove",
DELETE = "Delete",
MOVE = "Move",
NEW = "New",
ADD = "Add",
PATCH = "Patch",
FIX = "Fix",
TEST = "Test",
STUB = "Stub",
}

export const CONVERSION_MATCH_REGEX = /^\[(\w+?)(?:\:\:(\w*))?\]\s(.*)$/;
39 changes: 29 additions & 10 deletions packages/commitlint-config-wizardoc/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
import { LexicalElement } from "./typings";
import {
LexicalElement,
CommitType,
CONVERSION_MATCH_REGEX,
} from "./constants";
import { UserConfig } from "@commitlint/types";
import { enumerateValues } from "./utils/enum";

const config = {
parserOpts: {
headerPattern: /^\[(\w*)::(\w*)\]\s(.*)$/,
headerCorrespondence: [
LexicalElement.TYPE,
LexicalElement.SCOPE,
LexicalElement.SUBJECT,
],
const config: UserConfig = {
parserPreset: {
name: "",
path: "",
parserOpts: {
headerPattern: CONVERSION_MATCH_REGEX,
headerCorrespondence: [
LexicalElement.TYPE,
LexicalElement.SCOPE,
LexicalElement.SUBJECT,
],
},
},
rules: {
"body-leading-blank": [1, "always"],
// 'subject-exclamation-mark': [2, 'never'],
"footer-leading-blank": [1, "always"],
"header-max-length": [2, "always", 72],
// 'scope-case': [2, 'always', 'lower-case'],
"subject-case": [2, "never", ["upper-case"] as any],
// 'subject-empty': [2, 'never'],
"subject-full-stop": [2, "never", "."],
"type-empty": [2, "never"],
"scope-empty": [1, "never"],
"type-enum": [2, "always", enumerateValues(CommitType)],
},
};

Expand Down
6 changes: 0 additions & 6 deletions packages/commitlint-config-wizardoc/src/typings.ts

This file was deleted.

4 changes: 4 additions & 0 deletions packages/commitlint-config-wizardoc/src/utils/enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type Enum<T> = Record<string, T>;

export const enumerateValues = <T>(e: Enum<T>) => Object.values<T>(e);
export const enumerateKeys = (e: Enum<unknown>) => Object.keys(e);
Loading