-
Notifications
You must be signed in to change notification settings - Fork 8
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
And more lint fixes #44
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
See comments
package.json
Outdated
@@ -31,7 +31,7 @@ | |||
"lodash.throttle": "^4.1.1", | |||
"markdown-it": "^13.0.1", | |||
"marked": "^4.0.10", | |||
"monaco-editor-core": "^0.39.0", | |||
"monaco-editor-core": "~0.40.0", |
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.
This keeps the editor on the same version.
@@ -31,7 +31,7 @@ | |||
"lodash.throttle": "^4.1.1", | |||
"markdown-it": "^13.0.1", | |||
"marked": "^4.0.10", | |||
"monaco-editor-core": "^0.39.0", | |||
"monaco-editor": "~0.40.0", |
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.
Near as I can tell, @monaco-editor/react
depends on monaco-editor
, not -core
, which means that using it should both give us more faithful typing and also doesn't require bringing in a separate library.
@@ -52,7 +52,7 @@ export type EditorDisplayProps = { | |||
diff?: string | undefined; | |||
themeName?: string | undefined; | |||
hideMinimap?: boolean | undefined; | |||
fontSize?: string | undefined; | |||
fontSize?: number | undefined; |
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.
We were passing "13px" to a prop that takes a number. This fixes that.
message: `Malformed or invalid test data relationship: ${invalid.parsed.errorMessage}`, | ||
severity: monacoRef.MarkerSeverity.Error, | ||
}); | ||
if (monacoRef) { |
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.
Typeguarding
@@ -14,7 +15,7 @@ export const TUPLE_THEME_NAME = 'tuple-theme'; | |||
export const TUPLE_DARK_THEME_NAME = 'tuple-theme-dark'; | |||
|
|||
export default function registerTupleLanguage( | |||
monaco: any, | |||
monaco: typeof monacoEditor, |
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.
This type is cribbed from the typing of useMonaco
, so this now matches what the function actually receives.
|
||
comments: { | ||
lineComment: '//', | ||
blockComment: ['/*', '*/'], | ||
blockComment: ['/*', '*/'] satisfies [string, string], |
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.
These are typed as tuples, but typescript treats the literals as string[]
. Using satisfies
treats them as such without whacking the type.
// Based on: https://github.com/microsoft/monaco-languages/blob/main/src/typescript/typescript.ts | ||
const richEditConfiguration = { | ||
|
||
wordPattern: | ||
/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, | ||
/(-?\d*\.\d\w*)|([^`~!@#%^&*()\-=+[{\]}\\|;:'",.<>/?\s]+)/g, |
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.
All of these were marked as unnecessary escapes by eslint.
Description
Fixes a bunch of lint issues around the editors
Changes
~
instead of^
. The latter lets minor versions float, which we don't want with a zero-versioned library.Testing
Review. See that things are still green. See that the editor still works as expected.