Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Mar 20, 2022
1 parent 85db46d commit 85fd76b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class KeepAChangelog extends Plugin {
this.addUnreleased = addUnreleased === undefined ? false : Boolean(addUnreleased);
this.keepUnreleased = keepUnreleased === undefined ? false : Boolean(keepUnreleased);
this.addVersionUrl = addVersionUrl === undefined ? false : Boolean(addVersionUrl);
this.head = head || 'HEAD'
this.head = head || 'HEAD';

this.changelogPath = path.resolve(this.filename);
this.changelogContent = fs.readFileSync(this.changelogPath, 'utf-8');
Expand Down Expand Up @@ -81,7 +81,7 @@ class KeepAChangelog extends Plugin {
// Add or update the Unreleased link
const unreleasedUrl = `${repositoryUrl}/compare/${tagName}...${this.head}`;
const unreleasedLink = `[Unreleased]: ${unreleasedUrl}`;
const hasUnreleasedLink = /^\[(Unreleased)\]\: .*$/im
const hasUnreleasedLink = /^\[(Unreleased)\]\: .*$/im;
if (hasUnreleasedLink.test(updatedChangelog)) {
updatedChangelog = updatedChangelog.replace(hasUnreleasedLink, '[$1]: ' + unreleasedUrl);
} else {
Expand Down
8 changes: 4 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ mock({
'./CHANGELOG-UNRELEASED.md': '## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D',
'./CHANGELOG-VERSION_URL.md':
'## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D\n\n[Unreleased]: https://github.com/release-it/release-it/compare/1.0.0..HEAD\n[1.0.0]: https://github.com/release-it/release-it/compare/0.0.0...1.0.0',
'./CHANGELOG-VERSION_URL_HEAD.md':
'## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D\n\n[Unreleased]: https://github.com/release-it/release-it/compare/1.0.0..main\n[1.0.0]: https://github.com/release-it/release-it/compare/0.0.0...1.0.0',
'./CHANGELOG-VERSION_URL_HEAD.md':
'## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D\n\n[Unreleased]: https://github.com/release-it/release-it/compare/1.0.0..main\n[1.0.0]: https://github.com/release-it/release-it/compare/0.0.0...1.0.0',
'./CHANGELOG-VERSION_URL_UNRELEASED.md':
'## [Unreleased]\n\n* Item A\n* Item B\n\n## [1.0.0] - 2020-05-02\n\n* Item C\n* Item D\n\n[Unreleased]: https://github.com/user/project/compare/1.0.0..HEAD\n[1.0.0]: https://github.com/user/project/compare/0.0.0...1.0.0',
'./CHANGELOG-VERSION_URL_NEW.md': '## [Unreleased]\n\n* Item A\n* Item B'
Expand Down Expand Up @@ -53,10 +53,10 @@ test('should throw for empty "unreleased" section', async t => {
});

test('should not throw for empty "unreleased" section when no-increment flag is set', async t => {
const options = { 'increment': false, [namespace]: { filename: 'CHANGELOG-EMPTY.md' } };
const options = { increment: false, [namespace]: { filename: 'CHANGELOG-EMPTY.md' } };
const plugin = factory(Plugin, { namespace, options });
await runTasks(plugin);
assert.equal(plugin.getChangelog(), readFile('./CHANGELOG-EMPTY.md'))
assert.equal(plugin.getChangelog(), readFile('./CHANGELOG-EMPTY.md'));
});

test('should throw for missing section for previous release', async t => {
Expand Down

0 comments on commit 85fd76b

Please sign in to comment.