@w5s/commitlint-config 2.0.26 → 2.1.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/dist/index.d.ts +7 -4
- package/dist/index.js +49 -31
- package/dist/index.js.map +1 -0
- package/package.json +16 -6
- package/src/index.ts +1 -0
- package/src/plugin.ts +4 -4
- package/dist/plugin.d.ts +0 -7
- package/dist/plugin.js +0 -33
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/index.d.ts +0 -3
- package/index.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _commitlint_types from '@commitlint/types';
|
|
2
|
+
import { LintOptions } from '@commitlint/types';
|
|
3
|
+
|
|
2
4
|
declare const config: {
|
|
3
5
|
parserPreset: LintOptions;
|
|
4
|
-
rules: Partial<
|
|
5
|
-
plugins:
|
|
6
|
+
rules: Partial<_commitlint_types.RulesConfig<_commitlint_types.RuleConfigQuality.Qualified>>;
|
|
7
|
+
plugins: _commitlint_types.Plugin[];
|
|
6
8
|
};
|
|
7
|
-
|
|
9
|
+
|
|
10
|
+
export { config as default };
|
package/dist/index.js
CHANGED
|
@@ -1,35 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { RuleConfigSeverity } from '@commitlint/types';
|
|
2
|
+
import Changelog from '@w5s/conventional-changelog';
|
|
3
|
+
|
|
4
|
+
// src/index.ts
|
|
5
|
+
var $if = (when = "always") => (cond) => when === "always" ? cond : !cond;
|
|
6
|
+
var typeGitmojiStyle = (parsed, when = "always", value = "unicode") => {
|
|
7
|
+
const isUnicode = parsed.type != null && Changelog.Emoji.isUnicode(parsed.type);
|
|
8
|
+
const isEmoji = parsed.type != null && Changelog.Emoji.isText(parsed.type);
|
|
9
|
+
return value === "unicode" ? $if(when)(isUnicode) ? [true] : [false, `Type should ${when} be an unicode character`] : $if(when)(isEmoji) ? [true] : [false, `Type should ${when} be an valid :emoji:`];
|
|
4
10
|
};
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const plugin_js_1 = require("./plugin.js");
|
|
9
|
-
const { Error, Warning, Disabled } = types_1.RuleConfigSeverity;
|
|
10
|
-
const parserPreset = {
|
|
11
|
-
parserOpts: conventional_changelog_1.default.parserOpts,
|
|
11
|
+
var typeValidGitmoji = (parsed, when = "always") => {
|
|
12
|
+
const isValidGitmoji = parsed.type != null && Changelog.GitmojiCode.isValid(parsed.type);
|
|
13
|
+
return $if(when)(isValidGitmoji) ? [true] : [false, `Type should ${when} be an valid gitmoji (see https://gitmoji.dev)`];
|
|
12
14
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
'header-max-length': [Error, 'always', 100],
|
|
19
|
-
'scope-case': [Error, 'always', 'lower-case'],
|
|
20
|
-
'subject-case': [Error, 'always', ['sentence-case']],
|
|
21
|
-
'subject-empty': [Error, 'never'],
|
|
22
|
-
'subject-exclamation-mark': [Error, 'never'],
|
|
23
|
-
'subject-full-stop': [Error, 'never', '.'],
|
|
24
|
-
'type-case': [Error, 'always', 'lower-case'],
|
|
25
|
-
'type-empty': [Error, 'never'],
|
|
26
|
-
'type-enum': [Disabled],
|
|
27
|
-
'type-gitmoji-style': [Error, 'always', 'unicode'],
|
|
28
|
-
'type-valid-gitmoji': [Error, 'always'],
|
|
15
|
+
var gitmojiPlugin = {
|
|
16
|
+
rules: {
|
|
17
|
+
"type-gitmoji-style": typeGitmojiStyle,
|
|
18
|
+
"type-valid-gitmoji": typeValidGitmoji
|
|
19
|
+
}
|
|
29
20
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
|
|
22
|
+
// src/index.ts
|
|
23
|
+
var { Error, Warning, Disabled } = RuleConfigSeverity;
|
|
24
|
+
var parserPreset = {
|
|
25
|
+
parserOpts: Changelog.parserOpts
|
|
34
26
|
};
|
|
35
|
-
|
|
27
|
+
var rules = {
|
|
28
|
+
"body-leading-blank": [Warning, "always"],
|
|
29
|
+
"body-max-line-length": [Error, "always", 100],
|
|
30
|
+
"footer-leading-blank": [Warning, "always"],
|
|
31
|
+
"footer-max-line-length": [Error, "always", 100],
|
|
32
|
+
"header-max-length": [Error, "always", 100],
|
|
33
|
+
"scope-case": [Error, "always", "lower-case"],
|
|
34
|
+
"subject-case": [Error, "always", ["sentence-case"]],
|
|
35
|
+
"subject-empty": [Error, "never"],
|
|
36
|
+
"subject-exclamation-mark": [Error, "never"],
|
|
37
|
+
"subject-full-stop": [Error, "never", "."],
|
|
38
|
+
"type-case": [Error, "always", "lower-case"],
|
|
39
|
+
"type-empty": [Error, "never"],
|
|
40
|
+
"type-enum": [Disabled],
|
|
41
|
+
"type-gitmoji-style": [Error, "always", "unicode"],
|
|
42
|
+
"type-valid-gitmoji": [Error, "always"]
|
|
43
|
+
};
|
|
44
|
+
var config = {
|
|
45
|
+
parserPreset,
|
|
46
|
+
rules,
|
|
47
|
+
plugins: [gitmojiPlugin]
|
|
48
|
+
};
|
|
49
|
+
var src_default = config;
|
|
50
|
+
|
|
51
|
+
export { src_default as default };
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts","../src/index.ts"],"names":["conventionalChangelog"],"mappings":";;;;AAGA,IAAM,GAAA,GACJ,CAAC,IAAwC,GAAA,QAAA,KACzC,CAAC,IACC,KAAA,IAAA,KAAS,QAAW,GAAA,IAAA,GAAO,CAAC,IAAA,CAAA;AAEzB,IAAM,mBAA8C,CAAC,MAAA,EAAQ,IAAO,GAAA,QAAA,EAAU,QAAQ,SAAc,KAAA;AACzG,EAAM,MAAA,SAAA,GAAY,OAAO,IAAQ,IAAA,IAAA,IAAQ,UAAU,KAAM,CAAA,SAAA,CAAU,OAAO,IAAI,CAA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AAA;AAAA,EACxC,sBAAwB,EAAA,CAAC,KAAO,EAAA,QAAA,EAAU,GAAG,CAAA;AAAA,EAC7C,sBAAA,EAAwB,CAAC,OAAA,EAAS,QAAQ,CAAA;AAAA,EAC1C,wBAA0B,EAAA,CAAC,KAAO,EAAA,QAAA,EAAU,GAAG,CAAA;AAAA,EAC/C,mBAAqB,EAAA,CAAC,KAAO,EAAA,QAAA,EAAU,GAAG,CAAA;AAAA,EAC1C,YAAc,EAAA,CAAC,KAAO,EAAA,QAAA,EAAU,YAAY,CAAA;AAAA,EAC5C,gBAAgB,CAAC,KAAA,EAAO,QAAU,EAAA,CAAC,eAAe,CAAC,CAAA;AAAA,EACnD,eAAA,EAAiB,CAAC,KAAA,EAAO,OAAO,CAAA;AAAA,EAChC,0BAAA,EAA4B,CAAC,KAAA,EAAO,OAAO,CAAA;AAAA,EAC3C,mBAAqB,EAAA,CAAC,KAAO,EAAA,OAAA,EAAS,GAAG,CAAA;AAAA,EACzC,WAAa,EAAA,CAAC,KAAO,EAAA,QAAA,EAAU,YAAY,CAAA;AAAA,EAC3C,YAAA,EAAc,CAAC,KAAA,EAAO,OAAO,CAAA;AAAA,EAC7B,WAAA,EAAa,CAAC,QAAQ,CAAA;AAAA,EACtB,oBAAsB,EAAA,CAAC,KAAO,EAAA,QAAA,EAAU,SAAS,CAAA;AAAA,EACjD,oBAAA,EAAsB,CAAC,KAAA,EAAO,QAAQ,CAAA;AACxC,CAAA,CAAA;AAEA,IAAM,MAAS,GAAA;AAAA,EACb,YAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA,EAAS,CAAC,aAAa,CAAA;AACzB,CAAA,CAAA;AAGA,IAAO,WAAQ,GAAA","file":"index.js","sourcesContent":["import type { Plugin, Rule, RuleConfigCondition } from '@commitlint/types';\nimport Changelog from '@w5s/conventional-changelog';\n\nconst $if =\n (when: RuleConfigCondition | undefined = 'always') =>\n (cond: boolean) =>\n when === 'always' ? cond : !cond;\n\nexport const typeGitmojiStyle: Rule<'unicode' | 'emoji'> = (parsed, when = 'always', value = 'unicode') => {\n const isUnicode = parsed.type != null && Changelog.Emoji.isUnicode(parsed.type);\n const isEmoji = parsed.type != null && Changelog.Emoji.isText(parsed.type);\n\n return value === 'unicode'\n ? $if(when)(isUnicode)\n ? [true]\n : [false, `Type should ${when} be an unicode character`]\n : $if(when)(isEmoji)\n ? [true]\n : [false, `Type should ${when} be an valid :emoji:`];\n};\n\nexport const typeValidGitmoji: Rule = (parsed, when = 'always') => {\n const isValidGitmoji = parsed.type != null && Changelog.GitmojiCode.isValid(parsed.type);\n\n return $if(when)(isValidGitmoji)\n ? [true]\n : [false, `Type should ${when} be an valid gitmoji (see https://gitmoji.dev)`];\n};\n\n/**\n * Gitmoji plugins\n */\nexport const gitmojiPlugin: Plugin = {\n rules: {\n 'type-gitmoji-style': typeGitmojiStyle,\n 'type-valid-gitmoji': typeValidGitmoji,\n },\n};\n","import { RuleConfigSeverity, type QualifiedRules, type LintOptions } from '@commitlint/types';\nimport conventionalChangelog from '@w5s/conventional-changelog';\nimport { gitmojiPlugin } from './plugin.js';\n\nconst { Error, Warning, Disabled } = RuleConfigSeverity;\n\nconst parserPreset: LintOptions = {\n parserOpts: conventionalChangelog.parserOpts as LintOptions['parserOpts'],\n};\n\nconst rules: QualifiedRules = {\n 'body-leading-blank': [Warning, 'always'],\n 'body-max-line-length': [Error, 'always', 100],\n 'footer-leading-blank': [Warning, 'always'],\n 'footer-max-line-length': [Error, 'always', 100],\n 'header-max-length': [Error, 'always', 100],\n 'scope-case': [Error, 'always', 'lower-case'],\n 'subject-case': [Error, 'always', ['sentence-case']],\n 'subject-empty': [Error, 'never'],\n 'subject-exclamation-mark': [Error, 'never'],\n 'subject-full-stop': [Error, 'never', '.'],\n 'type-case': [Error, 'always', 'lower-case'],\n 'type-empty': [Error, 'never'],\n 'type-enum': [Disabled],\n 'type-gitmoji-style': [Error, 'always', 'unicode'],\n 'type-valid-gitmoji': [Error, 'always'],\n};\n\nconst config = {\n parserPreset,\n rules,\n plugins: [gitmojiPlugin],\n};\n\n// eslint-disable-next-line import/no-default-export\nexport default config;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/commitlint-config",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Commitlint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"commitlint",
|
|
@@ -18,9 +18,18 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"author": "Julien Polo <julien.polo@gmail.com>",
|
|
21
|
-
"type": "
|
|
21
|
+
"type": "module",
|
|
22
22
|
"exports": {
|
|
23
|
-
".":
|
|
23
|
+
".": {
|
|
24
|
+
"require": {
|
|
25
|
+
"types": "./dist/index.d.cts",
|
|
26
|
+
"default": "./dist/index.cjs"
|
|
27
|
+
},
|
|
28
|
+
"import": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
24
33
|
"./dist/*": "./dist/*"
|
|
25
34
|
},
|
|
26
35
|
"typings": "./index.d.ts",
|
|
@@ -37,8 +46,8 @@
|
|
|
37
46
|
"postpack": "npx clean-package restore"
|
|
38
47
|
},
|
|
39
48
|
"dependencies": {
|
|
40
|
-
"@commitlint/types": "^
|
|
41
|
-
"@w5s/conventional-changelog": "^2.0
|
|
49
|
+
"@commitlint/types": "^19.0.0",
|
|
50
|
+
"@w5s/conventional-changelog": "^2.1.0"
|
|
42
51
|
},
|
|
43
52
|
"peerDependencies": {
|
|
44
53
|
"@commitlint/cli": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
@@ -54,5 +63,6 @@
|
|
|
54
63
|
"publishConfig": {
|
|
55
64
|
"access": "public"
|
|
56
65
|
},
|
|
57
|
-
"
|
|
66
|
+
"sideEffect": false,
|
|
67
|
+
"gitHead": "8342e0884a000565d2727d65092ae024ac6c0669"
|
|
58
68
|
}
|
package/src/index.ts
CHANGED
package/src/plugin.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Plugin, Rule, RuleConfigCondition } from '@commitlint/types';
|
|
2
|
-
import
|
|
2
|
+
import Changelog from '@w5s/conventional-changelog';
|
|
3
3
|
|
|
4
4
|
const $if =
|
|
5
5
|
(when: RuleConfigCondition | undefined = 'always') =>
|
|
@@ -7,8 +7,8 @@ const $if =
|
|
|
7
7
|
when === 'always' ? cond : !cond;
|
|
8
8
|
|
|
9
9
|
export const typeGitmojiStyle: Rule<'unicode' | 'emoji'> = (parsed, when = 'always', value = 'unicode') => {
|
|
10
|
-
const isUnicode = parsed.type != null && Emoji.isUnicode(parsed.type);
|
|
11
|
-
const isEmoji = parsed.type != null && Emoji.isText(parsed.type);
|
|
10
|
+
const isUnicode = parsed.type != null && Changelog.Emoji.isUnicode(parsed.type);
|
|
11
|
+
const isEmoji = parsed.type != null && Changelog.Emoji.isText(parsed.type);
|
|
12
12
|
|
|
13
13
|
return value === 'unicode'
|
|
14
14
|
? $if(when)(isUnicode)
|
|
@@ -20,7 +20,7 @@ export const typeGitmojiStyle: Rule<'unicode' | 'emoji'> = (parsed, when = 'alwa
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export const typeValidGitmoji: Rule = (parsed, when = 'always') => {
|
|
23
|
-
const isValidGitmoji = parsed.type != null && GitmojiCode.isValid(parsed.type);
|
|
23
|
+
const isValidGitmoji = parsed.type != null && Changelog.GitmojiCode.isValid(parsed.type);
|
|
24
24
|
|
|
25
25
|
return $if(when)(isValidGitmoji)
|
|
26
26
|
? [true]
|
package/dist/plugin.d.ts
DELETED
package/dist/plugin.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gitmojiPlugin = exports.typeValidGitmoji = exports.typeGitmojiStyle = void 0;
|
|
4
|
-
const conventional_changelog_1 = require("@w5s/conventional-changelog");
|
|
5
|
-
const $if = (when = 'always') => (cond) => when === 'always' ? cond : !cond;
|
|
6
|
-
const typeGitmojiStyle = (parsed, when = 'always', value = 'unicode') => {
|
|
7
|
-
const isUnicode = parsed.type != null && conventional_changelog_1.Emoji.isUnicode(parsed.type);
|
|
8
|
-
const isEmoji = parsed.type != null && conventional_changelog_1.Emoji.isText(parsed.type);
|
|
9
|
-
return value === 'unicode'
|
|
10
|
-
? $if(when)(isUnicode)
|
|
11
|
-
? [true]
|
|
12
|
-
: [false, `Type should ${when} be an unicode character`]
|
|
13
|
-
: $if(when)(isEmoji)
|
|
14
|
-
? [true]
|
|
15
|
-
: [false, `Type should ${when} be an valid :emoji:`];
|
|
16
|
-
};
|
|
17
|
-
exports.typeGitmojiStyle = typeGitmojiStyle;
|
|
18
|
-
const typeValidGitmoji = (parsed, when = 'always') => {
|
|
19
|
-
const isValidGitmoji = parsed.type != null && conventional_changelog_1.GitmojiCode.isValid(parsed.type);
|
|
20
|
-
return $if(when)(isValidGitmoji)
|
|
21
|
-
? [true]
|
|
22
|
-
: [false, `Type should ${when} be an valid gitmoji (see https://gitmoji.dev)`];
|
|
23
|
-
};
|
|
24
|
-
exports.typeValidGitmoji = typeValidGitmoji;
|
|
25
|
-
/**
|
|
26
|
-
* Gitmoji plugins
|
|
27
|
-
*/
|
|
28
|
-
exports.gitmojiPlugin = {
|
|
29
|
-
rules: {
|
|
30
|
-
'type-gitmoji-style': exports.typeGitmojiStyle,
|
|
31
|
-
'type-valid-gitmoji': exports.typeValidGitmoji,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/plugin.ts"],"version":"5.6.2"}
|
package/index.d.ts
DELETED
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./dist/index.js').default;
|