-
Notifications
You must be signed in to change notification settings - Fork 176
fix all the remaining eslint warnings #545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ module.exports = { | |
], | ||
"sonarjs/elseif-without-else": "warn", | ||
"sonarjs/no-duplicate-string": "warn", | ||
"sonarjs/cognitive-complexity": "warn", | ||
"sonarjs/cognitive-complexity": ["warn", 35], | ||
|
||
// We add some typescript rules - The recommended rules breaks too much stuff | ||
// TODO: We should add more rules, especially around typescript types | ||
|
@@ -29,8 +29,6 @@ module.exports = { | |
], | ||
|
||
"@typescript-eslint/unbound-method": "error", | ||
|
||
"@typescript-eslint/no-non-null-assertion": "warn", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am personally not a fan of this one 😅 if someone uses a non-null assertion I think that's generally for a good reason so having to add an eslint disabling comment for it feels very unnecessary/annoying to me 🤷 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I'm fine with this |
||
}, | ||
overrides: [ | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,8 @@ interface OpenNextOutput { | |
}; | ||
} | ||
|
||
const indexHandler = "index.hander"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a typo here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry 😓 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Typos happens to everyone. Your PR made the code more DRY and easier to read. Great work ⭐️ |
||
|
||
async function canStream(opts: FunctionOptions) { | ||
if (!opts.override?.wrapper) { | ||
return false; | ||
|
@@ -161,6 +163,7 @@ function prefixPattern(basePath: string) { | |
}; | ||
} | ||
|
||
// eslint-disable-next-line sonarjs/cognitive-complexity | ||
export async function generateOutput( | ||
outputPath: string, | ||
config: OpenNextConfig, | ||
|
@@ -183,7 +186,7 @@ export async function generateOutput( | |
if (value.placement === "global") { | ||
edgeFunctions[key] = { | ||
bundle: `.open-next/functions/${key}`, | ||
handler: "index.handler", | ||
handler: indexHandler, | ||
...(await extractOverrideFn(value.override)), | ||
}; | ||
} | ||
|
@@ -228,7 +231,7 @@ export async function generateOutput( | |
}, | ||
imageOptimizer: { | ||
type: "function", | ||
handler: "index.handler", | ||
handler: indexHandler, | ||
bundle: ".open-next/image-optimization-function", | ||
streaming: false, | ||
imageLoader: await extractOverrideName( | ||
|
@@ -247,7 +250,7 @@ export async function generateOutput( | |
} | ||
: { | ||
type: "function", | ||
handler: "index.handler", | ||
handler: indexHandler, | ||
bundle: ".open-next/server-functions/default", | ||
streaming: defaultOriginCanstream, | ||
...(await extractOverrideFn(config.default.override)), | ||
|
@@ -274,7 +277,7 @@ export async function generateOutput( | |
const streaming = await canStream(value); | ||
origins[key] = { | ||
type: "function", | ||
handler: "index.handler", | ||
handler: indexHandler, | ||
bundle: `.open-next/server-functions/${key}`, | ||
streaming, | ||
...(await extractOverrideFn(value.override)), | ||
|
@@ -348,19 +351,19 @@ export async function generateOutput( | |
disableIncrementalCache: config.dangerous?.disableIncrementalCache, | ||
disableTagCache: config.dangerous?.disableTagCache, | ||
warmer: { | ||
handler: "index.handler", | ||
handler: indexHandler, | ||
bundle: ".open-next/warmer-function", | ||
}, | ||
initializationFunction: isTagCacheDisabled | ||
? undefined | ||
: { | ||
handler: "index.handler", | ||
handler: indexHandler, | ||
bundle: ".open-next/dynamodb-provider", | ||
}, | ||
revalidationFunction: config.dangerous?.disableIncrementalCache | ||
? undefined | ||
: { | ||
handler: "index.handler", | ||
handler: indexHandler, | ||
bundle: ".open-next/revalidation-function", | ||
}, | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
35
allows most functions in the codebase, I could just add disabling comment to each one instead if preferred (there were around 10-ish or something I think)I did not attempt on splitting the functions as I am not really familiar with the codebase here (but I am happy to give it a go if you want 🙂)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
I need to take a closer look at the PR later today, I remember that there was a reason that it was this order. Might be old code