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

lint(eslint): Enable no-extra-non-null-assertion and auto-fix violations #83786

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ryan953
Copy link
Member

@ryan953 ryan953 commented Jan 21, 2025

Two kinda of fixes in here

Auto fixes to remove double !!:

- span: fullWaterfall[1]!!.span,
+ span: fullWaterfall[1]!.span,

and manual fixes to move many ! to the end of chains:

- series[0]!?.data[1]!?.name
+ series[0]?.data[1]?.name!

@ryan953 ryan953 requested review from a team as code owners January 21, 2025 22:54
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 21, 2025
@@ -344,7 +344,7 @@ export default typescript.config([
...react.configs.flat.recommended.rules,
...react.configs.flat['jsx-runtime'].rules,
'react/display-name': 'off', // TODO(ryan953): Fix violations and delete this line
'react/no-unescaped-entities': 'off', // TODO(ryan953): Fix violations and delete this line
'react/no-unescaped-entities': 'off',
Copy link
Member Author

Choose a reason for hiding this comment

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

This isn't going to happen. I tried and it's not worth it right now: #83511

@@ -418,8 +418,7 @@ export default typescript.config([
'@typescript-eslint/ban-ts-comment': 'off', // TODO(ryan953): Fix violations and delete this line
'@typescript-eslint/no-array-constructor': 'off', // TODO(ryan953): Fix violations and delete this line
'@typescript-eslint/no-empty-object-type': 'off', // TODO(ryan953): Fix violations and delete this line
'@typescript-eslint/no-explicit-any': 'off', // TODO(ryan953): Fix violations and delete this line
'@typescript-eslint/no-extra-non-null-assertion': 'off', // TODO(ryan953): Fix violations and delete this line
'@typescript-eslint/no-explicit-any': 'off',
Copy link
Member Author

Choose a reason for hiding this comment

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

no-explicit-any isn't going to happen.

@@ -142,11 +142,11 @@ export const MetricChart = memo(
}
});

const bucketSize = series[0]!?.data[1]!?.name - series[0]!?.data[0]!?.name;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a good example where a manual fix was needed...

Before we had ! next to each of the optional fields, chained all the way down.

Now we have one ! at the end of the chain.

@@ -668,7 +668,7 @@ describe('WaterfallModel', () => {

expected[1] = {
type: 'out_of_view',
span: fullWaterfall[1]!!.span,
Copy link
Member Author

Choose a reason for hiding this comment

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

Here's an example of the automation fixing some earlier automation.

@ryan953 ryan953 enabled auto-merge (squash) January 21, 2025 23:51
@ryan953 ryan953 changed the title chore(eslint): Enable no-extra-non-null-assertion and auto-fix violations lint(eslint): Enable no-extra-non-null-assertion and auto-fix violations Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant