-
Notifications
You must be signed in to change notification settings - Fork 351
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
Upgrade ESLint and @typescript-eslint to remove lint warning #1971
Conversation
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (ed363a9) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1971 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1971 |
Size Change: +317 B (+0.02%) Total Size: 1.27 MB
ℹ️ View Unchanged
|
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.
LGTM. Nice use of optional chaining. Thanks for doing this upgrade.
@@ -228,7 +227,7 @@ class MathInput extends React.Component<Props, State> { | |||
// in which case we don't want to dismiss the keypad on check. | |||
if (!isWithinKeypadBounds(x, y)) { | |||
this.blur(); | |||
this.props.onBlur && this.props.onBlur(); | |||
this.props.onBlur?.(); |
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.
Nice!
// eslint-disable-next-line @typescript-eslint/no-unused-expressions | ||
piece.content.length > 1 | ||
? (convertedSpeech += piece.content.slice(1)) | ||
: (convertedSpeech += piece.content); |
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.
You can configure @typescript-eslint/no-unused-expressions
to allow ternaries if you want, see https://eslint.org/docs/latest/rules/no-unused-expressions#options.
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 find assignment within a ternary to be pretty difficult to maintain/understand. I re-worked this slightly.
@nishasy for visibility as you wrote this. What do you think of transforming what you wrote to:
convertedSpeech +=
piece.content.length > 1
? piece.content.slice(1)
: piece.content;
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.
@jeremywiebe Good point! I like it 🚀
} catch { | ||
return "unknown"; | ||
} |
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 didn't realize this syntax was support. Nice!
Summary:
This PR bumps @typescript-eslint/* to v8.18.0 and ESLint to v8.57.1 to suppress a new lint warning after bumping @khanacademy/eslint-plugin from v3.0.0 to v3.0.1.
The warning looked like this:
Issue: FEI-6012
Test plan:
$ yarn --check-files; yarn lint
no warnings about TypeScript versions