@w5s/commitlint-config 1.0.0-alpha.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -9
- package/index.d.ts +3 -0
- package/index.js +2 -0
- package/lib/index.d.ts +2 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +25 -19
- package/lib/index.js.map +1 -1
- package/package.json +18 -13
- package/src/index.ts +18 -20
package/README.md
CHANGED
|
@@ -21,19 +21,23 @@ npm install --save-dev @w5s/commitlint-config @commitlint/cli
|
|
|
21
21
|
|
|
22
22
|
In the `package.json` of your project
|
|
23
23
|
|
|
24
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKGJSON:template=```json\n{\n "commitlint": {\n "extends": ["${name}"]\n }\n}\n```) -->
|
|
24
25
|
```json
|
|
25
26
|
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
"husky": {
|
|
31
|
-
"hooks": {
|
|
32
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
27
|
+
"commitlint": {
|
|
28
|
+
"extends": ["@w5s/commitlint-config"]
|
|
29
|
+
}
|
|
35
30
|
}
|
|
36
31
|
```
|
|
32
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
33
|
+
|
|
34
|
+
Ensure the `commitlint` is setup on husky commit message hook (default `.husky/commit-msg`)
|
|
35
|
+
|
|
36
|
+
```console
|
|
37
|
+
commitlint --edit $1
|
|
38
|
+
# -OR-
|
|
39
|
+
npm exec --no -- commitlint --edit $1
|
|
40
|
+
```
|
|
37
41
|
|
|
38
42
|
## License
|
|
39
43
|
<!-- AUTO-GENERATED-CONTENT:START (PKGJSON:template=[${license}][license-url] © ${author}) -->
|
package/index.d.ts
ADDED
package/index.js
ADDED
package/lib/index.d.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
+
import { type LintOptions } from '@commitlint/types';
|
|
1
2
|
declare const config: {
|
|
3
|
+
parserPreset: LintOptions;
|
|
2
4
|
rules: Partial<import("@commitlint/types").RulesConfig<import("@commitlint/types").RuleConfigQuality.Qualified>>;
|
|
3
|
-
parserPreset: {
|
|
4
|
-
parserOpts: {
|
|
5
|
-
headerPattern: RegExp;
|
|
6
|
-
headerCorrespondence: string[];
|
|
7
|
-
};
|
|
8
|
-
plugins: {
|
|
9
|
-
gitmoji: import("@commitlint/types").Plugin;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
plugins: import("@commitlint/types").Plugin[];
|
|
13
5
|
};
|
|
14
6
|
export default config;
|
|
15
7
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2C,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA+B9F,QAAA,MAAM,MAAM;;;CAGX,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
@@ -6,12 +15,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
15
|
/* eslint-disable import/no-import-module-exports */
|
|
7
16
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
8
17
|
var types_1 = require("@commitlint/types");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var Error = types_1.RuleConfigSeverity.Error, Warning = types_1.RuleConfigSeverity.Warning
|
|
18
|
+
var gitmojis_1 = require("gitmojis");
|
|
19
|
+
var emoji_regex_1 = __importDefault(require("emoji-regex"));
|
|
20
|
+
var allGitmojiCodes = __spreadArray(__spreadArray([], gitmojis_1.gitmojis.map(function (gitmoji) { return gitmoji.code; }), true), gitmojis_1.gitmojis.map(function (gitmoji) { return gitmoji.emoji; }), true);
|
|
21
|
+
var Error = types_1.RuleConfigSeverity.Error, Warning = types_1.RuleConfigSeverity.Warning;
|
|
22
|
+
var parserPreset = {
|
|
23
|
+
parserOpts: {
|
|
24
|
+
// eslint-disable-next-line unicorn/no-unsafe-regex, prefer-regex-literals
|
|
25
|
+
headerPattern: new RegExp("^(:\\w*:|".concat(String((0, emoji_regex_1.default)().source), ") (?:\\((.*)\\):? )?(.*)$")),
|
|
26
|
+
headerCorrespondence: ['type', 'scope', 'subject'],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
13
29
|
var rules = {
|
|
14
|
-
'start-with-gitmoji': [Error, 'always'],
|
|
15
30
|
'body-leading-blank': [Warning, 'always'],
|
|
16
31
|
'body-max-line-length': [Error, 'always', 100],
|
|
17
32
|
'footer-leading-blank': [Warning, 'always'],
|
|
@@ -19,25 +34,16 @@ var rules = {
|
|
|
19
34
|
'header-max-length': [Error, 'always', 72],
|
|
20
35
|
'scope-case': [Error, 'always', 'lower-case'],
|
|
21
36
|
'subject-case': [Error, 'always', ['sentence-case']],
|
|
22
|
-
'subject-empty': [
|
|
37
|
+
'subject-empty': [Error, 'never'],
|
|
38
|
+
'subject-exclamation-mark': [Error, 'never'],
|
|
23
39
|
'subject-full-stop': [Error, 'never', '.'],
|
|
24
40
|
'type-case': [Error, 'always', 'lower-case'],
|
|
25
|
-
'type-empty': [Error, '
|
|
26
|
-
'type-enum': [Error, 'always',
|
|
41
|
+
'type-empty': [Error, 'never'],
|
|
42
|
+
'type-enum': [Error, 'always', allGitmojiCodes],
|
|
27
43
|
};
|
|
28
44
|
var config = {
|
|
45
|
+
parserPreset: parserPreset,
|
|
29
46
|
rules: rules,
|
|
30
|
-
parserPreset: {
|
|
31
|
-
parserOpts: parser_opts_1.default,
|
|
32
|
-
plugins: {
|
|
33
|
-
gitmoji: commitlint_plugin_gitmoji_1.default,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
plugins: [commitlint_plugin_gitmoji_1.default],
|
|
37
47
|
};
|
|
38
|
-
// FIXME: this is a workaround for commonjs loading
|
|
39
|
-
if (typeof module !== 'undefined') {
|
|
40
|
-
module.exports = config;
|
|
41
|
-
}
|
|
42
48
|
exports.default = config;
|
|
43
49
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAAoD;AACpD,4DAA4D;AAC5D,2CAA8F;AAC9F,qCAAoC;AACpC,4DAAsC;AAEtC,IAAM,eAAe,mCAAO,mBAAQ,CAAC,GAAG,CAAC,UAAC,OAAO,IAAK,OAAA,OAAO,CAAC,IAAI,EAAZ,CAAY,CAAC,SAAK,mBAAQ,CAAC,GAAG,CAAC,UAAC,OAAO,IAAK,OAAA,OAAO,CAAC,KAAK,EAAb,CAAa,CAAC,OAAC,CAAC;AAC1G,IAAA,KAAK,GAAc,0BAAkB,MAAhC,EAAE,OAAO,GAAK,0BAAkB,QAAvB,CAAwB;AAE9C,IAAM,Y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3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Commitlint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"commitlint",
|
|
@@ -19,27 +19,33 @@
|
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"author": "Julien Polo <julien.polo@gmail.com>",
|
|
21
21
|
"type": "commonjs",
|
|
22
|
-
"exports":
|
|
22
|
+
"exports": {
|
|
23
|
+
".": "./index.js",
|
|
24
|
+
"./lib/*": "./lib/*"
|
|
25
|
+
},
|
|
26
|
+
"typings": "./index.d.ts",
|
|
23
27
|
"files": [
|
|
24
28
|
"lib/**/!(*.spec).d.ts",
|
|
25
29
|
"lib/**/!(*.spec).d.ts.map",
|
|
26
30
|
"lib/**/!(*.spec).js.map",
|
|
27
31
|
"lib/**/!(*.spec).js",
|
|
28
|
-
"src/**/!(*.spec).ts"
|
|
32
|
+
"src/**/!(*.spec).ts",
|
|
33
|
+
"index.js",
|
|
34
|
+
"index.d.ts"
|
|
29
35
|
],
|
|
30
36
|
"scripts": {
|
|
31
|
-
"build": "concurrently \"npm:build:*\" ",
|
|
37
|
+
"build": "concurrently \"npm:build:*\" \":\"",
|
|
32
38
|
"build:src": "tsc",
|
|
33
39
|
"clean": "concurrently \"npm:clean:*\" \":\"",
|
|
34
40
|
"docs": "md-magic --path '**/*.md' --ignore='node_modules'",
|
|
35
41
|
"format": "concurrently \"npm:format:*\" \":\"",
|
|
36
|
-
"format:src": "eslint . --fix --ext=mjs,cjs,js,jsx,ts,tsx,json",
|
|
42
|
+
"format:src": "eslint . --fix --ext=mjs,cjs,js,jsx,ts,tsx,json,jsonc,json5,yml,yaml",
|
|
37
43
|
"lint": "concurrently \"npm:lint:*\" \":\"",
|
|
38
|
-
"lint:src": "eslint . --ext=mjs,cjs,js,jsx,ts,tsx,json",
|
|
44
|
+
"lint:src": "eslint . --ext=mjs,cjs,js,jsx,ts,tsx,json,jsonc,json5,yml,yaml",
|
|
39
45
|
"prepare": "concurrently \"npm:prepare:*\" \":\"",
|
|
40
46
|
"spellcheck": "cspell --no-progress '**'",
|
|
41
|
-
"test": "
|
|
42
|
-
"
|
|
47
|
+
"test": "concurrently \"npm:test:*\" ",
|
|
48
|
+
"test:src": "jest"
|
|
43
49
|
},
|
|
44
50
|
"jest": {
|
|
45
51
|
"moduleNameMapper": {
|
|
@@ -57,13 +63,12 @@
|
|
|
57
63
|
},
|
|
58
64
|
"dependencies": {
|
|
59
65
|
"@commitlint/types": "^17.0.0",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"commitlint-plugin-gitmoji": "^2.2.0"
|
|
66
|
+
"emoji-regex": "^10.2.1",
|
|
67
|
+
"gitmojis": "^3.13.0"
|
|
63
68
|
},
|
|
64
69
|
"devDependencies": {
|
|
65
|
-
"@commitlint/lint": "17.0
|
|
66
|
-
"@jest/globals": "
|
|
70
|
+
"@commitlint/lint": "17.2.0",
|
|
71
|
+
"@jest/globals": "29.3.1"
|
|
67
72
|
},
|
|
68
73
|
"peerDependencies": {
|
|
69
74
|
"@commitlint/cli": "^16.0.0 || ^17.0.0"
|
package/src/index.ts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
/* eslint-disable import/no-import-module-exports */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
3
|
-
import { RuleConfigSeverity, type QualifiedRules } from '@commitlint/types';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import commitTypes from '@gitmoji/commit-types';
|
|
3
|
+
import { RuleConfigSeverity, type QualifiedRules, type LintOptions } from '@commitlint/types';
|
|
4
|
+
import { gitmojis } from 'gitmojis';
|
|
5
|
+
import emojiRegexp from 'emoji-regex';
|
|
7
6
|
|
|
8
|
-
const
|
|
7
|
+
const allGitmojiCodes = [...gitmojis.map((gitmoji) => gitmoji.code), ...gitmojis.map((gitmoji) => gitmoji.emoji)];
|
|
8
|
+
const { Error, Warning } = RuleConfigSeverity;
|
|
9
|
+
|
|
10
|
+
const parserPreset: LintOptions = {
|
|
11
|
+
parserOpts: {
|
|
12
|
+
// eslint-disable-next-line unicorn/no-unsafe-regex, prefer-regex-literals
|
|
13
|
+
headerPattern: new RegExp(`^(:\\w*:|${String(emojiRegexp().source)}) (?:\\((.*)\\):? )?(.*)$`), /// ^(:\w*:) (?:\((.*)\) )?(.*)$/,
|
|
14
|
+
headerCorrespondence: ['type', 'scope', 'subject'],
|
|
15
|
+
},
|
|
16
|
+
};
|
|
9
17
|
|
|
10
18
|
const rules: QualifiedRules = {
|
|
11
|
-
'start-with-gitmoji': [Error, 'always'],
|
|
12
19
|
'body-leading-blank': [Warning, 'always'],
|
|
13
20
|
'body-max-line-length': [Error, 'always', 100],
|
|
14
21
|
'footer-leading-blank': [Warning, 'always'],
|
|
@@ -16,26 +23,17 @@ const rules: QualifiedRules = {
|
|
|
16
23
|
'header-max-length': [Error, 'always', 72],
|
|
17
24
|
'scope-case': [Error, 'always', 'lower-case'],
|
|
18
25
|
'subject-case': [Error, 'always', ['sentence-case']],
|
|
19
|
-
'subject-empty': [
|
|
26
|
+
'subject-empty': [Error, 'never'],
|
|
27
|
+
'subject-exclamation-mark': [Error, 'never'],
|
|
20
28
|
'subject-full-stop': [Error, 'never', '.'],
|
|
21
29
|
'type-case': [Error, 'always', 'lower-case'],
|
|
22
|
-
'type-empty': [Error, '
|
|
23
|
-
'type-enum': [Error, 'always',
|
|
30
|
+
'type-empty': [Error, 'never'],
|
|
31
|
+
'type-enum': [Error, 'always', allGitmojiCodes],
|
|
24
32
|
};
|
|
25
33
|
|
|
26
34
|
const config = {
|
|
35
|
+
parserPreset,
|
|
27
36
|
rules,
|
|
28
|
-
parserPreset: {
|
|
29
|
-
parserOpts: gitmojiParserOpts,
|
|
30
|
-
plugins: {
|
|
31
|
-
gitmoji: gitmojiPlugin,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
plugins: [gitmojiPlugin],
|
|
35
37
|
};
|
|
36
|
-
// FIXME: this is a workaround for commonjs loading
|
|
37
|
-
if (typeof module !== 'undefined') {
|
|
38
|
-
module.exports = config;
|
|
39
|
-
}
|
|
40
38
|
|
|
41
39
|
export default config;
|