From bb2792452169b8c3f6498738c6fac961d8a071d1 Mon Sep 17 00:00:00 2001 From: Brian Thomas Smith Date: Tue, 31 Oct 2023 11:12:48 +0100 Subject: [PATCH 1/2] chore(formatting): Apply default printWidth for JS / CSS --- .prettierrc.json | 9 ++++++++- .../css-examples/color/color-adjust.css | 5 ++++- .../css-examples/fonts/font-synthesis.css | 3 ++- .../fonts/font-variant-east-asian.css | 3 ++- .../css-examples/fragmentation/break.js | 4 +++- .../motion-path/offset-anchor.css | 9 ++++++++- .../css-examples/rhythm/line-height-step.css | 8 +++++++- .../shapes/shape-image-threshold.css | 7 ++++++- .../content-sectioning/css/article.css | 3 ++- .../html-examples/forms/css/button.css | 7 ++++++- .../global-attributes/js/attribute-is.js | 4 +++- .../html-examples/input/css/button.css | 7 ++++++- live-examples/js-examples/array/array-at.js | 8 ++++---- .../js-examples/array/array-filter.js | 2 +- .../js-examples/array/array-reduce-right.js | 4 +++- .../js-examples/array/array-reduce.js | 5 ++++- .../js-examples/bigint/bigint-asintn.js | 4 +++- .../bigint/bigint-tolocalestring.js | 4 +++- .../js-examples/classes/classes-extends.js | 15 +++++++++++++- .../date/date-tolocaledatestring.js | 7 ++++++- .../finalizationregistry.js | 2 +- .../js-examples/intl/intl-collator.js | 6 +++++- .../intl-datetimeformat-prototype-format.js | 7 ++++++- ...tl-datetimeformat-prototype-formatrange.js | 7 ++++++- ...-datetimeformat-prototype-formattoparts.js | 7 ++++++- .../js-examples/intl/intl-datetimeformat.js | 6 +++++- .../js-examples/intl/intl-displaynames.js | 4 +++- ...intl-listformat-prototype-formattoparts.js | 10 ++++++++-- .../js-examples/intl/intl-listformat.js | 10 ++++++++-- .../intl/intl-locale-prototype-tostring.js | 10 ++++++++-- .../js-examples/intl/intl-numberformat.js | 18 ++++++++++++++--- .../intl/intl-segmenter-prototype-segment.js | 4 +++- .../js-examples/json/json-stringify.js | 4 +++- live-examples/js-examples/map/map-groupby.js | 4 +++- .../js-examples/promise/promise-allsettled.js | 8 ++++++-- .../js-examples/reflect/reflect-apply.js | 8 ++++++-- .../statement/statement-async-for-in.js | 3 ++- live-examples/js-examples/string/string-at.js | 8 ++++---- .../js-examples/string/string-charcodeat.js | 8 ++++++-- .../js-examples/string/string-includes.js | 6 +++++- .../js-examples/string/string-indexof.js | 14 ++++++++++--- .../js-examples/string/string-lastindexof.js | 9 +++++++-- .../js-examples/string/string-replace.js | 3 ++- .../js-examples/string/string-replaceall.js | 3 ++- .../js-examples/string/string-search.js | 3 ++- .../js-examples/symbol/symbol-split.js | 4 +++- .../js-examples/typedarray/typedarray-at.js | 8 ++++---- .../typedarray/typedarray-reduceright.js | 4 +++- .../typedarray/typedarray-tolocalestring.js | 4 +++- live-examples/js-examples/weakref/weakref.js | 2 +- live-examples/wat-examples/numeric/and.js | 14 +++++++------ live-examples/wat-examples/numeric/clz.js | 14 ++++++++----- live-examples/wat-examples/numeric/ctz.js | 14 ++++++++----- live-examples/wat-examples/numeric/or.js | 14 +++++++------ live-examples/wat-examples/numeric/popcnt.js | 12 ++++++----- live-examples/wat-examples/numeric/rotl.js | 14 +++++++------ live-examples/wat-examples/numeric/rotr.js | 14 +++++++------ live-examples/wat-examples/numeric/shl.js | 14 +++++++------ live-examples/wat-examples/numeric/shr.js | 14 +++++++------ live-examples/wat-examples/numeric/xor.js | 14 +++++++------ .../wat-examples/statements/block.js | 20 ++++++++++--------- .../url/url-prototype-password.js | 2 +- .../url/url-prototype-search.js | 2 +- .../url/url-prototype-searchparams.js | 2 +- .../url/url-prototype-username.js | 2 +- 65 files changed, 338 insertions(+), 140 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index d7decec52..bb3077559 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,5 +1,12 @@ { "bracketSameLine": true, "singleQuote": true, - "printWidth": 120 + "overrides": [ + { + "files": ["**/*.md", "**/*.html"], + "options": { + "printWidth": 120 + } + } + ] } diff --git a/live-examples/css-examples/color/color-adjust.css b/live-examples/css-examples/color/color-adjust.css index d52dcf367..f62cd6b28 100644 --- a/live-examples/css-examples/color/color-adjust.css +++ b/live-examples/css-examples/color/color-adjust.css @@ -2,7 +2,10 @@ padding: 1rem; font-size: 1.5rem; background-color: black; - background-image: linear-gradient(rgba(0, 0, 180, 0.5), rgba(70, 140, 220, 0.5)); + background-image: linear-gradient( + rgba(0, 0, 180, 0.5), + rgba(70, 140, 220, 0.5) + ); color: #333; text-align: center; display: flex; diff --git a/live-examples/css-examples/fonts/font-synthesis.css b/live-examples/css-examples/fonts/font-synthesis.css index 57e500655..77e390092 100644 --- a/live-examples/css-examples/fonts/font-synthesis.css +++ b/live-examples/css-examples/fonts/font-synthesis.css @@ -2,7 +2,8 @@ font-family: Oxygen; font-style: normal; font-weight: 400; - src: url('https://fonts.gstatic.com/s/oxygen/v14/2sDfZG1Wl4LcnbuKjk0m.woff2') format('woff2'); + src: url('https://fonts.gstatic.com/s/oxygen/v14/2sDfZG1Wl4LcnbuKjk0m.woff2') + format('woff2'); } /* [108] */ diff --git a/live-examples/css-examples/fonts/font-variant-east-asian.css b/live-examples/css-examples/fonts/font-variant-east-asian.css index 10d862f83..91d205404 100644 --- a/live-examples/css-examples/fonts/font-variant-east-asian.css +++ b/live-examples/css-examples/fonts/font-variant-east-asian.css @@ -1,5 +1,6 @@ #output section { - font-family: 'YuGothic Medium', YuGothic, 'Yu Gothic Medium', 'Yu Gothic', sans-serif; + font-family: 'YuGothic Medium', YuGothic, 'Yu Gothic Medium', 'Yu Gothic', + sans-serif; margin-top: 10px; font-size: 1.5em; } diff --git a/live-examples/css-examples/fragmentation/break.js b/live-examples/css-examples/fragmentation/break.js index ea5b0becc..ce5dafcc5 100644 --- a/live-examples/css-examples/fragmentation/break.js +++ b/live-examples/css-examples/fragmentation/break.js @@ -1,5 +1,7 @@ const btn = document.getElementById('print-btn'); -const editorContainer = document.getElementsByClassName('css-editor-container')[0]; +const editorContainer = document.getElementsByClassName( + 'css-editor-container', +)[0]; const exampleHTMLElement = document.getElementById('default-example'); const printableSection = document.createElement('div'); diff --git a/live-examples/css-examples/motion-path/offset-anchor.css b/live-examples/css-examples/motion-path/offset-anchor.css index 2b7f913e7..815cc5831 100644 --- a/live-examples/css-examples/motion-path/offset-anchor.css +++ b/live-examples/css-examples/motion-path/offset-anchor.css @@ -12,7 +12,14 @@ } .wrapper { - background-image: linear-gradient(to bottom, transparent, transparent 49%, #000 50%, #000 51%, transparent 52%); + background-image: linear-gradient( + to bottom, + transparent, + transparent 49%, + #000 50%, + #000 51%, + transparent 52% + ); border: 1px solid #ccc; width: 90%; } diff --git a/live-examples/css-examples/rhythm/line-height-step.css b/live-examples/css-examples/rhythm/line-height-step.css index 2b17a6f33..b014786c1 100644 --- a/live-examples/css-examples/rhythm/line-height-step.css +++ b/live-examples/css-examples/rhythm/line-height-step.css @@ -1,5 +1,11 @@ .example-container { - background-image: repeating-linear-gradient(180deg, #ccc, #ccc 20px, #dbdbdb 20px, #dbdbdb 40px); + background-image: repeating-linear-gradient( + 180deg, + #ccc, + #ccc 20px, + #dbdbdb 20px, + #dbdbdb 40px + ); border: 0.75em solid; padding: 0.75em; text-align: left; diff --git a/live-examples/css-examples/shapes/shape-image-threshold.css b/live-examples/css-examples/shapes/shape-image-threshold.css index 004d356aa..9e5365020 100644 --- a/live-examples/css-examples/shapes/shape-image-threshold.css +++ b/live-examples/css-examples/shapes/shape-image-threshold.css @@ -9,5 +9,10 @@ height: 150px; margin: 20px; width: 150px; - background-image: linear-gradient(50deg, rgb(77, 26, 103), transparent 80%, transparent); + background-image: linear-gradient( + 50deg, + rgb(77, 26, 103), + transparent 80%, + transparent + ); } diff --git a/live-examples/html-examples/content-sectioning/css/article.css b/live-examples/html-examples/content-sectioning/css/article.css index a06d4cdf8..42c93b4c2 100644 --- a/live-examples/html-examples/content-sectioning/css/article.css +++ b/live-examples/html-examples/content-sectioning/css/article.css @@ -12,7 +12,8 @@ } .day-forecast { - background: right/contain content-box border-box no-repeat url('/media/examples/rain.svg') white; + background: right/contain content-box border-box no-repeat + url('/media/examples/rain.svg') white; } .day-forecast > h2, diff --git a/live-examples/html-examples/forms/css/button.css b/live-examples/html-examples/forms/css/button.css index 431f5a84f..b415e50a6 100644 --- a/live-examples/html-examples/forms/css/button.css +++ b/live-examples/html-examples/forms/css/button.css @@ -8,7 +8,12 @@ text-shadow: 1px 1px 1px #000; border-radius: 10px; background-color: rgba(220, 0, 0, 1); - background-image: linear-gradient(to top left, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2) 30%, rgba(0, 0, 0, 0)); + background-image: linear-gradient( + to top left, + rgba(0, 0, 0, 0.2), + rgba(0, 0, 0, 0.2) 30%, + rgba(0, 0, 0, 0) + ); box-shadow: inset 2px 2px 3px rgba(255, 255, 255, 0.6), inset -2px -2px 3px rgba(0, 0, 0, 0.6); diff --git a/live-examples/html-examples/global-attributes/js/attribute-is.js b/live-examples/html-examples/global-attributes/js/attribute-is.js index 410ea0965..c2572015b 100644 --- a/live-examples/html-examples/global-attributes/js/attribute-is.js +++ b/live-examples/html-examples/global-attributes/js/attribute-is.js @@ -15,4 +15,6 @@ class LengthLeftTextarea extends HTMLTextAreaElement { } } -customElements.define('length-left-textarea', LengthLeftTextarea, { extends: 'textarea' }); +customElements.define('length-left-textarea', LengthLeftTextarea, { + extends: 'textarea', +}); diff --git a/live-examples/html-examples/input/css/button.css b/live-examples/html-examples/input/css/button.css index 431f5a84f..b415e50a6 100644 --- a/live-examples/html-examples/input/css/button.css +++ b/live-examples/html-examples/input/css/button.css @@ -8,7 +8,12 @@ text-shadow: 1px 1px 1px #000; border-radius: 10px; background-color: rgba(220, 0, 0, 1); - background-image: linear-gradient(to top left, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2) 30%, rgba(0, 0, 0, 0)); + background-image: linear-gradient( + to top left, + rgba(0, 0, 0, 0.2), + rgba(0, 0, 0, 0.2) 30%, + rgba(0, 0, 0, 0) + ); box-shadow: inset 2px 2px 3px rgba(255, 255, 255, 0.6), inset -2px -2px 3px rgba(0, 0, 0, 0.6); diff --git a/live-examples/js-examples/array/array-at.js b/live-examples/js-examples/array/array-at.js index e823011a5..c6a529d76 100644 --- a/live-examples/js-examples/array/array-at.js +++ b/live-examples/js-examples/array/array-at.js @@ -2,10 +2,10 @@ const array1 = [5, 12, 8, 130, 44]; let index = 2; -console.log(`Using an index of ${index} the item returned is ${array1.at(index)}`); -// Expected output: "Using an index of 2 the item returned is 8" +console.log(`An index of ${index} returns ${array1.at(index)}`); +// Expected output: "An index of 2 returns 8" index = -2; -console.log(`Using an index of ${index} item returned is ${array1.at(index)}`); -// Expected output: "Using an index of -2 item returned is 130" +console.log(`An index of ${index} returns ${array1.at(index)}`); +// Expected output: "An index of -2 returns 130" diff --git a/live-examples/js-examples/array/array-filter.js b/live-examples/js-examples/array/array-filter.js index f5b65d80a..45c9504b9 100644 --- a/live-examples/js-examples/array/array-filter.js +++ b/live-examples/js-examples/array/array-filter.js @@ -1,4 +1,4 @@ -const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present']; +const words = ['spray', 'elite', 'exuberant', 'destruction', 'present']; const result = words.filter((word) => word.length > 6); diff --git a/live-examples/js-examples/array/array-reduce-right.js b/live-examples/js-examples/array/array-reduce-right.js index ac0ef935c..257c64dcd 100644 --- a/live-examples/js-examples/array/array-reduce-right.js +++ b/live-examples/js-examples/array/array-reduce-right.js @@ -4,7 +4,9 @@ const array1 = [ [4, 5], ]; -const result = array1.reduceRight((accumulator, currentValue) => accumulator.concat(currentValue)); +const result = array1.reduceRight((accumulator, currentValue) => + accumulator.concat(currentValue), +); console.log(result); // Expected output: Array [4, 5, 2, 3, 0, 1] diff --git a/live-examples/js-examples/array/array-reduce.js b/live-examples/js-examples/array/array-reduce.js index 963a55924..8fcdc67c9 100644 --- a/live-examples/js-examples/array/array-reduce.js +++ b/live-examples/js-examples/array/array-reduce.js @@ -2,7 +2,10 @@ const array1 = [1, 2, 3, 4]; // 0 + 1 + 2 + 3 + 4 const initialValue = 0; -const sumWithInitial = array1.reduce((accumulator, currentValue) => accumulator + currentValue, initialValue); +const sumWithInitial = array1.reduce( + (accumulator, currentValue) => accumulator + currentValue, + initialValue, +); console.log(sumWithInitial); // Expected output: 10 diff --git a/live-examples/js-examples/bigint/bigint-asintn.js b/live-examples/js-examples/bigint/bigint-asintn.js index b21ccd64e..34e99aaf0 100644 --- a/live-examples/js-examples/bigint/bigint-asintn.js +++ b/live-examples/js-examples/bigint/bigint-asintn.js @@ -1,7 +1,9 @@ const max = 2n ** (64n - 1n) - 1n; function check64bit(number) { - number > max ? console.log("Number doesn't fit in signed 64-bit integer!") : console.log(BigInt.asIntN(64, number)); + number > max + ? console.log("Number doesn't fit in signed 64-bit integer!") + : console.log(BigInt.asIntN(64, number)); } check64bit(2n ** 64n); diff --git a/live-examples/js-examples/bigint/bigint-tolocalestring.js b/live-examples/js-examples/bigint/bigint-tolocalestring.js index 88a26c571..bc906d378 100644 --- a/live-examples/js-examples/bigint/bigint-tolocalestring.js +++ b/live-examples/js-examples/bigint/bigint-tolocalestring.js @@ -5,5 +5,7 @@ console.log(bigint.toLocaleString('de-DE')); // Expected output: "123.456.789.123.456.789" // Request a currency format -console.log(bigint.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' })); +console.log( + bigint.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }), +); // Expected output: "123.456.789.123.456.789,00 €" diff --git a/live-examples/js-examples/classes/classes-extends.js b/live-examples/js-examples/classes/classes-extends.js index 2ea19ac00..3a2e96f14 100644 --- a/live-examples/js-examples/classes/classes-extends.js +++ b/live-examples/js-examples/classes/classes-extends.js @@ -1,6 +1,19 @@ class DateFormatter extends Date { getFormattedDate() { - const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; + const months = [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', + ]; return `${this.getDate()}-${months[this.getMonth()]}-${this.getFullYear()}`; } } diff --git a/live-examples/js-examples/date/date-tolocaledatestring.js b/live-examples/js-examples/date/date-tolocaledatestring.js index b9c17a7a2..53dc2353f 100644 --- a/live-examples/js-examples/date/date-tolocaledatestring.js +++ b/live-examples/js-examples/date/date-tolocaledatestring.js @@ -1,5 +1,10 @@ const event = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); -const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; +const options = { + weekday: 'long', + year: 'numeric', + month: 'long', + day: 'numeric', +}; console.log(event.toLocaleDateString('de-DE', options)); // Expected output (varies according to local timezone): Donnerstag, 20. Dezember 2012 diff --git a/live-examples/js-examples/finalizationregistry/finalizationregistry.js b/live-examples/js-examples/finalizationregistry/finalizationregistry.js index fa7c93baf..bf76f06e0 100644 --- a/live-examples/js-examples/finalizationregistry/finalizationregistry.js +++ b/live-examples/js-examples/finalizationregistry/finalizationregistry.js @@ -9,7 +9,7 @@ const array1 = ['foo']; registry.register(array1, 'foo'); // array1 is not referenced in any callback, so it can be garbage collected -console.log('Triggering garbage collection, which you should never do in production code'); +console.log("Triggering garbage collection, don't do this in production code!"); (function allocateMemory() { Array.from({ length: 50000 }, () => () => {}); diff --git a/live-examples/js-examples/intl/intl-collator.js b/live-examples/js-examples/intl/intl-collator.js index 9039a0527..bedaf9ff7 100644 --- a/live-examples/js-examples/intl/intl-collator.js +++ b/live-examples/js-examples/intl/intl-collator.js @@ -4,5 +4,9 @@ console.log(['Z', 'a', 'z', 'ä'].sort(new Intl.Collator('de').compare)); console.log(['Z', 'a', 'z', 'ä'].sort(new Intl.Collator('sv').compare)); // Expected output: Array ["a", "z", "Z", "ä"] -console.log(['Z', 'a', 'z', 'ä'].sort(new Intl.Collator('de', { caseFirst: 'upper' }).compare)); +console.log( + ['Z', 'a', 'z', 'ä'].sort( + new Intl.Collator('de', { caseFirst: 'upper' }).compare, + ), +); // Expected output: Array ["a", "ä", "Z", "z"] diff --git a/live-examples/js-examples/intl/intl-datetimeformat-prototype-format.js b/live-examples/js-examples/intl/intl-datetimeformat-prototype-format.js index 422c1ab4f..e6b2afd4e 100644 --- a/live-examples/js-examples/intl/intl-datetimeformat-prototype-format.js +++ b/live-examples/js-examples/intl/intl-datetimeformat-prototype-format.js @@ -1,4 +1,9 @@ -const options1 = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; +const options1 = { + weekday: 'long', + year: 'numeric', + month: 'long', + day: 'numeric', +}; const date1 = new Date(2012, 5); const dateTimeFormat1 = new Intl.DateTimeFormat('sr-RS', options1); diff --git a/live-examples/js-examples/intl/intl-datetimeformat-prototype-formatrange.js b/live-examples/js-examples/intl/intl-datetimeformat-prototype-formatrange.js index 45837b458..0ee2ec95d 100644 --- a/live-examples/js-examples/intl/intl-datetimeformat-prototype-formatrange.js +++ b/live-examples/js-examples/intl/intl-datetimeformat-prototype-formatrange.js @@ -1,4 +1,9 @@ -const options1 = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; +const options1 = { + weekday: 'long', + year: 'numeric', + month: 'long', + day: 'numeric', +}; const options2 = { year: '2-digit', month: 'numeric', day: 'numeric' }; const startDate = new Date(Date.UTC(2007, 0, 10, 10, 0, 0)); diff --git a/live-examples/js-examples/intl/intl-datetimeformat-prototype-formattoparts.js b/live-examples/js-examples/intl/intl-datetimeformat-prototype-formattoparts.js index 2d01d5230..20f9c3930 100644 --- a/live-examples/js-examples/intl/intl-datetimeformat-prototype-formattoparts.js +++ b/live-examples/js-examples/intl/intl-datetimeformat-prototype-formattoparts.js @@ -1,5 +1,10 @@ const date = new Date(2012, 5); -const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; +const options = { + weekday: 'long', + year: 'numeric', + month: 'long', + day: 'numeric', +}; const dateTimeFormat = new Intl.DateTimeFormat('en-US', options); const parts = dateTimeFormat.formatToParts(date); diff --git a/live-examples/js-examples/intl/intl-datetimeformat.js b/live-examples/js-examples/intl/intl-datetimeformat.js index 7de35ec63..0cf7766a0 100644 --- a/live-examples/js-examples/intl/intl-datetimeformat.js +++ b/live-examples/js-examples/intl/intl-datetimeformat.js @@ -11,6 +11,10 @@ console.log(new Intl.DateTimeFormat(['ban', 'id']).format(date)); // Specify date and time format using "style" options (i.e. full, long, medium, short) console.log( - new Intl.DateTimeFormat('en-GB', { dateStyle: 'full', timeStyle: 'long', timeZone: 'Australia/Sydney' }).format(date), + new Intl.DateTimeFormat('en-GB', { + dateStyle: 'full', + timeStyle: 'long', + timeZone: 'Australia/Sydney', + }).format(date), ); // Expected output: "Sunday, 20 December 2020 at 14:23:16 GMT+11" diff --git a/live-examples/js-examples/intl/intl-displaynames.js b/live-examples/js-examples/intl/intl-displaynames.js index 195e16e25..1f2744728 100644 --- a/live-examples/js-examples/intl/intl-displaynames.js +++ b/live-examples/js-examples/intl/intl-displaynames.js @@ -1,5 +1,7 @@ const regionNamesInEnglish = new Intl.DisplayNames(['en'], { type: 'region' }); -const regionNamesInTraditionalChinese = new Intl.DisplayNames(['zh-Hant'], { type: 'region' }); +const regionNamesInTraditionalChinese = new Intl.DisplayNames(['zh-Hant'], { + type: 'region', +}); console.log(regionNamesInEnglish.of('US')); // Expected output: "United States" diff --git a/live-examples/js-examples/intl/intl-listformat-prototype-formattoparts.js b/live-examples/js-examples/intl/intl-listformat-prototype-formattoparts.js index 9a73ed290..bd147cac5 100644 --- a/live-examples/js-examples/intl/intl-listformat-prototype-formattoparts.js +++ b/live-examples/js-examples/intl/intl-listformat-prototype-formattoparts.js @@ -1,6 +1,12 @@ const vehicles = ['Motorcycle', 'Bus', 'Car']; -const formatterEn = new Intl.ListFormat('en', { style: 'long', type: 'conjunction' }); -const formatterFr = new Intl.ListFormat('fr', { style: 'long', type: 'conjunction' }); +const formatterEn = new Intl.ListFormat('en', { + style: 'long', + type: 'conjunction', +}); +const formatterFr = new Intl.ListFormat('fr', { + style: 'long', + type: 'conjunction', +}); const partValuesEn = formatterEn.formatToParts(vehicles).map((p) => p.value); const partValuesFr = formatterFr.formatToParts(vehicles).map((p) => p.value); diff --git a/live-examples/js-examples/intl/intl-listformat.js b/live-examples/js-examples/intl/intl-listformat.js index 485124515..cc9d84bf6 100644 --- a/live-examples/js-examples/intl/intl-listformat.js +++ b/live-examples/js-examples/intl/intl-listformat.js @@ -1,10 +1,16 @@ const vehicles = ['Motorcycle', 'Bus', 'Car']; -const formatter = new Intl.ListFormat('en', { style: 'long', type: 'conjunction' }); +const formatter = new Intl.ListFormat('en', { + style: 'long', + type: 'conjunction', +}); console.log(formatter.format(vehicles)); // Expected output: "Motorcycle, Bus, and Car" -const formatter2 = new Intl.ListFormat('de', { style: 'short', type: 'disjunction' }); +const formatter2 = new Intl.ListFormat('de', { + style: 'short', + type: 'disjunction', +}); console.log(formatter2.format(vehicles)); // Expected output: "Motorcycle, Bus oder Car" diff --git a/live-examples/js-examples/intl/intl-locale-prototype-tostring.js b/live-examples/js-examples/intl/intl-locale-prototype-tostring.js index 1e21f5490..2e3b35934 100644 --- a/live-examples/js-examples/intl/intl-locale-prototype-tostring.js +++ b/live-examples/js-examples/intl/intl-locale-prototype-tostring.js @@ -1,5 +1,11 @@ -const french = new Intl.Locale('fr-Latn-FR', { calendar: 'gregory', hourCycle: 'h12' }); -const korean = new Intl.Locale('ko-Kore-KR', { numeric: true, caseFirst: 'upper' }); +const french = new Intl.Locale('fr-Latn-FR', { + calendar: 'gregory', + hourCycle: 'h12', +}); +const korean = new Intl.Locale('ko-Kore-KR', { + numeric: true, + caseFirst: 'upper', +}); console.log(french.toString()); // Expected output: "fr-Latn-FR-u-ca-gregory-hc-h12" diff --git a/live-examples/js-examples/intl/intl-numberformat.js b/live-examples/js-examples/intl/intl-numberformat.js index d6540d9ab..e5252a0ea 100644 --- a/live-examples/js-examples/intl/intl-numberformat.js +++ b/live-examples/js-examples/intl/intl-numberformat.js @@ -1,12 +1,24 @@ const number = 123456.789; -console.log(new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(number)); +console.log( + new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format( + number, + ), +); // Expected output: "123.456,79 €" // The Japanese yen doesn't use a minor unit -console.log(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format(number)); +console.log( + new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format( + number, + ), +); // Expected output: "¥123,457" // Limit to three significant digits -console.log(new Intl.NumberFormat('en-IN', { maximumSignificantDigits: 3 }).format(number)); +console.log( + new Intl.NumberFormat('en-IN', { maximumSignificantDigits: 3 }).format( + number, + ), +); // Expected output: "1,23,000" diff --git a/live-examples/js-examples/intl/intl-segmenter-prototype-segment.js b/live-examples/js-examples/intl/intl-segmenter-prototype-segment.js index 398575b33..ff9957f04 100644 --- a/live-examples/js-examples/intl/intl-segmenter-prototype-segment.js +++ b/live-examples/js-examples/intl/intl-segmenter-prototype-segment.js @@ -1,6 +1,8 @@ const string1 = 'Que ma joie demeure'; -const segmenterFrGrapheme = new Intl.Segmenter('fr', { granularity: 'grapheme' }); +const segmenterFrGrapheme = new Intl.Segmenter('fr', { + granularity: 'grapheme', +}); const graphemeSegments = segmenterFrGrapheme.segment(string1); console.log(Array.from(graphemeSegments)[0]); diff --git a/live-examples/js-examples/json/json-stringify.js b/live-examples/js-examples/json/json-stringify.js index 61224bc10..e64f24b2c 100644 --- a/live-examples/js-examples/json/json-stringify.js +++ b/live-examples/js-examples/json/json-stringify.js @@ -1,7 +1,9 @@ console.log(JSON.stringify({ x: 5, y: 6 })); // Expected output: '{"x":5,"y":6}' -console.log(JSON.stringify([new Number(3), new String('false'), new Boolean(false)])); +console.log( + JSON.stringify([new Number(3), new String('false'), new Boolean(false)]), +); // Expected output: '[3,"false",false]' console.log(JSON.stringify({ x: [10, undefined, function () {}, Symbol('')] })); diff --git a/live-examples/js-examples/map/map-groupby.js b/live-examples/js-examples/map/map-groupby.js index c4711938e..0af37d32a 100644 --- a/live-examples/js-examples/map/map-groupby.js +++ b/live-examples/js-examples/map/map-groupby.js @@ -8,6 +8,8 @@ const inventory = [ const restock = { restock: true }; const sufficient = { restock: false }; -const result = Map.groupBy(inventory, ({ quantity }) => (quantity < 6 ? restock : sufficient)); +const result = Map.groupBy(inventory, ({ quantity }) => + quantity < 6 ? restock : sufficient, +); console.log(result.get(restock)); // [{ name: "bananas", type: "fruit", quantity: 5 }] diff --git a/live-examples/js-examples/promise/promise-allsettled.js b/live-examples/js-examples/promise/promise-allsettled.js index a5227a72b..0c622aa40 100644 --- a/live-examples/js-examples/promise/promise-allsettled.js +++ b/live-examples/js-examples/promise/promise-allsettled.js @@ -1,8 +1,12 @@ const promise1 = Promise.resolve(3); -const promise2 = new Promise((resolve, reject) => setTimeout(reject, 100, 'foo')); +const promise2 = new Promise((resolve, reject) => + setTimeout(reject, 100, 'foo'), +); const promises = [promise1, promise2]; -Promise.allSettled(promises).then((results) => results.forEach((result) => console.log(result.status))); +Promise.allSettled(promises).then((results) => + results.forEach((result) => console.log(result.status)), +); // Expected output: // "fulfilled" diff --git a/live-examples/js-examples/reflect/reflect-apply.js b/live-examples/js-examples/reflect/reflect-apply.js index 1051475c7..3e2fdbe96 100644 --- a/live-examples/js-examples/reflect/reflect-apply.js +++ b/live-examples/js-examples/reflect/reflect-apply.js @@ -1,10 +1,14 @@ console.log(Reflect.apply(Math.floor, undefined, [1.75])); // Expected output: 1 -console.log(Reflect.apply(String.fromCharCode, undefined, [104, 101, 108, 108, 111])); +console.log( + Reflect.apply(String.fromCharCode, undefined, [104, 101, 108, 108, 111]), +); // Expected output: "hello" -console.log(Reflect.apply(RegExp.prototype.exec, /ab/, ['confabulation']).index); +console.log( + Reflect.apply(RegExp.prototype.exec, /ab/, ['confabulation']).index, +); // Expected output: 4 console.log(Reflect.apply(''.charAt, 'ponies', [3])); diff --git a/live-examples/js-examples/statement/statement-async-for-in.js b/live-examples/js-examples/statement/statement-async-for-in.js index 0befe5982..da6ac6969 100644 --- a/live-examples/js-examples/statement/statement-async-for-in.js +++ b/live-examples/js-examples/statement/statement-async-for-in.js @@ -1,5 +1,6 @@ async function getFromList() { - const url = 'https://www.random.org/decimal-fractions/?num=1&dec=10&col=1&format=plain&rnd=new'; + const url = + 'https://www.random.org/decimal-fractions/?num=1&dec=10&col=1&format=plain&rnd=new'; const arrayOfFetches = [doFetch(url), doFetch(url), doFetch(url)]; diff --git a/live-examples/js-examples/string/string-at.js b/live-examples/js-examples/string/string-at.js index b2f1ae330..35af8c840 100644 --- a/live-examples/js-examples/string/string-at.js +++ b/live-examples/js-examples/string/string-at.js @@ -2,10 +2,10 @@ const sentence = 'The quick brown fox jumps over the lazy dog.'; let index = 5; -console.log(`Using an index of ${index} the character returned is ${sentence.at(index)}`); -// Expected output: "Using an index of 5 the character returned is u" +console.log(`An index of ${index} returns the character ${sentence.at(index)}`); +// Expected output: "An index of 5 returns the character u" index = -4; -console.log(`Using an index of ${index} the character returned is ${sentence.at(index)}`); -// Expected output: "Using an index of -4 the character returned is d" +console.log(`An index of ${index} returns the character ${sentence.at(index)}`); +// Expected output: "An index of -4 returns the character d" diff --git a/live-examples/js-examples/string/string-charcodeat.js b/live-examples/js-examples/string/string-charcodeat.js index 34f0ce2c0..a170dec6c 100644 --- a/live-examples/js-examples/string/string-charcodeat.js +++ b/live-examples/js-examples/string/string-charcodeat.js @@ -2,5 +2,9 @@ const sentence = 'The quick brown fox jumps over the lazy dog.'; const index = 4; -console.log(`The character code ${sentence.charCodeAt(index)} is equal to ${sentence.charAt(index)}`); -// Expected output: "The character code 113 is equal to q" +console.log( + `Character code ${sentence.charCodeAt(index)} is equal to ${sentence.charAt( + index, + )}`, +); +// Expected output: "Character code 113 is equal to q" diff --git a/live-examples/js-examples/string/string-includes.js b/live-examples/js-examples/string/string-includes.js index d9352cb2a..ed663ece1 100644 --- a/live-examples/js-examples/string/string-includes.js +++ b/live-examples/js-examples/string/string-includes.js @@ -2,5 +2,9 @@ const sentence = 'The quick brown fox jumps over the lazy dog.'; const word = 'fox'; -console.log(`The word "${word}" ${sentence.includes(word) ? 'is' : 'is not'} in the sentence`); +console.log( + `The word "${word}" ${ + sentence.includes(word) ? 'is' : 'is not' + } in the sentence`, +); // Expected output: "The word "fox" is in the sentence" diff --git a/live-examples/js-examples/string/string-indexof.js b/live-examples/js-examples/string/string-indexof.js index cae8f7195..24f2c2077 100644 --- a/live-examples/js-examples/string/string-indexof.js +++ b/live-examples/js-examples/string/string-indexof.js @@ -1,10 +1,18 @@ -const paragraph = 'The quick brown fox jumps over the lazy dog. If the dog barked, was it really lazy?'; +const paragraph = + 'The quick brown fox jumps over the lazy dog. If the dog barked, was it really lazy?'; const searchTerm = 'dog'; const indexOfFirst = paragraph.indexOf(searchTerm); -console.log(`The index of the first "${searchTerm}" from the beginning is ${indexOfFirst}`); +console.log( + `The index of the first "${searchTerm}" from the beginning is ${indexOfFirst}`, +); // Expected output: "The index of the first "dog" from the beginning is 40" -console.log(`The index of the 2nd "${searchTerm}" is ${paragraph.indexOf(searchTerm, indexOfFirst + 1)}`); +console.log( + `The index of the 2nd "${searchTerm}" is ${paragraph.indexOf( + searchTerm, + indexOfFirst + 1, + )}`, +); // Expected output: "The index of the 2nd "dog" is 52" diff --git a/live-examples/js-examples/string/string-lastindexof.js b/live-examples/js-examples/string/string-lastindexof.js index 8b2035826..b40bea7f8 100644 --- a/live-examples/js-examples/string/string-lastindexof.js +++ b/live-examples/js-examples/string/string-lastindexof.js @@ -1,6 +1,11 @@ -const paragraph = 'The quick brown fox jumps over the lazy dog. If the dog barked, was it really lazy?'; +const paragraph = + 'The quick brown fox jumps over the lazy dog. If the dog barked, was it really lazy?'; const searchTerm = 'dog'; -console.log(`The index of the first "${searchTerm}" from the end is ${paragraph.lastIndexOf(searchTerm)}`); +console.log( + `The index of the first "${searchTerm}" from the end is ${paragraph.lastIndexOf( + searchTerm, + )}`, +); // Expected output: "The index of the first "dog" from the end is 52" diff --git a/live-examples/js-examples/string/string-replace.js b/live-examples/js-examples/string/string-replace.js index 9de55eff6..dc60e0e63 100644 --- a/live-examples/js-examples/string/string-replace.js +++ b/live-examples/js-examples/string/string-replace.js @@ -1,4 +1,5 @@ -const p = 'The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?'; +const p = + 'The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?'; console.log(p.replace('dog', 'monkey')); // Expected output: "The quick brown fox jumps over the lazy monkey. If the dog reacted, was it really lazy?" diff --git a/live-examples/js-examples/string/string-replaceall.js b/live-examples/js-examples/string/string-replaceall.js index 855882d3a..613764e2d 100644 --- a/live-examples/js-examples/string/string-replaceall.js +++ b/live-examples/js-examples/string/string-replaceall.js @@ -1,4 +1,5 @@ -const p = 'The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?'; +const p = + 'The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?'; console.log(p.replaceAll('dog', 'monkey')); // Expected output: "The quick brown fox jumps over the lazy monkey. If the monkey reacted, was it really lazy?" diff --git a/live-examples/js-examples/string/string-search.js b/live-examples/js-examples/string/string-search.js index 87c67e371..ea6184405 100644 --- a/live-examples/js-examples/string/string-search.js +++ b/live-examples/js-examples/string/string-search.js @@ -1,4 +1,5 @@ -const paragraph = 'The quick brown fox jumps over the lazy dog. If the dog barked, was it really lazy?'; +const paragraph = + 'The quick brown fox jumps over the lazy dog. If the dog barked, was it really lazy?'; // Any character that is not a word character or whitespace const regex = /[^\w\s]/g; diff --git a/live-examples/js-examples/symbol/symbol-split.js b/live-examples/js-examples/symbol/symbol-split.js index ff8b77052..4711063d9 100644 --- a/live-examples/js-examples/symbol/symbol-split.js +++ b/live-examples/js-examples/symbol/symbol-split.js @@ -4,7 +4,9 @@ class Split1 { } [Symbol.split](string) { const index = string.indexOf(this.value); - return `${this.value}${string.substr(0, index)}/${string.substr(index + this.value.length)}`; + return `${this.value}${string.substr(0, index)}/${string.substr( + index + this.value.length, + )}`; } } diff --git a/live-examples/js-examples/typedarray/typedarray-at.js b/live-examples/js-examples/typedarray/typedarray-at.js index 635ed5d41..d3fbdeb67 100644 --- a/live-examples/js-examples/typedarray/typedarray-at.js +++ b/live-examples/js-examples/typedarray/typedarray-at.js @@ -2,10 +2,10 @@ const int8 = new Int8Array([0, 10, -10, 20, -30, 40, -50]); let index = 1; -console.log(`Using an index of ${index} the item returned is ${int8.at(index)}`); -// Expected output: "Using an index of 1 the item returned is 10" +console.log(`An index of ${index} returns the item ${int8.at(index)}`); +// Expected output: "An index of 1 returns the item 10" index = -2; -console.log(`Using an index of ${index} the item returned is ${int8.at(index)}`); -// Expected output: "Using an index of -2 the item returned is 40" +console.log(`An index of ${index} returns the item ${int8.at(index)}`); +// Expected output: "An index of -2 returns the item 40" diff --git a/live-examples/js-examples/typedarray/typedarray-reduceright.js b/live-examples/js-examples/typedarray/typedarray-reduceright.js index d9e7afeda..9a4efce73 100644 --- a/live-examples/js-examples/typedarray/typedarray-reduceright.js +++ b/live-examples/js-examples/typedarray/typedarray-reduceright.js @@ -1,6 +1,8 @@ const uint8 = new Uint8Array([10, 20, 30]); -const result = uint8.reduceRight((accumulator, currentValue) => `${accumulator}, ${currentValue}`); +const result = uint8.reduceRight( + (accumulator, currentValue) => `${accumulator}, ${currentValue}`, +); console.log(result); // Expected output: "30, 20, 10" diff --git a/live-examples/js-examples/typedarray/typedarray-tolocalestring.js b/live-examples/js-examples/typedarray/typedarray-tolocalestring.js index 167e90666..e8df8352d 100644 --- a/live-examples/js-examples/typedarray/typedarray-tolocalestring.js +++ b/live-examples/js-examples/typedarray/typedarray-tolocalestring.js @@ -6,5 +6,7 @@ console.log(uint8.toLocaleString()); console.log(uint8.toLocaleString('en-GB')); // Expected output: "500,8,123,12" -console.log(uint8.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' })); +console.log( + uint8.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }), +); // Expected output: "500,00 €,8.123,00 €,12,00 €" diff --git a/live-examples/js-examples/weakref/weakref.js b/live-examples/js-examples/weakref/weakref.js index 8c58915e5..b9fc80333 100644 --- a/live-examples/js-examples/weakref/weakref.js +++ b/live-examples/js-examples/weakref/weakref.js @@ -3,7 +3,7 @@ const ref = new WeakRef(['foo', 'bar']); console.log(ref.deref()[0]); // Expected output: "foo" -console.log('Triggering garbage collection, which you should never do in production code'); +console.log("Triggering garbage collection. Don't do this in production code!"); console.log('This process is unpredictable and may take few minutes'); function checkIfCollected() { diff --git a/live-examples/wat-examples/numeric/and.js b/live-examples/wat-examples/numeric/and.js index 114e983c5..3554cdc7d 100644 --- a/live-examples/wat-examples/numeric/and.js +++ b/live-examples/wat-examples/numeric/and.js @@ -1,11 +1,13 @@ const url = '{%wasm-url%}'; -await WebAssembly.instantiateStreaming(fetch(url), { console }).then((result) => { - const and = result.instance.exports.and; +await WebAssembly.instantiateStreaming(fetch(url), { console }).then( + (result) => { + const and = result.instance.exports.and; - const res = and(0b10000010, 0b01101111); - console.log(numToBin(res)); - // Expected output: "00000010" -}); + const res = and(0b10000010, 0b01101111); + console.log(numToBin(res)); + // Expected output: "00000010" + }, +); function numToBin(num) { return (num >>> 0).toString(2).padStart(8, '0'); diff --git a/live-examples/wat-examples/numeric/clz.js b/live-examples/wat-examples/numeric/clz.js index 4db44f96d..6ccabfe51 100644 --- a/live-examples/wat-examples/numeric/clz.js +++ b/live-examples/wat-examples/numeric/clz.js @@ -1,7 +1,11 @@ const url = '{%wasm-url%}'; -await WebAssembly.instantiateStreaming(fetch(url), { console }).then((result) => { - const leading0 = result.instance.exports.leading0; +await WebAssembly.instantiateStreaming(fetch(url), { console }).then( + (result) => { + const leading0 = result.instance.exports.leading0; - console.log(`Leading zeros: ${leading0(0b00000000_10000000_00000000_00000000)}`); - // Expected output: "Leading zeros: 8" -}); + console.log( + `Leading zeros: ${leading0(0b00000000_10000000_00000000_00000000)}`, + ); + // Expected output: "Leading zeros: 8" + }, +); diff --git a/live-examples/wat-examples/numeric/ctz.js b/live-examples/wat-examples/numeric/ctz.js index dddafb192..eb6871ea4 100644 --- a/live-examples/wat-examples/numeric/ctz.js +++ b/live-examples/wat-examples/numeric/ctz.js @@ -1,7 +1,11 @@ const url = '{%wasm-url%}'; -await WebAssembly.instantiateStreaming(fetch(url), { console }).then((result) => { - const trailing0 = result.instance.exports.trailing0; +await WebAssembly.instantiateStreaming(fetch(url), { console }).then( + (result) => { + const trailing0 = result.instance.exports.trailing0; - console.log(`Trailing zeros: ${trailing0(0b00000000_10000000_00000000_00000000)}`); - // Expected output: "Trailing zeros: 23" -}); + console.log( + `Trailing zeros: ${trailing0(0b00000000_10000000_00000000_00000000)}`, + ); + // Expected output: "Trailing zeros: 23" + }, +); diff --git a/live-examples/wat-examples/numeric/or.js b/live-examples/wat-examples/numeric/or.js index 4b4312b3f..818f62a0c 100644 --- a/live-examples/wat-examples/numeric/or.js +++ b/live-examples/wat-examples/numeric/or.js @@ -1,11 +1,13 @@ const url = '{%wasm-url%}'; -await WebAssembly.instantiateStreaming(fetch(url), { console }).then((result) => { - const or = result.instance.exports.or; +await WebAssembly.instantiateStreaming(fetch(url), { console }).then( + (result) => { + const or = result.instance.exports.or; - const res = or(0b10000010, 0b01101111); - console.log(numToBin(res)); - // Expected output: "11101111" -}); + const res = or(0b10000010, 0b01101111); + console.log(numToBin(res)); + // Expected output: "11101111" + }, +); function numToBin(num) { return (num >>> 0).toString(2).padStart(8, '0'); diff --git a/live-examples/wat-examples/numeric/popcnt.js b/live-examples/wat-examples/numeric/popcnt.js index 32d607bca..2af67034a 100644 --- a/live-examples/wat-examples/numeric/popcnt.js +++ b/live-examples/wat-examples/numeric/popcnt.js @@ -1,7 +1,9 @@ const url = '{%wasm-url%}'; -await WebAssembly.instantiateStreaming(fetch(url), { console }).then((result) => { - const count1s = result.instance.exports.count1s; +await WebAssembly.instantiateStreaming(fetch(url), { console }).then( + (result) => { + const count1s = result.instance.exports.count1s; - console.log(count1s(0b10000010)); - // Expected output: 2 -}); + console.log(count1s(0b10000010)); + // Expected output: 2 + }, +); diff --git a/live-examples/wat-examples/numeric/rotl.js b/live-examples/wat-examples/numeric/rotl.js index 28b564b04..2830523d6 100644 --- a/live-examples/wat-examples/numeric/rotl.js +++ b/live-examples/wat-examples/numeric/rotl.js @@ -1,11 +1,13 @@ const url = '{%wasm-url%}'; -await WebAssembly.instantiateStreaming(fetch(url), { console }).then((result) => { - const rotate_left = result.instance.exports.rotate_left; +await WebAssembly.instantiateStreaming(fetch(url), { console }).then( + (result) => { + const rotate_left = result.instance.exports.rotate_left; - const res = rotate_left(0b11100000_00000000_00000000_00000000, 1); - console.log(numToBin(res)); - // Expected output: "11000000_00000000_00000000_00000001" -}); + const res = rotate_left(0b11100000_00000000_00000000_00000000, 1); + console.log(numToBin(res)); + // Expected output: "11000000_00000000_00000000_00000001" + }, +); function numToBin(num) { return (num >>> 0) diff --git a/live-examples/wat-examples/numeric/rotr.js b/live-examples/wat-examples/numeric/rotr.js index fbd9264e5..c644bb730 100644 --- a/live-examples/wat-examples/numeric/rotr.js +++ b/live-examples/wat-examples/numeric/rotr.js @@ -1,11 +1,13 @@ const url = '{%wasm-url%}'; -await WebAssembly.instantiateStreaming(fetch(url), { console }).then((result) => { - const rotate_right = result.instance.exports.rotate_right; +await WebAssembly.instantiateStreaming(fetch(url), { console }).then( + (result) => { + const rotate_right = result.instance.exports.rotate_right; - const res = rotate_right(0b00000000_00000000_00000000_00000111, 1); - console.log(numToBin(res)); - // Expected output: "10000000_00000000_00000000_00000011" -}); + const res = rotate_right(0b00000000_00000000_00000000_00000111, 1); + console.log(numToBin(res)); + // Expected output: "10000000_00000000_00000000_00000011" + }, +); function numToBin(num) { return (num >>> 0) diff --git a/live-examples/wat-examples/numeric/shl.js b/live-examples/wat-examples/numeric/shl.js index 836c6cead..f97973195 100644 --- a/live-examples/wat-examples/numeric/shl.js +++ b/live-examples/wat-examples/numeric/shl.js @@ -1,11 +1,13 @@ const url = '{%wasm-url%}'; -await WebAssembly.instantiateStreaming(fetch(url), { console }).then((result) => { - const shift_left = result.instance.exports.shift_left; +await WebAssembly.instantiateStreaming(fetch(url), { console }).then( + (result) => { + const shift_left = result.instance.exports.shift_left; - const res = shift_left(0b11100000_00000000_00000000_00000000, 1); - console.log(numToBin(res)); - // Expected output: "11000000_00000000_00000000_00000000" -}); + const res = shift_left(0b11100000_00000000_00000000_00000000, 1); + console.log(numToBin(res)); + // Expected output: "11000000_00000000_00000000_00000000" + }, +); function numToBin(num) { return (num >>> 0) diff --git a/live-examples/wat-examples/numeric/shr.js b/live-examples/wat-examples/numeric/shr.js index f66c65503..01233672a 100644 --- a/live-examples/wat-examples/numeric/shr.js +++ b/live-examples/wat-examples/numeric/shr.js @@ -1,11 +1,13 @@ const url = '{%wasm-url%}'; -await WebAssembly.instantiateStreaming(fetch(url), { console }).then((result) => { - const shift_right = result.instance.exports.shift_right; +await WebAssembly.instantiateStreaming(fetch(url), { console }).then( + (result) => { + const shift_right = result.instance.exports.shift_right; - const res = shift_right(0b00000000_00000000_00000000_00000111, 1); - console.log(numToBin(res)); - // Expected output: "00000000_00000000_00000000_00000011" -}); + const res = shift_right(0b00000000_00000000_00000000_00000111, 1); + console.log(numToBin(res)); + // Expected output: "00000000_00000000_00000000_00000011" + }, +); function numToBin(num) { return (num >>> 0) diff --git a/live-examples/wat-examples/numeric/xor.js b/live-examples/wat-examples/numeric/xor.js index c995643f6..21e8613cb 100644 --- a/live-examples/wat-examples/numeric/xor.js +++ b/live-examples/wat-examples/numeric/xor.js @@ -1,11 +1,13 @@ const url = '{%wasm-url%}'; -await WebAssembly.instantiateStreaming(fetch(url), { console }).then((result) => { - const xor = result.instance.exports.xor; +await WebAssembly.instantiateStreaming(fetch(url), { console }).then( + (result) => { + const xor = result.instance.exports.xor; - const res = xor(0b10000010, 0b01101111); - console.log(numToBin(res)); - // Expected output: "11101101" -}); + const res = xor(0b10000010, 0b01101111); + console.log(numToBin(res)); + // Expected output: "11101101" + }, +); function numToBin(num) { return (num >>> 0).toString(2).padStart(8, '0'); diff --git a/live-examples/wat-examples/statements/block.js b/live-examples/wat-examples/statements/block.js index 727b0f539..f5b1ccecb 100644 --- a/live-examples/wat-examples/statements/block.js +++ b/live-examples/wat-examples/statements/block.js @@ -1,11 +1,13 @@ const url = '{%wasm-url%}'; -await WebAssembly.instantiateStreaming(fetch(url), { console }).then((result) => { - const log_if_not_100 = result.instance.exports.log_if_not_100; +await WebAssembly.instantiateStreaming(fetch(url), { console }).then( + (result) => { + const log_if_not_100 = result.instance.exports.log_if_not_100; - log_if_not_100(99); - // Expected output: 99 - log_if_not_100(100); - // Should not log anything - log_if_not_100(101); - // Expected output: 101 -}); + log_if_not_100(99); + // Expected output: 99 + log_if_not_100(100); + // Should not log anything + log_if_not_100(101); + // Expected output: 101 + }, +); diff --git a/live-examples/webapi-examples/url/url-prototype-password.js b/live-examples/webapi-examples/url/url-prototype-password.js index c7b1e7b76..a235d3a18 100644 --- a/live-examples/webapi-examples/url/url-prototype-password.js +++ b/live-examples/webapi-examples/url/url-prototype-password.js @@ -1,3 +1,3 @@ -const url = new URL('https://admin:test@en.wikipedia.org:443/wiki/Mozilla#Software'); +const url = new URL('https://admin:test@example.com:443/wiki/Mozilla#Software'); console.log(url.password); // expected output: "test" diff --git a/live-examples/webapi-examples/url/url-prototype-search.js b/live-examples/webapi-examples/url/url-prototype-search.js index b21490d4c..166a5541f 100644 --- a/live-examples/webapi-examples/url/url-prototype-search.js +++ b/live-examples/webapi-examples/url/url-prototype-search.js @@ -1,3 +1,3 @@ -const url = new URL('https://en.wikipedia.org/w/index.php?title=Mozilla&action=edit'); +const url = new URL('https://example.com/index.php?title=Mozilla&action=edit'); console.log(url.search); // expected output: "?title=Mozilla&action=edit" diff --git a/live-examples/webapi-examples/url/url-prototype-searchparams.js b/live-examples/webapi-examples/url/url-prototype-searchparams.js index dc32bde13..a3d30a3d5 100644 --- a/live-examples/webapi-examples/url/url-prototype-searchparams.js +++ b/live-examples/webapi-examples/url/url-prototype-searchparams.js @@ -1,4 +1,4 @@ -const url = new URL('https://en.wikipedia.org/w/index.php?title=Mozilla&action=edit'); +const url = new URL('https://example.com/index.php?title=Mozilla&action=edit'); const params = url.searchParams; params.forEach((value, key) => console.log(`${key} - ${value}`)); diff --git a/live-examples/webapi-examples/url/url-prototype-username.js b/live-examples/webapi-examples/url/url-prototype-username.js index 897dba709..e62e30026 100644 --- a/live-examples/webapi-examples/url/url-prototype-username.js +++ b/live-examples/webapi-examples/url/url-prototype-username.js @@ -1,3 +1,3 @@ -const url = new URL('https://admin:test@en.wikipedia.org:443/wiki/Mozilla#Software'); +const url = new URL('https://admin:test@example.com:443/wiki/Mozilla#Software'); console.log(url.username); // expected output: "admin" From d080f65f31847fa47591270aa6ba913f917d5841 Mon Sep 17 00:00:00 2001 From: Brian Thomas Smith Date: Tue, 31 Oct 2023 11:34:25 +0100 Subject: [PATCH 2/2] chore(formatting): Format config file, minor consistency fix --- .stylelintrc | 15 ++++++++++++--- .../finalizationregistry/finalizationregistry.js | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.stylelintrc b/.stylelintrc index 06daa09b4..7a94a1f91 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -7,7 +7,10 @@ "comment-no-empty": true, "declaration-block-no-shorthand-property-overrides": true, "declaration-block-single-line-max-declarations": 1, - "declaration-empty-line-before": ["never", { "ignore": ["after-comment", "after-declaration"] }], + "declaration-empty-line-before": [ + "never", + { "ignore": ["after-comment", "after-declaration"] } + ], "declaration-no-important": true, "font-family-name-quotes": "always-where-recommended", "font-family-no-duplicate-names": true, @@ -17,11 +20,17 @@ "keyframe-declaration-no-important": true, "length-zero-no-unit": true, "max-nesting-depth": 5, - "media-feature-name-no-unknown": [true, { "ignoreMediaFeatureNames": ["min--moz-device-pixel-ratio"] }], + "media-feature-name-no-unknown": [ + true, + { "ignoreMediaFeatureNames": ["min--moz-device-pixel-ratio"] } + ], "no-invalid-double-slash-comments": true, "no-unknown-animations": true, "property-no-unknown": true, - "rule-empty-line-before": ["always", { "ignore": ["after-comment", "inside-block"] }], + "rule-empty-line-before": [ + "always", + { "ignore": ["after-comment", "inside-block"] } + ], "selector-pseudo-class-no-unknown": true, "selector-pseudo-element-no-unknown": true, "selector-type-case": "lower", diff --git a/live-examples/js-examples/finalizationregistry/finalizationregistry.js b/live-examples/js-examples/finalizationregistry/finalizationregistry.js index bf76f06e0..0a69773fd 100644 --- a/live-examples/js-examples/finalizationregistry/finalizationregistry.js +++ b/live-examples/js-examples/finalizationregistry/finalizationregistry.js @@ -9,7 +9,7 @@ const array1 = ['foo']; registry.register(array1, 'foo'); // array1 is not referenced in any callback, so it can be garbage collected -console.log("Triggering garbage collection, don't do this in production code!"); +console.log("Triggering garbage collection. Don't do this in production code!"); (function allocateMemory() { Array.from({ length: 50000 }, () => () => {});