From cc031153673cb427c4f7d3f21d6526ac1c4ff012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl-Ian?= Date: Mon, 20 May 2024 23:37:19 +0200 Subject: [PATCH] JS linting --- npm/__tests__/unit/cocooned/plugins/core/triggers/add.js | 1 + .../unit/cocooned/plugins/core/triggers/add/builder.js | 2 +- .../unit/cocooned/plugins/core/triggers/add/extractor.js | 1 + npm/src/cocooned/plugins/core.js | 8 ++++---- npm/src/cocooned/plugins/core/triggers/add/extractor.js | 2 +- npm/src/cocooned/plugins/core/triggers/add/replacement.js | 4 ++-- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/npm/__tests__/unit/cocooned/plugins/core/triggers/add.js b/npm/__tests__/unit/cocooned/plugins/core/triggers/add.js index ed0f915..d829534 100644 --- a/npm/__tests__/unit/cocooned/plugins/core/triggers/add.js +++ b/npm/__tests__/unit/cocooned/plugins/core/triggers/add.js @@ -15,6 +15,7 @@ describe('Add', () => { beforeEach(() => { document.body.innerHTML = given.html }) given('extended', () => coreMixin(Base)) + // eslint-disable-next-line new-cap given('add', () => new Add(given.addTrigger, new given.extended(given.container), given.options)) given('addTrigger', () => getAddLink(given.container)) given('container', () => document.querySelector('[data-cocooned-container]')) diff --git a/npm/__tests__/unit/cocooned/plugins/core/triggers/add/builder.js b/npm/__tests__/unit/cocooned/plugins/core/triggers/add/builder.js index 4ce9aad..9c7ee86 100644 --- a/npm/__tests__/unit/cocooned/plugins/core/triggers/add/builder.js +++ b/npm/__tests__/unit/cocooned/plugins/core/triggers/add/builder.js @@ -10,7 +10,7 @@ describe('Builder', () => { given('builder', () => { return new Builder( given.template.content, - given.extended.replacementsFor('new_person') + given.extended.replacementsFor('new_person') ) }) given('id', () => faker.string.numeric(5)) diff --git a/npm/__tests__/unit/cocooned/plugins/core/triggers/add/extractor.js b/npm/__tests__/unit/cocooned/plugins/core/triggers/add/extractor.js index 9b2f158..ba1b189 100644 --- a/npm/__tests__/unit/cocooned/plugins/core/triggers/add/extractor.js +++ b/npm/__tests__/unit/cocooned/plugins/core/triggers/add/extractor.js @@ -13,6 +13,7 @@ describe('Extractor', () => { beforeEach(() => { document.body.innerHTML = given.html }) given('extended', () => coreMixin(Base)) + // eslint-disable-next-line new-cap given('extractor', () => new Extractor(given.addTrigger, new given.extended(given.container))) given('container', () => document.querySelector('[data-cocooned-container]')) given('addTrigger', () => getAddLink(document)) diff --git a/npm/src/cocooned/plugins/core.js b/npm/src/cocooned/plugins/core.js index 145b2b4..d66b7fb 100644 --- a/npm/src/cocooned/plugins/core.js +++ b/npm/src/cocooned/plugins/core.js @@ -9,7 +9,7 @@ const coreMixin = (Base) => class extends Base { } static get replacements () { - return this.__replacements; + return this.__replacements } static replacementsFor (association) { @@ -46,7 +46,7 @@ const coreMixin = (Base) => class extends Base { } replacementsFor (association) { - return this.constructor.replacementsFor(association); + return this.constructor.replacementsFor(association) } /* Protected and private attributes and methods */ @@ -57,8 +57,8 @@ const coreMixin = (Base) => class extends Base { { tag: '*', attribute: 'name', delimiters: ['[', ']'] }, // Compatibility with Trix. See #65 on Github. - { tag: 'trix-editor', attribute: 'input', delimiters: ['_'] }, - ]; + { tag: 'trix-editor', attribute: 'input', delimiters: ['_'] } + ] } export { diff --git a/npm/src/cocooned/plugins/core/triggers/add/extractor.js b/npm/src/cocooned/plugins/core/triggers/add/extractor.js index 704f73c..fa12f78 100644 --- a/npm/src/cocooned/plugins/core/triggers/add/extractor.js +++ b/npm/src/cocooned/plugins/core/triggers/add/extractor.js @@ -42,7 +42,7 @@ class Extractor { return new Builder( template.content, this.#cocooned.replacementsFor(`new_${this.#dataset.association}`) - ); + ) } _extractCount () { diff --git a/npm/src/cocooned/plugins/core/triggers/add/replacement.js b/npm/src/cocooned/plugins/core/triggers/add/replacement.js index 0a57585..86e8a0b 100644 --- a/npm/src/cocooned/plugins/core/triggers/add/replacement.js +++ b/npm/src/cocooned/plugins/core/triggers/add/replacement.js @@ -43,8 +43,8 @@ class Replacement { #escape (string) { return (string && reHasRegExpChar.test(string)) - ? string.replace(reRegExpChar, '\\$&') - : (string || '') + ? string.replace(reRegExpChar, '\\$&') + : (string || '') } }