Skip to content

Commit

Permalink
Placate linter
Browse files Browse the repository at this point in the history
  • Loading branch information
72636c committed Oct 14, 2024
1 parent d191864 commit ecaf792
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
24 changes: 11 additions & 13 deletions .changeset/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ const gitHubChangelogFunctions = {
await Promise.all(
changesets.map(async (cs) => {
if (cs.commit) {
let { links } = await getInfo({
const info = await getInfo({
repo: options.repo,
commit: cs.commit,
});
return links.commit;
return info.links.commit;
}
}),
)
Expand Down Expand Up @@ -102,18 +102,15 @@ const gitHubChangelogFunctions = {

const replacedChangelog = changeset.summary
.replace(/^\s*(?:pr|pull|pull\s+request):\s*#?(\d+)/im, (_, pr) => {
let num = Number(pr);
const num = Number(pr);
if (!isNaN(num)) prFromSummary = num;
return '';
})
.replace(/^\s*commit:\s*([^\s]+)/im, (_, commit) => {
commitFromSummary = commit;
return '';
})
.replace(/^\s*(?:author|user):\s*@?([^\s]+)/gim, (_, user) => {
usersFromSummary.push(user);
return '';
})
.replace(/^\s*(?:author|user):\s*@?([^\s]+)/gim, '')
.trim();

const [firstLine, ...futureLines] = replacedChangelog
Expand All @@ -122,25 +119,25 @@ const gitHubChangelogFunctions = {

const links = await (async () => {
if (prFromSummary !== undefined) {
let { links } = await getInfoFromPullRequest({
const info = await getInfoFromPullRequest({
repo: options.repo,
pull: prFromSummary,
});
if (commitFromSummary) {
links = {
...links,
return {
...info.links,
commit: `[\`${commitFromSummary}\`](https://github.com/${options.repo}/commit/${commitFromSummary})`,
};
}
return links;
return info.links;
}
const commitToFetchFrom = commitFromSummary || changeset.commit;
if (commitToFetchFrom) {
let { links } = await getInfo({
const info = await getInfo({
repo: options.repo,
commit: commitToFetchFrom,
});
return links;
return info.links;
}
return {
commit: null,
Expand All @@ -163,6 +160,7 @@ const gitHubChangelogFunctions = {
if (process.env.GITHUB_TOKEN) {
module.exports = gitHubChangelogFunctions;
} else {
// eslint-disable-next-line no-console
console.warn(
`Defaulting to Git-based versioning.
Enable GitHub-based versioning by setting the GITHUB_TOKEN environment variable.
Expand Down
1 change: 1 addition & 0 deletions src/serializers/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('DEFAULT_OMIT_HEADER_NAMES', () => {

expect(() => {
// @ts-expect-error - We're trying to break the read-only array (TS2542).
// eslint-disable-next-line @typescript-eslint/no-array-delete
delete DEFAULT_OMIT_HEADER_NAMES[0];
}).toThrowErrorMatchingInlineSnapshot(
`"Cannot delete property '0' of [object Array]"`,
Expand Down

0 comments on commit ecaf792

Please sign in to comment.