From 85fd76b016241338e92fdc655d975004474473db Mon Sep 17 00:00:00 2001 From: Lars Kappert Date: Sun, 20 Mar 2022 16:42:32 -0300 Subject: [PATCH] Fix lint issues --- index.js | 4 ++-- test.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index ade73e9..97b282e 100644 --- a/index.js +++ b/index.js @@ -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'); @@ -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 { diff --git a/test.js b/test.js index 4aa9535..e6de5f9 100644 --- a/test.js +++ b/test.js @@ -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' @@ -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 => {