Skip to content

Commit b536bd2

Browse files
author
jarvisjiang
committed
chore(lint): update eslint config and error-handling example
1 parent 2503f1d commit b536bd2

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

eslint.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ export default defineConfig([
1919
tseslint.configs.stylistic,
2020
],
2121
rules: {
22+
// Error Prevention
23+
'eqeqeq': ['error', 'always', { 'null': 'ignore' }],
24+
'no-cond-assign': ['error', 'always'],
25+
'no-self-compare': 'error',
26+
'no-template-curly-in-string': 'error',
27+
28+
// Best Practices
29+
'default-case-last': 'error',
30+
'no-new-wrappers': 'error',
31+
'radix': 'error',
32+
33+
// ES6+ Style
34+
'prefer-template': 'error',
35+
'object-shorthand': 'error',
36+
37+
// Stylistic
2238
'@stylistic/semi': ['error', 'always'],
2339
'@stylistic/comma-dangle': ['error', 'always-multiline'],
2440
'@stylistic/member-delimiter-style': ['error', {

examples/error-handling.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Or with Deno: deno run --allow-net examples/error-handling.ts
66
*/
77

8-
import { fetchT, FetchError, ABORT_ERROR, TIMEOUT_ERROR } from '../src/mod.ts';
8+
import { ABORT_ERROR, FetchError, fetchT, TIMEOUT_ERROR } from '../src/mod.ts';
99

1010
const API_BASE = 'https://jsonplaceholder.typicode.com';
1111

@@ -365,7 +365,7 @@ async function resultChaining() {
365365
return {
366366
id: post.id,
367367
title: post.title.toUpperCase(),
368-
preview: post.body.substring(0, 50) + '...',
368+
preview: `${ post.body.substring(0, 50) }...`,
369369
};
370370
})
371371
.mapErr((err) => new Error(`Failed to fetch post: ${err.message}`));

0 commit comments

Comments
 (0)