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

Upgrade ESLint and @typescript-eslint to remove lint warning #1971

Merged
merged 4 commits into from
Dec 12, 2024

Conversation

jeremywiebe
Copy link
Collaborator

@jeremywiebe jeremywiebe commented Dec 9, 2024

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:

$ yarn lint 
=============

WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=4.7.4 <5.6.0

YOUR TYPESCRIPT VERSION: 5.7.2

Please only submit bug reports when using the officially supported version.

=============	

Issue: FEI-6012

Test plan:

$ yarn --check-files; yarn lint no warnings about TypeScript versions

@jeremywiebe jeremywiebe self-assigned this Dec 9, 2024
@jeremywiebe jeremywiebe requested review from kevinb-khan and a team December 9, 2024 21:21
@jeremywiebe jeremywiebe marked this pull request as ready for review December 9, 2024 21:23
Copy link
Contributor

github-actions bot commented Dec 9, 2024

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (ed363a9) and published it to npm. You
can install it using the tag PR1971.

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

Copy link
Contributor

github-actions bot commented Dec 9, 2024

Size Change: +317 B (+0.02%)

Total Size: 1.27 MB

Filename Size Change
packages/kas/dist/es/index.js 39 kB +5 B (+0.01%)
packages/math-input/dist/es/index.js 77.9 kB +58 B (+0.07%)
packages/perseus-editor/dist/es/index.js 688 kB +8 B (0%)
packages/perseus/dist/es/index.js 416 kB +243 B (+0.06%)
packages/simple-markdown/dist/es/index.js 12.5 kB +3 B (+0.02%)
ℹ️ View Unchanged
Filename Size
packages/keypad-context/dist/es/index.js 760 B
packages/kmath/dist/es/index.js 4.27 kB
packages/math-input/dist/es/strings.js 1.79 kB
packages/perseus-core/dist/es/index.js 1.48 kB
packages/perseus-linter/dist/es/index.js 22.2 kB
packages/perseus/dist/es/strings.js 3.7 kB
packages/pure-markdown/dist/es/index.js 3.66 kB

compressed-size-action

Copy link
Contributor

@kevinb-khan kevinb-khan left a 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?.();
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Comment on lines 154 to 157
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
piece.content.length > 1
? (convertedSpeech += piece.content.slice(1))
: (convertedSpeech += piece.content);
Copy link
Contributor

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.

Copy link
Collaborator Author

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;

Copy link
Contributor

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 🚀

Comment on lines +55 to 57
} catch {
return "unknown";
}
Copy link
Contributor

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!

@jeremywiebe jeremywiebe merged commit 341d316 into main Dec 12, 2024
8 checks passed
@jeremywiebe jeremywiebe deleted the jer/fei-6012-for-perseus branch December 12, 2024 00:39
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