Skip to content

Commit e7edc53

Browse files
chore: use typescript-eslint@v6 with reworked configs (#4541)
* feat: use typescript-eslint@v6 with reworked configs * Fix formatting * Fix config?.reactQueryContext * activate some stuff * prefer nullish * huh * prettier * fix --------- Co-authored-by: juliusmarminge <[email protected]>
1 parent 7b06f63 commit e7edc53

File tree

5 files changed

+29
-12
lines changed

5 files changed

+29
-12
lines changed

.eslintrc

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"parser": "@typescript-eslint/parser", // Specifies the ESLint parser
33
"extends": [
4-
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
4+
"plugin:@typescript-eslint/recommended-type-checked",
5+
"plugin:@typescript-eslint/stylistic-type-checked",
56
"plugin:react/recommended",
67
"plugin:react-hooks/recommended",
78
"plugin:prettier/recommended"
@@ -13,11 +14,24 @@
1314
},
1415
"rules": {
1516
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
16-
"@typescript-eslint/explicit-function-return-type": "off",
17-
"@typescript-eslint/explicit-module-boundary-types": "off",
17+
"@typescript-eslint/consistent-type-definitions": "off",
1818
"react/react-in-jsx-scope": "off",
1919
"react/prop-types": "off",
20-
"@typescript-eslint/no-explicit-any": "off"
20+
21+
// Consider removing these rule disables for more type safety in your app ✨
22+
"@typescript-eslint/no-confusing-void-expression": "off",
23+
"@typescript-eslint/no-explicit-any": "off",
24+
"@typescript-eslint/no-floating-promises": "off",
25+
"@typescript-eslint/no-misused-promises": "off",
26+
"@typescript-eslint/no-unsafe-assignment": "off",
27+
"@typescript-eslint/no-unsafe-argument": "off",
28+
"@typescript-eslint/no-unsafe-call": "off",
29+
"@typescript-eslint/no-unsafe-declaration-merging": "off",
30+
"@typescript-eslint/no-unsafe-return": "off",
31+
"@typescript-eslint/no-unsafe-member-access": "off",
32+
"@typescript-eslint/prefer-nullish-coalescing": "off",
33+
"@typescript-eslint/require-await": "off",
34+
"@typescript-eslint/restrict-plus-operands": "off"
2135
},
2236
// "overrides": [
2337
// {

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262
"@types/node": "^18.16.16",
6363
"@types/react": "^18.2.8",
6464
"@types/ws": "^8.2.0",
65-
"@typescript-eslint/eslint-plugin": "^5.59.2",
66-
"@typescript-eslint/parser": "^5.59.2",
65+
"@typescript-eslint/eslint-plugin": "6.0.0-alpha.158",
66+
"@typescript-eslint/parser": "6.0.0-alpha.158",
6767
"autoprefixer": "^10.4.7",
6868
"cross-env": "^7.0.3",
6969
"eslint": "^8.40.0",

src/server/context.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import ws from 'ws';
1111
*/
1212
export const createContext = async (
1313
opts:
14-
| trpcNext.CreateNextContextOptions
15-
| NodeHTTPCreateContextFnOptions<IncomingMessage, ws>,
14+
| NodeHTTPCreateContextFnOptions<IncomingMessage, ws>
15+
| trpcNext.CreateNextContextOptions,
1616
) => {
1717
const session = await getSession(opts);
1818

src/server/prodServer.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ void app.prepare().then(() => {
3535
});
3636
server.listen(port);
3737

38-
// tslint:disable-next-line:no-console
3938
console.log(
4039
`> Server listening at http://localhost:${port} as ${
4140
dev ? 'development' : process.env.NODE_ENV

src/server/routers/post.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ const interval = setInterval(() => {
4646
ee.emit('isTypingUpdate');
4747
}
4848
}, 3e3);
49-
process.on('SIGTERM', () => clearInterval(interval));
49+
process.on('SIGTERM', () => {
50+
clearInterval(interval);
51+
});
5052

5153
export const postRouter = router({
5254
add: authedProcedure
@@ -105,7 +107,7 @@ export const postRouter = router({
105107
skip: 0,
106108
});
107109
const items = page.reverse();
108-
let prevCursor: null | typeof cursor = null;
110+
let prevCursor: typeof cursor | null = null;
109111
if (items.length > take) {
110112
const prev = items.shift();
111113
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -119,7 +121,9 @@ export const postRouter = router({
119121

120122
onAdd: publicProcedure.subscription(() => {
121123
return observable<Post>((emit) => {
122-
const onAdd = (data: Post) => emit.next(data);
124+
const onAdd = (data: Post) => {
125+
emit.next(data);
126+
};
123127
ee.on('add', onAdd);
124128
return () => {
125129
ee.off('add', onAdd);

0 commit comments

Comments
 (0)