Skip to content

Commit 79668a5

Browse files
committed
feat(deps)!: update commitlint monorepo to v19
BREAKING CHANGE: Drop support for @commitlint v9 up to and indlucing v18 BREAKING CHANGE: Require Node.js 20 minimum
1 parent c3370b0 commit 79668a5

8 files changed

+540
-6602
lines changed

package-lock.json

+507-6,510
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+10-36
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,12 @@
2020
"license": "GPL-3.0-or-later",
2121
"author": "Jeroen de Bruijn",
2222
"type": "module",
23-
"exports": {
24-
".": {
25-
"import": "./dist/plugin.js",
26-
"require": "./dist/index.cjs"
27-
}
28-
},
23+
"exports": "./dist/index.js",
2924
"files": [
3025
"./dist/**/!(*.test).{js,d.ts,cjs}"
3126
],
3227
"scripts": {
33-
"build": "npm run build:esm && npm run build:cjs",
34-
"build:cjs": "esbuild src/index.ts --bundle --target=ES2022 --platform=node --outfile=dist/index.cjs",
35-
"build:esm": "tsc",
28+
"build": "tsc",
3629
"format": "prettier --ignore-path .gitignore --write \"**/*.{vue,css,less,scss,html,htm,json,md,markdown,yml,yaml}\" --log-level warn",
3730
"format:check": "prettier --ignore-path .gitignore --check \"**/*.{vue,css,less,scss,html,htm,json,md,markdown,yml,yaml}\" --log-level warn",
3831
"lint": "npm run format:check && xo",
@@ -193,37 +186,18 @@
193186
},
194187
"devDependencies": {
195188
"@ava/typescript": "4.1.0",
196-
"@commitlint/cli": "18.6.1",
197-
"@commitlint/config-conventional": "18.6.3",
198-
"@commitlint/lint-10.x": "npm:@commitlint/[email protected]",
199-
"@commitlint/lint-11.x": "npm:@commitlint/[email protected]",
200-
"@commitlint/lint-12.x": "npm:@commitlint/[email protected]",
201-
"@commitlint/lint-13.x": "npm:@commitlint/[email protected]",
202-
"@commitlint/lint-14.x": "npm:@commitlint/[email protected]",
203-
"@commitlint/lint-15.x": "npm:@commitlint/[email protected]",
204-
"@commitlint/lint-16.x": "npm:@commitlint/[email protected]",
205-
"@commitlint/lint-17.x": "npm:@commitlint/[email protected]",
206-
"@commitlint/lint-18.x": "npm:@commitlint/[email protected]",
207-
"@commitlint/lint-9.x": "npm:@commitlint/[email protected]",
208-
"@commitlint/load-10.x": "npm:@commitlint/[email protected]",
209-
"@commitlint/load-11.x": "npm:@commitlint/[email protected]",
210-
"@commitlint/load-12.x": "npm:@commitlint/[email protected]",
211-
"@commitlint/load-13.x": "npm:@commitlint/[email protected]",
212-
"@commitlint/load-14.x": "npm:@commitlint/[email protected]",
213-
"@commitlint/load-15.x": "npm:@commitlint/[email protected]",
214-
"@commitlint/load-16.x": "npm:@commitlint/[email protected]",
215-
"@commitlint/load-17.x": "npm:@commitlint/[email protected]",
216-
"@commitlint/load-18.x": "npm:@commitlint/[email protected]",
217-
"@commitlint/load-9.x": "npm:@commitlint/[email protected]",
218-
"@commitlint/rules": "18.6.1",
219-
"@commitlint/types": "18.6.1",
189+
"@commitlint/cli": "19.2.0",
190+
"@commitlint/config-conventional": "19.1.0",
191+
"@commitlint/lint-19.x": "npm:@commitlint/[email protected]",
192+
"@commitlint/load-19.x": "npm:@commitlint/[email protected]",
193+
"@commitlint/rules": "19.0.3",
194+
"@commitlint/types": "19.0.3",
220195
"@semantic-release/changelog": "6.0.3",
221196
"@semantic-release/exec": "6.0.3",
222197
"@semantic-release/git": "10.0.1",
223198
"@types/sinon": "17.0.3",
224199
"ava": "6.1.2",
225200
"c8": "9.1.0",
226-
"esbuild": "0.20.1",
227201
"husky": "9.0.11",
228202
"lint-staged": "15.2.2",
229203
"prettier": "3.2.5",
@@ -233,9 +207,9 @@
233207
"xo": "0.58.0"
234208
},
235209
"peerDependencies": {
236-
"@commitlint/lint": ">=9.1.2 <19"
210+
"@commitlint/lint": ">=19 <20"
237211
},
238212
"engines": {
239-
"node": ">=18"
213+
"node": ">=20"
240214
}
241215
}

src/function-rule.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {type Commit, type RuleOutcome} from '@commitlint/types';
1+
import {type RuleOutcome} from '@commitlint/types';
22
import {fake} from 'sinon';
33
import test from 'ava';
4-
import {functionRule} from './function-rule.js';
4+
import {type Commit, functionRule} from './function-rule.js';
55

66
test('calls an implementation fuction once', async (t) => {
77
const implementation = fake();

src/function-rule.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {
2-
type Commit,
32
type Rule,
43
type RuleConfigCondition,
54
type RuleOutcome,
65
} from '@commitlint/types';
76

7+
type Commit = Parameters<Rule>[0];
88
type FunctionRule = (
99
parsed: Commit,
1010
when: RuleConfigCondition,
@@ -26,4 +26,4 @@ const functionRule: Rule<FunctionRule> = async (
2626
return functionRule(parsed, when);
2727
};
2828

29-
export {type FunctionRule, functionRule};
29+
export {type Commit, functionRule};
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,40 @@
11
import {type RuleOutcome} from '@commitlint/types';
22
import test from 'ava';
3-
import type commitlintLoad from '@commitlint/load-17.x';
4-
import type commitlintLint from '@commitlint/lint-17.x';
3+
import load19x from '@commitlint/load-19.x';
4+
import lint19x from '@commitlint/lint-19.x';
55
import {rules} from './rules.js';
6-
import {plugin} from './plugin.js';
6+
import * as plugin from './index.js';
77

88
test('exports rules', (t) => {
99
t.is(plugin.rules, rules);
1010
});
1111

12-
const loadPlugin = test.macro<[string]>({
12+
/* eslint-disable @typescript-eslint/naming-convention */
13+
const versions = {
14+
'19.x': {load: load19x, lint: lint19x},
15+
} as const;
16+
/* eslint-enable @typescript-eslint/naming-convention */
17+
18+
const loadPlugin = test.macro<[keyof typeof versions]>({
1319
async exec(t, version) {
14-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
15-
const module = await import(`@commitlint/load-${version}`);
16-
const load = module.default.default as typeof commitlintLoad.default;
1720
/**
1821
* Specify the package file, which doesn't contain a configuration, to
1922
* prevent `@commitlint/load` from searching the filesystem for an actual
2023
* configuration.
2124
*/
22-
await t.notThrowsAsync(load({plugins: [plugin]}, {file: 'package.json'}));
25+
await t.notThrowsAsync(
26+
versions[version].load({plugins: [plugin]}, {file: 'package.json'}),
27+
);
2328
},
2429
title(_, version) {
2530
return `@commitlint/load@${version} can load the plugin`;
2631
},
2732
});
2833

29-
test(loadPlugin, '9.x');
30-
test(loadPlugin, '10.x');
31-
test(loadPlugin, '11.x');
32-
test(loadPlugin, '12.x');
33-
test(loadPlugin, '13.x');
34-
test(loadPlugin, '14.x');
35-
test(loadPlugin, '15.x');
36-
test(loadPlugin, '16.x');
37-
test(loadPlugin, '17.x');
38-
test(loadPlugin, '18.x');
34+
test(loadPlugin, '19.x');
3935

40-
const lintUsingPluginRules = test.macro<[string]>({
36+
const lintUsingPluginRules = test.macro<[keyof typeof versions]>({
4137
async exec(t, version) {
42-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
43-
const module = await import(`@commitlint/lint-${version}`);
44-
const lint = module.default.default as typeof commitlintLint.default;
45-
4638
for await (const rule of Object.keys(plugin.rules)) {
4739
const configs: Array<{async: boolean; ruleOutcome: RuleOutcome}> = [
4840
{async: false, ruleOutcome: [true]},
@@ -52,7 +44,7 @@ const lintUsingPluginRules = test.macro<[string]>({
5244
];
5345

5446
for await (const config of configs) {
55-
const report = await lint(
47+
const report = await versions[version].lint(
5648
'chore: basic commit message',
5749
{
5850
[rule]: [
@@ -82,13 +74,4 @@ const lintUsingPluginRules = test.macro<[string]>({
8274
},
8375
});
8476

85-
test(lintUsingPluginRules, '9.x');
86-
test(lintUsingPluginRules, '10.x');
87-
test(lintUsingPluginRules, '11.x');
88-
test(lintUsingPluginRules, '12.x');
89-
test(lintUsingPluginRules, '13.x');
90-
test(lintUsingPluginRules, '14.x');
91-
test(lintUsingPluginRules, '15.x');
92-
test(lintUsingPluginRules, '16.x');
93-
test(lintUsingPluginRules, '17.x');
94-
test(lintUsingPluginRules, '18.x');
77+
test(lintUsingPluginRules, '19.x');

src/index.ts

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
1-
import {plugin} from './plugin.js';
2-
3-
/**
4-
* Export single object, according to the CommonJS model. The CommonJS module is
5-
* explicitly used here as that's the kind of module commitlint requires for
6-
* shareable configurations. This project is an ES module for ease of
7-
* development, and thus requires the error for an export assignment to be
8-
* disabled.
9-
*/
10-
// @ts-expect-error TS1203
11-
export = plugin;
1+
export {rules} from './rules.js';

src/plugin.ts

-6
This file was deleted.

src/rules.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {rules} from './rules.js';
55

66
const prefix = 'function-rules/';
77
const names = Object.keys(rules);
8-
const commitlintRuleNames = Object.keys(commitlintRules.default).sort();
8+
const commitlintRuleNames = Object.keys(commitlintRules).sort();
99
test('exports the same rules as commitlint', (t) => {
1010
t.deepEqual(
1111
names.map((name) => name.slice(prefix.length)),

0 commit comments

Comments
 (0)