diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b207add..ef5d807 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: node-version: ${{ matrix.node-version }} - run: npm install - run: npm test - - uses: codecov/codecov-action@v1 - if: matrix.node-version == 14 + - uses: codecov/codecov-action@v2 + if: matrix.node-version == 16 with: fail_ci_if_error: true diff --git a/index.js b/index.js index 70673a8..1c5f9a1 100644 --- a/index.js +++ b/index.js @@ -192,6 +192,7 @@ export default function normalizeUrl(urlString, options) { // Remove query unwanted parameters if (Array.isArray(options.removeQueryParameters)) { + // eslint-disable-next-line unicorn/no-useless-spread -- We are intentionally spreading to get a copy. for (const key of [...urlObject.searchParams.keys()]) { if (testParameter(key, options.removeQueryParameters)) { urlObject.searchParams.delete(key); diff --git a/index.test-d.ts b/index.test-d.ts index 536b93d..17c38b8 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -11,7 +11,7 @@ normalizeUrl('http://sindresorhus.com:80/', {forceHttps: true}); normalizeUrl('user:password@sindresorhus.com', {stripAuthentication: false}); normalizeUrl('sindresorhus.com/about.html#contact', {stripHash: true}); normalizeUrl('https://sindresorhus.com', {stripProtocol: true}); -normalizeUrl('http://www.sindresorhus.com', {stripWWW: false}); +normalizeUrl('http://www.sindresorhus.com', {stripWWW: false}); // eslint-disable-line @typescript-eslint/naming-convention normalizeUrl('www.sindresorhus.com?foo=bar&ref=test_ref', { removeQueryParameters: ['ref', /test/], }); diff --git a/package.json b/package.json index af71686..09c50e0 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "node": ">=12.20" }, "scripts": { - "test": "xo && c8 ava && tsd" + "test": "ava && tsd" }, "files": [ "index.js", @@ -38,11 +38,10 @@ "canonical" ], "devDependencies": { - "ava": "^3.15.0", - "c8": "^7.7.3", - "tsd": "^0.17.0", - "typescript": "^4.3.5", - "xo": "^0.41.0" + "ava": "^4.0.1", + "c8": "^7.11.0", + "tsd": "^0.19.1", + "xo": "^0.47.0" }, "c8": { "reporter": [ diff --git a/readme.md b/readme.md index fea18e8..71d8638 100644 --- a/readme.md +++ b/readme.md @@ -8,8 +8,8 @@ Useful when you need to display, store, deduplicate, sort, compare, etc, URLs. ## Install -``` -$ npm install normalize-url +```sh +npm install normalize-url ``` *If you need to use this in the browser, use version 4: `npm i normalize-url@4`*