Skip to content

Commit

Permalink
chore: use typescript-eslint@v6 with reworked configs (#4541)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
JoshuaKGoldberg and juliusmarminge committed Jun 28, 2023
1 parent 7b06f63 commit e7edc53
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
22 changes: 18 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"parser": "@typescript-eslint/parser", // Specifies the ESLint parser
"extends": [
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended"
Expand All @@ -13,11 +14,24 @@
},
"rules": {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"@typescript-eslint/no-explicit-any": "off"

// Consider removing these rule disables for more type safety in your app ✨
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-declaration-merging": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/prefer-nullish-coalescing": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/restrict-plus-operands": "off"
},
// "overrides": [
// {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
"@types/node": "^18.16.16",
"@types/react": "^18.2.8",
"@types/ws": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"@typescript-eslint/eslint-plugin": "6.0.0-alpha.158",
"@typescript-eslint/parser": "6.0.0-alpha.158",
"autoprefixer": "^10.4.7",
"cross-env": "^7.0.3",
"eslint": "^8.40.0",
Expand Down
4 changes: 2 additions & 2 deletions src/server/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import ws from 'ws';
*/
export const createContext = async (
opts:
| trpcNext.CreateNextContextOptions
| NodeHTTPCreateContextFnOptions<IncomingMessage, ws>,
| NodeHTTPCreateContextFnOptions<IncomingMessage, ws>
| trpcNext.CreateNextContextOptions,
) => {
const session = await getSession(opts);

Expand Down
1 change: 0 additions & 1 deletion src/server/prodServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ void app.prepare().then(() => {
});
server.listen(port);

// tslint:disable-next-line:no-console
console.log(
`> Server listening at http://localhost:${port} as ${
dev ? 'development' : process.env.NODE_ENV
Expand Down
10 changes: 7 additions & 3 deletions src/server/routers/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ const interval = setInterval(() => {
ee.emit('isTypingUpdate');
}
}, 3e3);
process.on('SIGTERM', () => clearInterval(interval));
process.on('SIGTERM', () => {
clearInterval(interval);
});

export const postRouter = router({
add: authedProcedure
Expand Down Expand Up @@ -105,7 +107,7 @@ export const postRouter = router({
skip: 0,
});
const items = page.reverse();
let prevCursor: null | typeof cursor = null;
let prevCursor: typeof cursor | null = null;
if (items.length > take) {
const prev = items.shift();
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Expand All @@ -119,7 +121,9 @@ export const postRouter = router({

onAdd: publicProcedure.subscription(() => {
return observable<Post>((emit) => {
const onAdd = (data: Post) => emit.next(data);
const onAdd = (data: Post) => {
emit.next(data);
};
ee.on('add', onAdd);
return () => {
ee.off('add', onAdd);
Expand Down

0 comments on commit e7edc53

Please sign in to comment.