Skip to content

Commit

Permalink
chore(formatting): Apply default printWidth for JS / CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
bsmth committed Oct 31, 2023
1 parent e300454 commit bb27924
Show file tree
Hide file tree
Showing 65 changed files with 338 additions and 140 deletions.
9 changes: 8 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"bracketSameLine": true,
"singleQuote": true,
"printWidth": 120
"overrides": [
{
"files": ["**/*.md", "**/*.html"],
"options": {
"printWidth": 120
}
}
]
}
5 changes: 4 additions & 1 deletion live-examples/css-examples/color/color-adjust.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion live-examples/css-examples/fonts/font-synthesis.css
Original file line number Diff line number Diff line change
Expand Up @@ -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] */
Expand Down
3 changes: 2 additions & 1 deletion live-examples/css-examples/fonts/font-variant-east-asian.css
Original file line number Diff line number Diff line change
@@ -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;
}
4 changes: 3 additions & 1 deletion live-examples/css-examples/fragmentation/break.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
9 changes: 8 additions & 1 deletion live-examples/css-examples/motion-path/offset-anchor.css
Original file line number Diff line number Diff line change
Expand Up @@ -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%;
}
Expand Down
8 changes: 7 additions & 1 deletion live-examples/css-examples/rhythm/line-height-step.css
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
7 changes: 6 additions & 1 deletion live-examples/css-examples/shapes/shape-image-threshold.css
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 6 additions & 1 deletion live-examples/html-examples/forms/css/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ class LengthLeftTextarea extends HTMLTextAreaElement {
}
}

customElements.define('length-left-textarea', LengthLeftTextarea, { extends: 'textarea' });
customElements.define('length-left-textarea', LengthLeftTextarea, {
extends: 'textarea',
});
7 changes: 6 additions & 1 deletion live-examples/html-examples/input/css/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions live-examples/js-examples/array/array-at.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion live-examples/js-examples/array/array-filter.js
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
4 changes: 3 additions & 1 deletion live-examples/js-examples/array/array-reduce-right.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
5 changes: 4 additions & 1 deletion live-examples/js-examples/array/array-reduce.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion live-examples/js-examples/bigint/bigint-asintn.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
4 changes: 3 additions & 1 deletion live-examples/js-examples/bigint/bigint-tolocalestring.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 €"
15 changes: 14 additions & 1 deletion live-examples/js-examples/classes/classes-extends.js
Original file line number Diff line number Diff line change
@@ -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()}`;
}
}
Expand Down
7 changes: 6 additions & 1 deletion live-examples/js-examples/date/date-tolocaledatestring.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }, () => () => {});
Expand Down
6 changes: 5 additions & 1 deletion live-examples/js-examples/intl/intl-collator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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));
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
6 changes: 5 additions & 1 deletion live-examples/js-examples/intl/intl-datetimeformat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 3 additions & 1 deletion live-examples/js-examples/intl/intl-displaynames.js
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
10 changes: 8 additions & 2 deletions live-examples/js-examples/intl/intl-listformat.js
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
10 changes: 8 additions & 2 deletions live-examples/js-examples/intl/intl-locale-prototype-tostring.js
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
18 changes: 15 additions & 3 deletions live-examples/js-examples/intl/intl-numberformat.js
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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]);
Expand Down
Loading

0 comments on commit bb27924

Please sign in to comment.