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
small changes in DocType of languages and formatting #4042
base: main
Are you sure you want to change the base?
Conversation
src/highlight.js
Outdated
@@ -25,7 +25,7 @@ import HTMLInjectionError from "./lib/html_injection_error.js"; | |||
@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin | |||
@typedef {import('highlight.js').PluginEvent} PluginEvent | |||
@typedef {import('highlight.js').HLJSOptions} HLJSOptions | |||
@typedef {import('highlight.js').LanguageFn} LanguageFn | |||
@typedef {import('highlight.js').LanguageFn} {import("highlight.js").LanguageFn} |
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.
What makes LanguageFn different from all the other types listed here?
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.
LanguageFn is type of this function that takes HLJSApi type parameter and returns Language type output
But in DocCommets it wasn't used correctly
/** @type LanguageFn */
It doesn't assign the LanguageFn type to it
So, it should be changed to
/**
* @type {import("highlight.js").LanguageFn}
*/
It will import all types from highlight.js and then we select LanguageFn type from it and assign it to function to assign type in DocComments, type must be put between {} after @type
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.
What makes LanguageFn different from all the other types listed here?
It was his type
I didn't do anything more, I just correctly type assignment
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.
The whole point of @typedef {import('highlight.js').LanguageFn} LanguageFn
should be to allow us to use the short names later on in the file - otherwise what's the point in typedef?
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.
Understood
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.
The whole point of
@typedef {import('highlight.js').LanguageFn} LanguageFn
should be to allow us to use the short names later on in the file - otherwise what's the point in typedef?
I have updated everything as you asked
@@ -6,8 +6,8 @@ Category: syntax | |||
Audit: 2020 | |||
*/ | |||
|
|||
/** @type LanguageFn */ | |||
export default function(hljs) { | |||
/** @type {LanguageFn} */ |
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'll need to glance at the docs, but this looks much more acceptable. But please remove all your other linting changes.
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'll need to glance at the docs, but this looks much more acceptable. But please remove all your other linting changes.
Ok
Changes
Checklist
CHANGES.md