Skip to content
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

fix(eslint): pass #6 #1871

Merged
merged 6 commits into from Mar 19, 2024
Merged

fix(eslint): pass #6 #1871

merged 6 commits into from Mar 19, 2024

Conversation

bodinsamuel
Copy link
Contributor

@bodinsamuel bodinsamuel commented Mar 18, 2024

Describe your changes

  • Frontend eslint was not configured correctly
  • Manually fix some Eslint errors

@bodinsamuel bodinsamuel self-assigned this Mar 18, 2024
Comment on lines +27 to +36
session({
secret: process.env['NANGO_ADMIN_KEY'] || 'nango',
resave: false,
saveUninitialized: false,
store: sessionStore,
name: 'nango_session',
unset: 'destroy',
cookie: { maxAge: 30 * 24 * 60 * 60 * 1000, secure: false },
rolling: true
})

Check warning

Code scanning / CodeQL

Clear text transmission of sensitive cookie Medium

Sensitive cookie sent without enforcing SSL encryption.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason we have set secure: false?

packages/server/lib/clients/auth.client.ts Dismissed Show dismissed Hide dismissed
packages/server/lib/clients/auth.client.ts Dismissed Show dismissed Hide dismissed
packages/server/lib/clients/oauth1.client.ts Outdated Show resolved Hide resolved
@@ -3,116 +3,114 @@ export interface WSErr {
message: string;
}

export class WSErrBuilder {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything could be replaced by actual class [..] extend Error

@bodinsamuel bodinsamuel marked this pull request as ready for review March 18, 2024 17:37
@@ -73,7 +74,7 @@ class CompileService {
continue;
}
const result = compiler.compile(fs.readFileSync(filePath, 'utf8'), filePath);
const jsFilePath = filePath.replace(/\/[^\/]*$/, `/dist/${path.basename(filePath.replace('.ts', '.js'))}`);
const jsFilePath = filePath.replace(/\/[^/]*$/, `/dist/${path.basename(filePath.replace('.ts', '.js'))}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how was it working before? or maybe it wasn't?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's just ignored by the regex compiler hence why it's unnecessary, cf: https://eslint.org/docs/latest/rules/no-useless-escape

@@ -39,7 +39,7 @@ server.post(
msg: z.string()
})
}),
persistController.saveActivityLog
persistController.saveActivityLog.bind(persistController)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is bind necessary here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not necessary to make it work but because it's in a class this reference can be mistakenly overrode.
overall our usage of class is probably unnecessary

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what would you recommend instead of using a class?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

straight up function, if we had state it would be debatable but it's not the case and I would argue keeping state between api calls is dangerous

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed. In this specific case the class in only used as a namespace mechanism


export function extractQueryParams(data: string | Buffer | undefined) {
return new URLSearchParams(typeof data === 'string' ? data : data?.toString());
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not add Object.fromEntries as part of the logic here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point

@bodinsamuel bodinsamuel merged commit dbe5ce1 into master Mar 19, 2024
16 checks passed
@bodinsamuel bodinsamuel deleted the fix/eslint-pass-6 branch March 19, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants