Add eslint-config-prettier and update ESLint config

Integrated eslint-config-prettier to disable formatting rules that conflict with Prettier. Updated ESLint configuration and added the dependency to package.json for improved code formatting consistency.
This commit is contained in:
xixu-me committed 2025-12-08 19:34:56 +08:00
1 parent 7036cbd39e
commit d2ee1bcd37
4 files changed
+25 -5

No files matched your search

+2
View File
@@ -1,4 +1,5 @@
import js from '@eslint/js';
import prettierConfig from 'eslint-config-prettier';
export default [
js.configs.recommended,
@@ -230,6 +231,7 @@ export default [
'template-curly-spacing': ['error', 'never']
}
},
prettierConfig, // Disable formatting rules that conflict with Prettier
{
files: ['test/**/*.js'],
rules: {
+17
View File
@@ -15,6 +15,7 @@
"@cloudflare/vitest-pool-workers": "^0.10.14",
"@cloudflare/workers-types": "^4.20251205.0",
"eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8",
"prettier": "^3.7.4",
"typescript": "^5.9.3",
"vitest": "^3.1.4",
@@ -2381,6 +2382,22 @@
}
}
},
"node_modules/eslint-config-prettier": {
"version": "10.1.8",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz",
"integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
"dev": true,
"license": "MIT",
"bin": {
"eslint-config-prettier": "bin/cli.js"
},
"funding": {
"url": "https://opencollective.com/eslint-config-prettier"
},
"peerDependencies": {
"eslint": ">=7.0.0"
}
},
"node_modules/eslint-scope": {
"version": "8.4.0",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz",
+1
View File
@@ -7,6 +7,7 @@
"@cloudflare/vitest-pool-workers": "^0.10.14",
"@cloudflare/workers-types": "^4.20251205.0",
"eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8",
"prettier": "^3.7.4",
"typescript": "^5.9.3",
"vitest": "^3.1.4",
+5 -5
View File
@@ -1328,11 +1328,11 @@ async function handleRequest(request, env, ctx) {
// Always use GET method for cache key
const cacheKey = rangeHeader
? new Request(targetUrl, {
method: 'GET',
headers: new Headers(
[...request.headers.entries()].filter(([k]) => k.toLowerCase() !== 'range')
)
})
method: 'GET',
headers: new Headers(
[...request.headers.entries()].filter(([k]) => k.toLowerCase() !== 'range')
)
})
: new Request(targetUrl, { method: 'GET' });
// Use waitUntil if available (Cloudflare Workers), otherwise cache synchronously