Skip to content

build: Re-enable eslint no-unused-vars, no-control-regex and no-loss-of-precision #10049

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

Merged
merged 3 commits into from
Jan 4, 2024

Conversation

lforst
Copy link
Contributor

@lforst lforst commented Jan 4, 2024

This effectively undoes changes done in #9692

Our lint job passes even though we clearly have unused variables in our code base. Example: #10012 (comment)

This makes me not trust biome so I am adding back the eslint rules.

@@ -124,7 +124,7 @@
done();
}, 5_000);

childProcess.exec(`node ${testScriptPath}`, { encoding: 'utf8' }, (_, stdout) => {
childProcess.exec(`node ${testScriptPath}`, { encoding: 'utf8' }, () => {

Check warning

Code scanning / CodeQL

Shell command built from environment values

This shell command depends on an uncontrolled [absolute path](1).
@lforst lforst merged commit 5462b04 into develop Jan 4, 2024
@lforst lforst deleted the lforst-re-enable-biome-disabled-rules branch January 4, 2024 13:34
Copy link
Contributor

@anonrig anonrig left a comment

Choose a reason for hiding this comment

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

Variables starting with underscore is an exception to noUnusedVariables rule

@anonrig
Copy link
Contributor

anonrig commented Jan 4, 2024

Can you also open an issue to Biome repository? If we want to keep using Biome, we should upstream/inform Biome about the issues we find.

@@ -5,27 +5,21 @@ import type { Primitive } from './misc';
* An abstract definition of the minimum required API
* for a metric instance.
*/
export abstract class MetricInstance {
export interface MetricInstance {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did we make this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it was incorrect. We do not want this to be an abstract class. Nothing actually extended it. I made this change specifically in this PR because previously the value parameter in the add method was unused, causing linting errors.

@@ -13,7 +13,7 @@ sentryTest('should capture an error within a sync startSpan callback', async ({
const gotoPromise = page.goto(url);
const envelopePromise = getMultipleSentryEnvelopeRequests<Event>(page, 2);

const [_, events] = await Promise.all([gotoPromise, envelopePromise]);
const [, events] = await Promise.all([gotoPromise, envelopePromise]);
Copy link
Contributor

Choose a reason for hiding this comment

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

If you changed the order of Promise.all array, you wouldn't have [, syntax

@@ -35,7 +35,7 @@ export function instrumentNodeCron<T>(lib: Partial<NodeCron> & T): T {
// When 'get' is called for schedule, return a proxied version of the schedule function
return new Proxy(target.schedule, {
apply(target, thisArg, argArray: Parameters<NodeCron['schedule']>) {
const [expression, _, options] = argArray;
const [expression, , options] = argArray;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not in favor of sparse arrays. There is a specific eslint rule (and also for Biome) to avoid this: https://eslint.org/docs/latest/rules/no-sparse-arrays

public get weight(): number {
return 1;
}
weight: number;
Copy link
Contributor

Choose a reason for hiding this comment

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

This now becomes a variable, not a getter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typescript-wise, this is the same. Public API wise too!

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.

3 participants