From cc64419826784ec1bedcdc5151edd18c8daf8197 Mon Sep 17 00:00:00 2001 From: NovemLinguae Date: Wed, 11 Dec 2024 14:37:35 -0800 Subject: [PATCH 1/3] eslint: fix `strict` in tests manual fixes --- tests/.eslintrc.json | 1 - tests/morebits.array.js | 2 ++ tests/morebits.batchOperation.js | 2 ++ tests/morebits.createHtml.js | 2 ++ tests/morebits.date.js | 2 ++ tests/morebits.ip.js | 2 ++ tests/morebits.js | 2 ++ tests/morebits.quickForm.js | 2 ++ tests/morebits.string.js | 2 ++ tests/morebits.taskManager.js | 2 ++ tests/morebits.unbinder.js | 2 ++ tests/morebits.wikitext.js | 2 ++ tests/twinkleblock.test.js | 2 ++ tests/twinkletag.test.js | 2 ++ tests/twinklewarn.test.js | 2 ++ tests/twinklexfd.test.js | 2 ++ 16 files changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/.eslintrc.json b/tests/.eslintrc.json index 05e943f8e..b35527865 100644 --- a/tests/.eslintrc.json +++ b/tests/.eslintrc.json @@ -24,7 +24,6 @@ "no-useless-escape": "warn", "no-var": "warn", "semi": "warn", - "strict": "warn", "quotes": "warn", "unicorn/prefer-date-now": "warn" } diff --git a/tests/morebits.array.js b/tests/morebits.array.js index c64b9d8a9..b8c29542c 100644 --- a/tests/morebits.array.js +++ b/tests/morebits.array.js @@ -1,3 +1,5 @@ +'use strict'; + describe('Morebits.array', () => { test('chunk', () => { assert.deepEqual(Morebits.array.chunk([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3), [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]], '10 over 3'); diff --git a/tests/morebits.batchOperation.js b/tests/morebits.batchOperation.js index 38ec8e6b4..13f6f4230 100644 --- a/tests/morebits.batchOperation.js +++ b/tests/morebits.batchOperation.js @@ -1,3 +1,5 @@ +'use strict'; + describe('Morebits.batchOperation', () => { test('Contruction', () => { assert.true(new Morebits.batchOperation() instanceof Morebits.batchOperation, 'Correct instance'); diff --git a/tests/morebits.createHtml.js b/tests/morebits.createHtml.js index d6e2a97c5..16ed47a3f 100644 --- a/tests/morebits.createHtml.js +++ b/tests/morebits.createHtml.js @@ -1,3 +1,5 @@ +'use strict'; + describe('Morebits.createHtml', () => { test('createHtml', () => { diff --git a/tests/morebits.date.js b/tests/morebits.date.js index 6b7a2ef87..8f4d5aed6 100644 --- a/tests/morebits.date.js +++ b/tests/morebits.date.js @@ -1,3 +1,5 @@ +'use strict'; + describe('Morebits.date', () => { var now = Date.now(); var ts_mw = '16:26, 7 November 2020 (UTC)', ts_iso = '2020-11-07T16:26:00.000Z', naive = 20201107162600; diff --git a/tests/morebits.ip.js b/tests/morebits.ip.js index 06e5b5516..d4f2da800 100644 --- a/tests/morebits.ip.js +++ b/tests/morebits.ip.js @@ -1,3 +1,5 @@ +'use strict'; + describe('Morebits.ip', () => { test('sanitizeIPv6', () => { assert.strictEqual(Morebits.ip.sanitizeIPv6('2001:0db8:0010:0000:0000:0000:0000:0001'), '2001:DB8:10:0:0:0:0:1', 'Shorten IPv6'); diff --git a/tests/morebits.js b/tests/morebits.js index 741eb212a..13083740c 100644 --- a/tests/morebits.js +++ b/tests/morebits.js @@ -1,3 +1,5 @@ +'use strict'; + describe('constants', () => { test('userIsSysop', () => { assert.true(Morebits.userIsSysop, 'Is sysop'); diff --git a/tests/morebits.quickForm.js b/tests/morebits.quickForm.js index 42b7817aa..3009fcb95 100644 --- a/tests/morebits.quickForm.js +++ b/tests/morebits.quickForm.js @@ -1,3 +1,5 @@ +'use strict'; + /** Simple helper to render a quickform element */ function renderElement(data) { return new Morebits.quickForm.element(data).render(); diff --git a/tests/morebits.string.js b/tests/morebits.string.js index 43505b9c7..e06060129 100644 --- a/tests/morebits.string.js +++ b/tests/morebits.string.js @@ -1,3 +1,5 @@ +'use strict'; + describe('Morebits.string', () => { test('escapeRegExp', () => { assert.strictEqual(Morebits.string.escapeRegExp('Four score and seven years ago'), 'Four[_ ]score[_ ]and[_ ]seven[_ ]years[_ ]ago', 'Spaces'); diff --git a/tests/morebits.taskManager.js b/tests/morebits.taskManager.js index e3d8e48bf..4aaf14044 100644 --- a/tests/morebits.taskManager.js +++ b/tests/morebits.taskManager.js @@ -1,3 +1,5 @@ +'use strict'; + describe('Morebits.taskManager', () => { test('Contruction', () => { var tm = new Morebits.taskManager(); diff --git a/tests/morebits.unbinder.js b/tests/morebits.unbinder.js index fa3419557..359a674df 100644 --- a/tests/morebits.unbinder.js +++ b/tests/morebits.unbinder.js @@ -1,3 +1,5 @@ +'use strict'; + describe('Morebits.unbinder', () => { test('Construction', () => { assert.throws(() => new Morebits.unbinder(), 'throws: no string'); diff --git a/tests/morebits.wikitext.js b/tests/morebits.wikitext.js index c1942878d..3cd5e1673 100644 --- a/tests/morebits.wikitext.js +++ b/tests/morebits.wikitext.js @@ -1,3 +1,5 @@ +'use strict'; + describe('Morebits.wikitext', () => { test('parseTemplate', () => { // Function to help build a template from a sample object diff --git a/tests/twinkleblock.test.js b/tests/twinkleblock.test.js index 732af83da..83ffe60bb 100644 --- a/tests/twinkleblock.test.js +++ b/tests/twinkleblock.test.js @@ -1,3 +1,5 @@ +'use strict'; + describe('modules/twinkleblock', () => { describe('combineFormDataAndFieldTemplateOptions', () => { // https://github.com/wikimedia-gadgets/twinkle/issues/2106 diff --git a/tests/twinkletag.test.js b/tests/twinkletag.test.js index 16f913d55..e7775b7dd 100644 --- a/tests/twinkletag.test.js +++ b/tests/twinkletag.test.js @@ -1,3 +1,5 @@ +'use strict'; + describe('modules/twinkletag', () => { describe('checkIncompatible', () => { test('no conflicts, 0 tags to check', () => { diff --git a/tests/twinklewarn.test.js b/tests/twinklewarn.test.js index de88f45cf..78e90d504 100644 --- a/tests/twinklewarn.test.js +++ b/tests/twinklewarn.test.js @@ -1,3 +1,5 @@ +'use strict'; + describe('modules/twinklewarn', () => { describe('getTemplateProperty', () => { let templates = { diff --git a/tests/twinklexfd.test.js b/tests/twinklexfd.test.js index b96b87a8f..bc2c891fe 100644 --- a/tests/twinklexfd.test.js +++ b/tests/twinklexfd.test.js @@ -1,3 +1,5 @@ +'use strict'; + describe('modules/twinklexfd', () => { describe('insertRMTR', () => { test('0 rows, 1 line breaks', () => { From 4de8edb92d6b13c659e9dc91ac78d1e5a26b82b4 Mon Sep 17 00:00:00 2001 From: NovemLinguae Date: Wed, 11 Dec 2024 14:45:26 -0800 Subject: [PATCH 2/3] forgot a file --- tests/jest.setup.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/jest.setup.js b/tests/jest.setup.js index 96a9a1696..05931a5cc 100644 --- a/tests/jest.setup.js +++ b/tests/jest.setup.js @@ -1,3 +1,5 @@ +'use strict'; + // Tweak some mw.configs as needed by tests mw.config.set({ wgPageName: 'Macbeth,_King_of_Scotland', From a70ba8377988f68fe12adb2b98c4905cc7872c79 Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Thu, 12 Dec 2024 01:04:14 -0800 Subject: [PATCH 3/3] remove comma --- tests/.eslintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/.eslintrc.json b/tests/.eslintrc.json index 592252bb0..6196eb827 100644 --- a/tests/.eslintrc.json +++ b/tests/.eslintrc.json @@ -16,6 +16,6 @@ "camelcase": "warn", "new-cap": "warn", "no-undef": "warn", - "no-useless-escape": "warn", + "no-useless-escape": "warn" } }