Skip to content

Commit

Permalink
Allow merging HeadersInit objects under new eslint rules
Browse files Browse the repository at this point in the history
Using the spread operator on an array in an object will result in a list of indices  @typescript-eslint/no-misused-spread
  • Loading branch information
dpilafian committed Jan 20, 2025
1 parent d77f508 commit 2ed4395
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions fetch-json.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// fetch-json ~ MIT License

/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-explicit-any */
export type Json = string | number | boolean | null | undefined | JsonObject | Json[];
export type JsonObject = { [key: string]: Json };
export type JsonData = JsonObject | Json[];
Expand Down Expand Up @@ -57,7 +57,7 @@ const fetchJson = {
const jsonHeaders: HeadersInit = { Accept: 'application/json' };
if (!isGetRequest && data)
jsonHeaders['Content-Type'] = 'application/json';
settings.headers = { ...jsonHeaders, ...settings.headers };
settings.headers = { ...jsonHeaders, ...settings.headers }; //eslint-disable-line @typescript-eslint/no-misused-spread
const paramKeys = isGetRequest && data ? Object.keys(data) : <string[]>[];
const getValue = (key: string) => data ? data[<keyof typeof data>key] : '';
const toPair = (key: string) => key + '=' + encodeURIComponent(getValue(key)); //build query string field-value
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,30 +72,30 @@
"interactive": "http-server -o spec/fixtures/"
},
"devDependencies": {
"@eslint/js": "~9.11",
"@fortawesome/fontawesome-free": "~6.6",
"@types/node": "~22.7",
"@eslint/js": "~9.18",
"@fortawesome/fontawesome-free": "~6.7",
"@types/node": "~22.10",
"add-dist-header": "~1.4",
"assert-deep-strict-equal": "~1.2",
"copy-file-util": "~1.2",
"copy-folder-util": "~1.1",
"dna-engine": "~3.2",
"eslint": "~9.11",
"eslint": "~9.18",
"esm-to-plain-js": "~1.1",
"http-server": "~14.1",
"jsdom": "~25.0",
"jsdom": "~26.0",
"jshint": "~2.13",
"mocha": "~10.7",
"puppeteer": "~23.4",
"mocha": "~11.0",
"puppeteer": "~24.1",
"puppeteer-browser-ready": "~1.3",
"replacer-util": "~1.3",
"rimraf": "~6.0",
"run-scripts-util": "~1.3",
"typescript": "~5.6",
"typescript-eslint": "~8.7",
"typescript": "~5.7",
"typescript-eslint": "~8.20",
"uglify-js": "~3.19",
"w3c-html-validator": "~1.8",
"web-ignition": "~2.2",
"web-ignition": "~2.3",
"whatwg-fetch": "~3.6"
}
}

0 comments on commit 2ed4395

Please sign in to comment.