Skip to content

Commit

Permalink
chore(framework): Fix ESLint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SokratisVidros committed Jan 9, 2025
1 parent f8fac8f commit 97d3c44
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .source
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export default tsEslint.config(
'unused-imports': fixupPluginRules(unusedImports),
},
rules: {
'id-length': 'off',
'max-len': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'import/prefer-default-export': 0,
Expand Down
1 change: 0 additions & 1 deletion packages/framework/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import { validateData } from './validators';
import { mockSchema } from './jsonSchemaFaker';
import { prettyPrintDiscovery } from './resources/workflow/pretty-print-discovery';
import { deepMerge } from './utils/object.utils';
import build from 'next/dist/build';

function isRuntimeInDevelopment() {
return ['development', undefined].includes(process.env.NODE_ENV);
Expand Down
2 changes: 2 additions & 0 deletions packages/framework/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ export class NovuRequestHandler<Input extends any[] = any[], Output = any> {
* Log bridge server errors to assist the Developer in debugging errors with their integration.
* This path is reached when the Bridge application throws an error, ensuring they can see the error in their logs.
*/
// eslint-disable-next-line @typescript-eslint/no-base-to-string
log((l) => l.error(error.message || error.toString()));
}

Expand All @@ -283,6 +284,7 @@ export class NovuRequestHandler<Input extends any[] = any[], Output = any> {
return this.createError(error);
} else {
const bridgeError = new BridgeError(error);
// eslint-disable-next-line @typescript-eslint/no-base-to-string
log((l) => l.error(bridgeError.message || bridgeError.toString()));

return this.createError(bridgeError);
Expand Down
1 change: 1 addition & 0 deletions packages/framework/src/servers/h3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const serve = (options: ServeHandlerOptions) => {
String(event.path),
`${process.env.NODE_ENV === 'development' ? 'http' : 'https'}://${String(getHeader(event, 'host'))}`
),
// eslint-disable-next-line @typescript-eslint/no-base-to-string
queryString: (key) => String(getQuery(event)[key]),
transformResponse: (actionRes) => {
const { res } = event.node;
Expand Down
1 change: 1 addition & 0 deletions packages/framework/src/servers/nuxt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const serve = (options: ServeHandlerOptions) => {
* TODO: Fix this
*/
handler: (event: H3Event) => ({
// eslint-disable-next-line @typescript-eslint/no-base-to-string
queryString: (key) => String(getQuery(event)[key]),
body: () => readBody(event),
headers: (key) => getHeader(event, key),
Expand Down
10 changes: 8 additions & 2 deletions packages/framework/src/utils/log.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,17 @@ export function log(message: string | ((formatter: typeof f) => string)): void {
}

if (typeof message === 'string') {
// eslint-disable-next-line no-console
console.log(message);
} else if (typeof message === 'function') {
// eslint-disable-next-line no-console
console.log(message(f));
}
}

log.enable = () => (enabled = true);
log.disable = () => (enabled = false);
log.enable = () => {
enabled = true;
};
log.disable = () => {
enabled = false;
};
2 changes: 1 addition & 1 deletion packages/framework/src/utils/options.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ export function resolveLogging(providedLogging?: boolean): boolean {
}

// Disable verbose logging in test and production environments
return ['test', 'production'].includes(process.env.NODE_ENV);
return !['test', 'production'].includes(process.env.NODE_ENV);
}

0 comments on commit 97d3c44

Please sign in to comment.