-
Notifications
You must be signed in to change notification settings - Fork 405
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
docs: add JSDoc for some exports @W-13278716 #4014
Merged
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
8196282
chore: add temp file for tracking all exports
wjhsf f5ec19c
docs(shared): add jsdoc for language features
wjhsf 6b76c28
Merge branch 'master' into wjh/document-exports-0
wjhsf 3c28e31
chore: missed an export
wjhsf 3141cb1
docs(exports): add jsdoc for @lwc/shared language features
wjhsf 1d79d67
style: add eslint-plugin-jsdoc
wjhsf bf1213f
chore: eslint-plugin-jsdoc auto fixes
wjhsf 43605be
chore(linter): manual fixes for jsdoc rules
wjhsf d62f634
chore: simplify env config for test files
wjhsf d43a1a1
style(jsdoc): enforce documenting yields
wjhsf 8be08d4
docs: include @param in all jsdocs, but not descriptions (yet)
wjhsf 210f565
Merge branch 'wjh/eslint-plugin-jsdoc' into wjh/document-exports-0
wjhsf 8dca33d
docs(exports): fully document all @lwc/shared language features
wjhsf dc4220e
chore: remove temp file
wjhsf e4eff02
chore: lint JSDoc in @lwc/shared
wjhsf b835d63
chore(eslint): suppress unimportant warnings
wjhsf 269d4e7
docs(rollup-plugin): add jsdoc for main export
wjhsf f2778f9
fix: use JSDoc comment instead of plain multiline
wjhsf 4de1ed2
docs(babel-plugin-component): polish JSDoc for main plugin export
wjhsf 0ee1a95
chore: mark progress in .eslintrc
wjhsf 6cc5d68
docs(wire-service): polish JSDoc for `register`
wjhsf ee984f0
docs(errors): add JSDoc for @lwc/errors
wjhsf 677cd9c
docs(errors): polish JSDoc for @lwc/features
wjhsf 6023652
chore: mark @lwc/style-compiler as documented
wjhsf 1b334b7
docs(template-compiler): add bad JSDoc for top-level exports
wjhsf 84badcc
chore(jsdoc): comment block is not jsdoc
wjhsf 3b61a9b
chore: revert jsdoc changes to 3rd party files
wjhsf bcd8f21
chore(eslint): enforce stricter JSDoc rules
wjhsf e4abc8f
docs: improve JSDoc in root scripts
wjhsf eb014b6
chore(eslint): auto-fixes for new JSDoc rules
wjhsf 0f0de70
chore(eslint): manual for new JSDoc rules
wjhsf eabbfee
Merge branch 'wjh/eslint-plugin-jsdoc-tweaks' into wjh/document-expor…
wjhsf 3e48974
chore: fix bad merge
wjhsf 7c30350
docs: manual JSDoc tweaks post-merge
wjhsf 2e022d0
docs(style-compiler): add JSDoc for top-level exports
wjhsf 0a8c2bd
chore: mark style-compiler as complete
wjhsf 9c37470
docs(style-compiler): use correct name in README
wjhsf a9df37c
revert: remove useless empty JSDoc
wjhsf fc6404c
revert: don't JSDoc 3rd party
wjhsf e295ab4
Merge branch 'master' into wjh/document-exports-1
wjhsf 9431f24
docs(module-resolver): add JSDoc for main export
wjhsf a487ef0
Merge branch 'master' into wjh/document-exports-1
wjhsf a5dba28
revert: accidental JSDocification of __PURE__ annotations
wjhsf 62be5dc
Update packages/@lwc/errors/src/compiler/utils.ts
wjhsf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||
/* | ||||||
* Copyright (c) 2018, salesforce.com, inc. | ||||||
* Copyright (c) 2024, Salesforce, Inc. | ||||||
* All rights reserved. | ||||||
* SPDX-License-Identifier: MIT | ||||||
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT | ||||||
|
@@ -25,6 +25,12 @@ export interface ErrorConfig { | |||||
origin?: CompilerDiagnosticOrigin; | ||||||
} | ||||||
|
||||||
/** | ||||||
* Generates a friendly error message for the given error type, using the provided template values. | ||||||
* @param errorInfo The object holding the error metadata. | ||||||
* @param args Values used to fill the error message template. | ||||||
* @returns The generated error message. | ||||||
*/ | ||||||
export function generateErrorMessage(errorInfo: LWCErrorInfo, args?: any[]): string { | ||||||
const message = Array.isArray(args) | ||||||
? templateString(errorInfo.message, args) | ||||||
|
@@ -43,6 +49,7 @@ export function generateErrorMessage(errorInfo: LWCErrorInfo, args?: any[]): str | |||||
* info about the error's code and its origin (filename, line, column) when applicable. | ||||||
* @param errorInfo The object holding the error metadata. | ||||||
* @param config A config object providing any message arguments and origin info needed to create the error. | ||||||
* @returns The generated compiler diagnostic object. | ||||||
*/ | ||||||
export function generateCompilerDiagnostic( | ||||||
errorInfo: LWCErrorInfo, | ||||||
|
@@ -69,6 +76,7 @@ export function generateCompilerDiagnostic( | |||||
* the error's code and its origin (filename, line, column) when applicable. | ||||||
* @param errorInfo The object holding the error metadata. | ||||||
* @param config A config object providing any message arguments and origin info needed to create the error. | ||||||
* @returns The generated compiler error. | ||||||
*/ | ||||||
export function generateCompilerError( | ||||||
errorInfo: LWCErrorInfo, | ||||||
|
@@ -85,6 +93,13 @@ export function generateCompilerError( | |||||
return error; | ||||||
} | ||||||
|
||||||
/** | ||||||
* Validates that the provided condition is truthy. | ||||||
* @param condition Condition to check. | ||||||
* @param errorInfo The object holding the error metadata. | ||||||
* @param args Values used to fill the error message template. | ||||||
* @throws Throws a compiler error if the provided condition is falsy. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
*/ | ||||||
export function invariant(condition: boolean, errorInfo: LWCErrorInfo, args?: any[]) { | ||||||
if (!condition) { | ||||||
throw generateCompilerError(errorInfo, { | ||||||
|
@@ -95,9 +110,10 @@ export function invariant(condition: boolean, errorInfo: LWCErrorInfo, args?: an | |||||
|
||||||
/** | ||||||
* Normalizes a received error into a CompilerError. Adds any provided additional origin info. | ||||||
* @param errorInfo | ||||||
* @param error | ||||||
* @param origin | ||||||
* @param errorInfo The object holding the error metadata. | ||||||
* @param error The original error. | ||||||
* @param origin The origin associated with the error. | ||||||
* @returns The normalized compiler error. | ||||||
*/ | ||||||
export function normalizeToCompilerError( | ||||||
errorInfo: LWCErrorInfo, | ||||||
|
@@ -125,9 +141,10 @@ export function normalizeToCompilerError( | |||||
|
||||||
/** | ||||||
* Normalizes a received error into a CompilerDiagnostic. Adds any provided additional origin info. | ||||||
* @param errorInfo | ||||||
* @param error | ||||||
* @param origin | ||||||
* @param errorInfo The object holding the error metadata. | ||||||
* @param error The original error. | ||||||
* @param origin The origin of the error. | ||||||
* @returns The normalized compiler diagnostic object. | ||||||
*/ | ||||||
export function normalizeToDiagnostic( | ||||||
errorInfo: LWCErrorInfo, | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
* SPDX-License-Identifier: MIT | ||
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT | ||
*/ | ||
|
||
export function isObject(obj: any): obj is object { | ||
/** | ||
* Determines whether the given value is an object or null. | ||
* @param obj The value to check | ||
* @returns true if the value is an object or null | ||
* @example isObject(null) // true | ||
*/ | ||
export function isObject(obj: any): obj is object | null { | ||
return typeof obj === 'object'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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 function checks for truthiness, not for
=== true
, so I think "truthy"/"falsy" are more accurate 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.
That's fine, I just saw that the type was
boolean
so we would only get eithertrue
orfalse