From b19755f9461a8ce54da4c49d5906d5c3fcba6191 Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Fri, 21 Jun 2024 13:02:30 +0200 Subject: [PATCH] lint & run the linters as part of the unit testing --- package.json | 4 ++-- test/api_layer.test.ts | 2 +- test/api_rasterband.test.ts | 2 +- test/api_wrapVRT.test.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 863650035..c0be9b17b 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ } ], "scripts": { - "test": "mocha && npm run test:stress 20", + "test": "npm run lint && mocha && npm run test:stress 20", "bench": "node bench/streams.js", "lint:cpp": "clang-format -i src/*.cpp src/*.hpp && clang-format -i src/*/*.cpp src/*/*.hpp", "lint:js": "eslint lib test examples", @@ -113,7 +113,7 @@ "documentation-hipster": "^1.0.0", "documentation-polyglot": "^1.0.1", "eslint": "^8.15.0", - "eslint-plugin-array-func": "^5.0.1", + "eslint-plugin-array-func": "^4.0.0", "eslint-plugin-mocha": "^10.1.0", "eslint-plugin-prefer-arrow": "^1.1.3", "gh-pages": "^6.1.1", diff --git a/test/api_layer.test.ts b/test/api_layer.test.ts index 4dc60847d..a9240b698 100644 --- a/test/api_layer.test.ts +++ b/test/api_layer.test.ts @@ -280,7 +280,7 @@ describe('gdal.Layer', () => { assert.closeTo(actual_envelope.maxY, expected_envelope.maxY, 0.00001) }) }) - it("should throw error if force flag is false and layer doesn't have extent already computed", function() { + it("should throw error if force flag is false and layer doesn't have extent already computed", () => { // No longer true in GDAL 3.9 if (semver.lt(gdal.version, '3.9.0')) { const dataset = gdal.open(`${__dirname}/data/park.geo.json`) diff --git a/test/api_rasterband.test.ts b/test/api_rasterband.test.ts index a01faddba..eb5f5c7eb 100644 --- a/test/api_rasterband.test.ts +++ b/test/api_rasterband.test.ts @@ -654,7 +654,7 @@ describe('gdal.RasterBand', () => { ds.rasterSize.x / 2, ds.rasterSize.y / 2, data) }, /Array length must be greater than/) }) - it('w/file over the 4G elements limit', function() { + it('w/file over the 4G elements limit', function () { if (semver.gte(process.versions.node, '22.0.0')) { // It seems that Node.js 22 (V8?) has removed the 32-bit index restrictions // on TypedArrays diff --git a/test/api_wrapVRT.test.ts b/test/api_wrapVRT.test.ts index a0a4d1ec1..5d6be20e7 100644 --- a/test/api_wrapVRT.test.ts +++ b/test/api_wrapVRT.test.ts @@ -100,7 +100,7 @@ ${Object.keys(metadata).map((k) => ` ${metadata[k]}`).j const bands = ds.bands.map((b) => ({ sources: [ b ] })) - const actual = gdal.wrapVRT({bands}) + const actual = gdal.wrapVRT({ bands }) assert.strictEqual(actual, expected) })