Skip to content

Commit e63c598

Browse files
committedMay 16, 2024·
chore: update to eslint v9
1 parent 509a037 commit e63c598

9 files changed

+328
-1235
lines changed
 

‎.eslintignore

-1
This file was deleted.

‎.eslintrc

-8
This file was deleted.

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ await ofetch("https://google.com/404");
9999
To catch error response:
100100

101101
```ts
102-
await ofetch("/url").catch((err) => err.data);
102+
await ofetch("/url").catch((error) => error.data);
103103
```
104104

105105
To bypass status error catching you can set `ignoreResponseError` option:

‎eslint.config.mjs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import unjs from "eslint-config-unjs";
2+
3+
// https://github.com/unjs/eslint-config
4+
export default unjs({
5+
ignores: [],
6+
rules: {
7+
"no-undef": 0,
8+
"unicorn/consistent-destructuring": 0,
9+
"unicorn/no-await-expression-member": 0
10+
},
11+
});

‎package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262
"scripts": {
6363
"build": "unbuild",
6464
"dev": "vitest",
65-
"lint": "eslint --ext .ts . && prettier -c src test playground examples",
66-
"lint:fix": "eslint --fix --ext .ts . && prettier -w src test playground examples",
65+
"lint": "eslint . && prettier -c src test playground examples",
66+
"lint:fix": "eslint --fix . && prettier -w src test playground examples",
6767
"prepack": "pnpm build",
6868
"play": "jiti playground/index.ts",
6969
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
@@ -78,8 +78,8 @@
7878
"@types/node": "^20.12.12",
7979
"@vitest/coverage-v8": "^1.6.0",
8080
"changelogen": "^0.5.5",
81-
"eslint": "^8.57.0",
82-
"eslint-config-unjs": "^0.2.1",
81+
"eslint": "^9.2.0",
82+
"eslint-config-unjs": "^0.3.1",
8383
"fetch-blob": "^4.0.0",
8484
"formdata-polyfill": "^4.0.10",
8585
"h3": "^1.11.1",
@@ -92,4 +92,4 @@
9292
"vitest": "^1.6.0"
9393
},
9494
"packageManager": "pnpm@9.1.1"
95-
}
95+
}

‎playground/index.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ async function main() {
44
// const r = await $fetch<string>('http://google.com/404')
55
const r = await $fetch<string>("http://httpstat.us/500");
66
// const r = await $fetch<string>('http://httpstat/500')
7-
// eslint-disable-next-line no-console
7+
88
console.log(r);
99
}
1010

1111
// eslint-disable-next-line unicorn/prefer-top-level-await
1212
main().catch((error) => {
13-
// eslint-disable-next-line no-console
1413
console.error(error);
1514
// eslint-disable-next-line unicorn/no-process-exit
1615
process.exit(1);

‎pnpm-lock.yaml

+308-1,216
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/error.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { FetchContext, IFetchError } from "./types";
22

3+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
34
export class FetchError<T = any> extends Error implements IFetchError<T> {
45
constructor(message: string, opts?: { cause: unknown }) {
56
// @ts-ignore https://v8.dev/features/error-cause

‎src/types.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface $Fetch {
2121

2222
export interface FetchContext<T = any, R extends ResponseType = ResponseType> {
2323
request: FetchRequest;
24-
// eslint-disable-next-line no-use-before-define
24+
2525
options: FetchOptions<R>;
2626
response?: FetchResponse<T>;
2727
error?: Error;
@@ -70,7 +70,6 @@ export interface FetchOptions<R extends ResponseType = ResponseType>
7070
}
7171

7272
export interface CreateFetchOptions {
73-
// eslint-disable-next-line no-use-before-define
7473
defaults?: FetchOptions;
7574
fetch?: Fetch;
7675
Headers?: typeof Headers;

0 commit comments

Comments
 (0)
Please sign in to comment.