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

fix: syntax errors in JS example sections (v5) #18442

Merged
merged 6 commits into from
Jul 18, 2022

Conversation

lionralfs
Copy link
Contributor

@lionralfs lionralfs commented Jul 17, 2022

Summary

Followup to PR #18186, #18191, #18307 and #18424


Skipped issues (POTENTIALLY OUTDATED, SEE #18186 (comment)):

This PR…
-->

  • Adds a new document
  • Rewrites (or significantly expands) a document
  • Fixes a typo, bug, or other error

@github-actions github-actions bot added the Content:WebAPI Web API docs label Jul 17, 2022
@github-actions

This comment was marked as resolved.

@Josh-Cena
Copy link
Member

  • with in strict mode

That's because you've set sourceType: "module" I believe. Most of the code examples we provide should be interpreted as scripts instead. I don't know if the parser allows "auto-detecting" with a TypeScript-like heuristic? (i.e. module if import/export exist; script otherwise)

@lionralfs
Copy link
Contributor Author

You're right. I needed sourceType: "module" for top-level await.
However, setting sourceType to "script" doesn't seem to do anything. I then stumbled upon this in eslint-plugin-markdown's docs:

The plugin:markdown/recommended config enables the impliedStrict parser option and disables the strict rule in Markdown files. This opts into strict mode parsing without repeated "use strict" directives.

Something to keep in mind when setting up ESLint for this repo.

@lionralfs lionralfs marked this pull request as ready for review July 17, 2022 12:07
@lionralfs lionralfs requested a review from a team as a code owner July 17, 2022 12:07
@lionralfs lionralfs requested review from wbamberg and removed request for a team July 17, 2022 12:07
Copy link
Contributor

@teoli2003 teoli2003 left a comment

Choose a reason for hiding this comment

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

👍

@teoli2003 teoli2003 merged commit d19d68b into mdn:main Jul 18, 2022
@lionralfs lionralfs deleted the fix-js-example-syntax-errors-5 branch July 18, 2022 17:38
dipikabh added a commit that referenced this pull request Jul 19, 2022
* Move new contrib docs

* underscores

* renaming

* removing redirect about

* creating moving

* experimental

* does belong

* editorial

* code style guide

* writing style guide

* howto and seo

* related_criteria for inclusion

* file rename, link update

* Updated Syntax for fetch-related pages (#17914)

* Updated Syntax

* port changes

Co-authored-by: Joshua Chen <[email protected]>

* Fix wrong example quote (#18458)

* Unshorten code in method definition (#18457)

* fixes #18444

* Update index.md

Co-authored-by: Joshua Chen <[email protected]>

* fix: correct the language of code examples (#18455)

* Add `const` var declaration to FileSystemFileHandle sample code  (#17930)

* Add `const` var declaration

* Update index.md

* Update index.md

Co-authored-by: Joshua Chen <[email protected]>

* Update dom-examples links (#18462)

* MediaRecorder: Update dom-examples links (#18464)

* Update dom-example link (#18465)

* update a broken link (#18466)

* remove a broken link (#18467)

* Update a broken link (#18468)

* Fixes broken live sample (#18456)

* Intl.NumberFormat - flyby fixes (#18258)

* Fix `channelCount` semantics in `MediaStreamAudioSourceNode`. (#18472)

* Fix `channelCount` semantics.

This sparked confusion, e.g. in WebAudio/web-audio-api#2496.

Source: I am this specification's editor.

* Fix markup.

* Fix parenthesis

* Fix `channelCount` semantics. (#18473)

* Fix `channelCount` semantics.

This sparked confusion, e.g. in WebAudio/web-audio-api#2496.

Source: I am this specification's editor.

* Fix markup.

* Fix parenthesis

* Remove a few pointless references to internal slots (#18461)

* Remove a few pointless references to internal slots

* Update index.md

* Apply suggestions from code review

Co-authored-by: Jean-Yves Perrier <[email protected]>

* simplify description

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Fix syntax errors (#18475)

* Fix syntax error

Reported in https://github.com/orgs/mdn/discussions/158 (PR11)
The macro just prints `Deprected` on the next line.

* Fix in blobbuilder

* Remove js annotation for webidl blocks

Co-authored-by: Jean-Yves Perrier <[email protected]>

* fix: syntax errors in JS example sections (v5) (#18442)

* syntax fixes

* fix remaining syntax errors

* Adapt syntax box

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Use diff instead of js to mark a diff block (#18477)

* Update good vs bad example

* fix a typo

* marking it as diff

* Bump @mdn/yari from 1.10.0 to 1.10.2 (#18479)

* Correct a few usage of internal methods (#18476)

* Change 'nodes' link to link directly to DOM nodes (#18480)

The link to DOM 'nodes' currently links to the 'nodes' glossary page. I changed the link to DOM 'nodes' to directly link to the DOM nodes page.

* Shorten Global object glossary entry (#18474)

* FF103 Native Error types are serializable (#18384)

* FF104 Native Error types are serializable

* Fix error - this is in FF103, not 104

* Update files/en-us/web/api/web_workers_api/structured_clone_algorithm/index.md

Co-authored-by: Joshua Chen <[email protected]>

* Remove stack info from release note

* Update files/en-us/mozilla/firefox/releases/103/index.md

Co-authored-by: Joshua Chen <[email protected]>

* Demix invalid event from GlobalEventHandlers (#18451)

* Demix slotchange from GlobalEventHandlers (#18225)

* fix: various typos (#18483)

* Fix typo (#18486)

Remove stray 'a' in "contain a separator characters like the following" -> "contain separator characters like the following"

* Fix link text (#18488)

* Add missing period (#18487)

* fix broken link (#18490)

* Remove continuity descriptions from `steps(...)` (#18482)

As per the spec (https://drafts.csswg.org/css-easing/#step-easing-functions), Figure 5, all step functions are right-continuous (i.e. You'd encounter solid dots approaching discontinuity from the right side). The `direction` keyword should strictly describe when the jumps (i.e. discontinuities) happen.

* OpenType guide: font-variant-position is not mutually exclusive with <sup>/<sub> (#18459)

Thank you!

* Fix links for other references (#18501)

* update a broken link (#18500)

* Comment out ellipsis in code blocks (#18496)

* Comment out ellipsis in code blocks (#18498)

* Comment out ellipsis in code blocks (#18497)

* Elaborate on destructuring assignment (#18495)

* Elaborate on destructuring assignment

* add headings

* Mark kumascript code blocks js -> plain (#18493)

* remove a broken link (#18499)

* remove a broken link

* Apply suggestions from code review

Co-authored-by: Jean-Yves Perrier <[email protected]>

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Demix pointer capture events from GlobalEventHandlers (#18450)

* Demix pointer capture events from GlobalEventHandlers

* Update files/en-us/web/api/element/lostpointercapture_event/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Add event properties section (still seems redundant...)

* Add additional event properties section

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Improvements to a few Number APIs (#18502)

* Minor spread syntax rewrite (#18503)

* Minor spread syntax rewrite

* Update files/en-us/web/javascript/reference/operators/spread_syntax/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Window.open() rework (#18118)

* first pass linting: remove xref macros, fix examples, fix code words

* 2nd pass: remove broken/insecure links, fix remaining typos

* Third pass - rework

* fix flaws

* Apply 1st set of suggestions

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Taking @teoli2003 review into account

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Fix broken block code in `Bracket notation` section (#18507)

Add three missing backticks at ending of block code

* Fix typo (#18508)

* Fix missing parenthesis (#18509)

* Mention string iteration goes by Unicode characters (#18504)

* Mention string iteration goes by Unicode characters

* add a flag example

* Fix "repository of wavetables" text's broken link (#18510)

* Add TBD content to files frontmatter and macros

* Add TBD content to more empty files

* TBD content

* Add missing front matter data to files

* Fix slug

* Fix slugs

* fix remaining writing guideline docs

Co-authored-by: Ruth John <[email protected]>
Co-authored-by: Prajwal Borkar <[email protected]>
Co-authored-by: Joshua Chen <[email protected]>
Co-authored-by: Davide Briano <[email protected]>
Co-authored-by: Xavi Lee <[email protected]>
Co-authored-by: A1lo <[email protected]>
Co-authored-by: Zhang Yi Jiang <[email protected]>
Co-authored-by: Onkar Ruikar <[email protected]>
Co-authored-by: Hamish Willee <[email protected]>
Co-authored-by: Paul Adenot <[email protected]>
Co-authored-by: Jean-Yves Perrier <[email protected]>
Co-authored-by: Lion Ralfs <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: simonvarey <[email protected]>
Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <[email protected]>
Co-authored-by: Nick Schonning <[email protected]>
Co-authored-by: kokke <[email protected]>
Co-authored-by: de-oz <[email protected]>
Co-authored-by: Christopher Dignam <[email protected]>
Co-authored-by: dshin-moz <[email protected]>
Co-authored-by: J. S. Choi <[email protected]>
Co-authored-by: Masahiro FUJIMOTO <[email protected]>
Co-authored-by: SphinxKnight <[email protected]>
Co-authored-by: Minh-Thuan Nguyen <[email protected]>
Co-authored-by: Remco van 't Veer <[email protected]>
Co-authored-by: Jeremy Pearson <[email protected]>
Co-authored-by: Schalk Neethling <[email protected]>
dipikabh added a commit that referenced this pull request Aug 3, 2022
* Move new contrib docs (#18041)

* Move new contrib docs

* underscores

* renaming

* removing redirect about

* creating moving

* experimental

* does belong

* editorial

* code style guide

* writing style guide

* howto and seo

* related_criteria for inclusion

* file rename, link update

* Updated Syntax for fetch-related pages (#17914)

* Updated Syntax

* port changes

Co-authored-by: Joshua Chen <[email protected]>

* Fix wrong example quote (#18458)

* Unshorten code in method definition (#18457)

* fixes #18444

* Update index.md

Co-authored-by: Joshua Chen <[email protected]>

* fix: correct the language of code examples (#18455)

* Add `const` var declaration to FileSystemFileHandle sample code  (#17930)

* Add `const` var declaration

* Update index.md

* Update index.md

Co-authored-by: Joshua Chen <[email protected]>

* Update dom-examples links (#18462)

* MediaRecorder: Update dom-examples links (#18464)

* Update dom-example link (#18465)

* update a broken link (#18466)

* remove a broken link (#18467)

* Update a broken link (#18468)

* Fixes broken live sample (#18456)

* Intl.NumberFormat - flyby fixes (#18258)

* Fix `channelCount` semantics in `MediaStreamAudioSourceNode`. (#18472)

* Fix `channelCount` semantics.

This sparked confusion, e.g. in WebAudio/web-audio-api#2496.

Source: I am this specification's editor.

* Fix markup.

* Fix parenthesis

* Fix `channelCount` semantics. (#18473)

* Fix `channelCount` semantics.

This sparked confusion, e.g. in WebAudio/web-audio-api#2496.

Source: I am this specification's editor.

* Fix markup.

* Fix parenthesis

* Remove a few pointless references to internal slots (#18461)

* Remove a few pointless references to internal slots

* Update index.md

* Apply suggestions from code review

Co-authored-by: Jean-Yves Perrier <[email protected]>

* simplify description

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Fix syntax errors (#18475)

* Fix syntax error

Reported in https://github.com/orgs/mdn/discussions/158 (PR11)
The macro just prints `Deprected` on the next line.

* Fix in blobbuilder

* Remove js annotation for webidl blocks

Co-authored-by: Jean-Yves Perrier <[email protected]>

* fix: syntax errors in JS example sections (v5) (#18442)

* syntax fixes

* fix remaining syntax errors

* Adapt syntax box

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Use diff instead of js to mark a diff block (#18477)

* Update good vs bad example

* fix a typo

* marking it as diff

* Bump @mdn/yari from 1.10.0 to 1.10.2 (#18479)

* Correct a few usage of internal methods (#18476)

* Change 'nodes' link to link directly to DOM nodes (#18480)

The link to DOM 'nodes' currently links to the 'nodes' glossary page. I changed the link to DOM 'nodes' to directly link to the DOM nodes page.

* Shorten Global object glossary entry (#18474)

* FF103 Native Error types are serializable (#18384)

* FF104 Native Error types are serializable

* Fix error - this is in FF103, not 104

* Update files/en-us/web/api/web_workers_api/structured_clone_algorithm/index.md

Co-authored-by: Joshua Chen <[email protected]>

* Remove stack info from release note

* Update files/en-us/mozilla/firefox/releases/103/index.md

Co-authored-by: Joshua Chen <[email protected]>

* Demix invalid event from GlobalEventHandlers (#18451)

* Demix slotchange from GlobalEventHandlers (#18225)

* fix: various typos (#18483)

* Fix typo (#18486)

Remove stray 'a' in "contain a separator characters like the following" -> "contain separator characters like the following"

* Fix link text (#18488)

* Add missing period (#18487)

* fix broken link (#18490)

* Remove continuity descriptions from `steps(...)` (#18482)

As per the spec (https://drafts.csswg.org/css-easing/#step-easing-functions), Figure 5, all step functions are right-continuous (i.e. You'd encounter solid dots approaching discontinuity from the right side). The `direction` keyword should strictly describe when the jumps (i.e. discontinuities) happen.

* OpenType guide: font-variant-position is not mutually exclusive with <sup>/<sub> (#18459)

Thank you!

* Fix links for other references (#18501)

* update a broken link (#18500)

* Comment out ellipsis in code blocks (#18496)

* Comment out ellipsis in code blocks (#18498)

* Comment out ellipsis in code blocks (#18497)

* Elaborate on destructuring assignment (#18495)

* Elaborate on destructuring assignment

* add headings

* Mark kumascript code blocks js -> plain (#18493)

* remove a broken link (#18499)

* remove a broken link

* Apply suggestions from code review

Co-authored-by: Jean-Yves Perrier <[email protected]>

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Demix pointer capture events from GlobalEventHandlers (#18450)

* Demix pointer capture events from GlobalEventHandlers

* Update files/en-us/web/api/element/lostpointercapture_event/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Add event properties section (still seems redundant...)

* Add additional event properties section

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Improvements to a few Number APIs (#18502)

* Minor spread syntax rewrite (#18503)

* Minor spread syntax rewrite

* Update files/en-us/web/javascript/reference/operators/spread_syntax/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Window.open() rework (#18118)

* first pass linting: remove xref macros, fix examples, fix code words

* 2nd pass: remove broken/insecure links, fix remaining typos

* Third pass - rework

* fix flaws

* Apply 1st set of suggestions

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Taking @teoli2003 review into account

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Fix broken block code in `Bracket notation` section (#18507)

Add three missing backticks at ending of block code

* Fix typo (#18508)

* Fix missing parenthesis (#18509)

* Mention string iteration goes by Unicode characters (#18504)

* Mention string iteration goes by Unicode characters

* add a flag example

* Fix "repository of wavetables" text's broken link (#18510)

* Add TBD content to files frontmatter and macros

* Add TBD content to more empty files

* TBD content

* Add missing front matter data to files

* Fix slug

* Fix slugs

* fix remaining writing guideline docs

Co-authored-by: Ruth John <[email protected]>
Co-authored-by: Prajwal Borkar <[email protected]>
Co-authored-by: Joshua Chen <[email protected]>
Co-authored-by: Davide Briano <[email protected]>
Co-authored-by: Xavi Lee <[email protected]>
Co-authored-by: A1lo <[email protected]>
Co-authored-by: Zhang Yi Jiang <[email protected]>
Co-authored-by: Onkar Ruikar <[email protected]>
Co-authored-by: Hamish Willee <[email protected]>
Co-authored-by: Paul Adenot <[email protected]>
Co-authored-by: Jean-Yves Perrier <[email protected]>
Co-authored-by: Lion Ralfs <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: simonvarey <[email protected]>
Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <[email protected]>
Co-authored-by: Nick Schonning <[email protected]>
Co-authored-by: kokke <[email protected]>
Co-authored-by: de-oz <[email protected]>
Co-authored-by: Christopher Dignam <[email protected]>
Co-authored-by: dshin-moz <[email protected]>
Co-authored-by: J. S. Choi <[email protected]>
Co-authored-by: Masahiro FUJIMOTO <[email protected]>
Co-authored-by: SphinxKnight <[email protected]>
Co-authored-by: Minh-Thuan Nguyen <[email protected]>
Co-authored-by: Remco van 't Veer <[email protected]>
Co-authored-by: Jeremy Pearson <[email protected]>
Co-authored-by: Schalk Neethling <[email protected]>

* Page structures (#18644)

Co-authored-by: Schalk Neethling <[email protected]>

* docs: community docs (#18787)

* docs: community docs

Adds community docs to the `mdn` folder

* Update files/en-us/mdn/community/contributing/getting-started/index.md

* updating folder names

Co-authored-by: Ruth John <[email protected]>
Co-authored-by: Ruth John <[email protected]>

* Contrib docs readthrough part 1 (#18994)

* test change

* Readthrough of contrib docs part1

* Move folders to howto and remove the duplicate inclusion_criteria (#19020)

* Readthrough of contrib docs part2 (#19036)

* chore: delete and redirect community docs (#19069)

Deletes older documents and adds redirects to the new community docs.

* adding sidebar for community docs (#19112)

* adding sidebar for community docs

* Update files/en-us/mdn/community/contributing/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/contributing/our_repositories/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/contributing/security_vulnerability_response/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/contributing/translated_content/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/discussions/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/issues/content_suggestions_feature_proposals/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/pull_requests/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/index.md

Co-authored-by: Gabe <[email protected]>

* Update files/en-us/mdn/writing_guidelines/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/users_teams/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/contributing/getting_started/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/issues/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/mdn_content/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/learn_forum/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/mdn_content/pull_requests/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/mdn_content/issues/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

* Update files/en-us/mdn/community/open_source_etiquette/index.md

Co-authored-by: Jean-Yves Perrier <[email protected]>

Co-authored-by: Jean-Yves Perrier <[email protected]>
Co-authored-by: Gabe <[email protected]>

* fix macros redirect

* fix macros redirect

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

* fix redirects

Co-authored-by: Dipika Bhattacharya <[email protected]>
Co-authored-by: Ruth John <[email protected]>
Co-authored-by: Prajwal Borkar <[email protected]>
Co-authored-by: Joshua Chen <[email protected]>
Co-authored-by: Davide Briano <[email protected]>
Co-authored-by: Xavi Lee <[email protected]>
Co-authored-by: A1lo <[email protected]>
Co-authored-by: Zhang Yi Jiang <[email protected]>
Co-authored-by: Onkar Ruikar <[email protected]>
Co-authored-by: Hamish Willee <[email protected]>
Co-authored-by: Paul Adenot <[email protected]>
Co-authored-by: Jean-Yves Perrier <[email protected]>
Co-authored-by: Lion Ralfs <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: simonvarey <[email protected]>
Co-authored-by: Queen Vinyl Da.i'gyu-Kazotetsu <[email protected]>
Co-authored-by: Nick Schonning <[email protected]>
Co-authored-by: kokke <[email protected]>
Co-authored-by: de-oz <[email protected]>
Co-authored-by: Christopher Dignam <[email protected]>
Co-authored-by: dshin-moz <[email protected]>
Co-authored-by: J. S. Choi <[email protected]>
Co-authored-by: Masahiro FUJIMOTO <[email protected]>
Co-authored-by: SphinxKnight <[email protected]>
Co-authored-by: Minh-Thuan Nguyen <[email protected]>
Co-authored-by: Remco van 't Veer <[email protected]>
Co-authored-by: Jeremy Pearson <[email protected]>
Co-authored-by: Ruth John <[email protected]>
Co-authored-by: Gabe <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants