-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: Enable ESLint and Prettier for all files
- Remove ESLint rules that overlap with Prettier/EditorConfig - Remove Prettier rules overlapping with EditorConfig - Replace Prettier-eslint with plugin/config versions - Set Environment to ES2022 and remove globals that are not required - Remove babel parser, since covered by ES2022 - Ignore WASM folders because of top level awaits - Rename script commands to match mdn/content - Drop direct ajv dependency
- Loading branch information
Showing
133 changed files
with
469 additions
and
820 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
docs/ | ||
js/lib/* | ||
js/mode/* | ||
live-examples/wat-examples/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"tabWidth": 4, | ||
"printWidth": 120, | ||
"overrides": [ | ||
{ | ||
"files": "*.md", | ||
"options": { | ||
"tabWidth": 2 | ||
} | ||
} | ||
] | ||
"semi": true, | ||
"trailingComma": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
'use strict'; | ||
|
||
window.addEventListener('load', function() { | ||
const el = document.getElementById('example-element'); | ||
const status = document.getElementById('playstatus'); | ||
window.addEventListener('load', () => { | ||
const el = document.getElementById('example-element'); | ||
const status = document.getElementById('playstatus'); | ||
|
||
function update() { | ||
status.textContent = 'delaying'; | ||
el.className = ''; | ||
window.requestAnimationFrame(function() { | ||
window.requestAnimationFrame(function() { | ||
el.className = 'animating'; | ||
}); | ||
}); | ||
} | ||
|
||
el.addEventListener('animationstart', function() { | ||
status.textContent = 'playing'; | ||
function update() { | ||
status.textContent = 'delaying'; | ||
el.className = ''; | ||
window.requestAnimationFrame(() => { | ||
window.requestAnimationFrame(() => { | ||
el.className = 'animating'; | ||
}); | ||
}); | ||
} | ||
|
||
el.addEventListener('animationend', function() { | ||
status.textContent = 'finished'; | ||
}); | ||
el.addEventListener('animationstart', () => { | ||
status.textContent = 'playing'; | ||
}); | ||
|
||
const observer = new MutationObserver(function() { | ||
update(); | ||
}); | ||
|
||
observer.observe(el, { | ||
attributes: true, | ||
attributeFilter: ['style'] | ||
}); | ||
el.addEventListener('animationend', () => { | ||
status.textContent = 'finished'; | ||
}); | ||
|
||
const observer = new MutationObserver(() => { | ||
update(); | ||
}); | ||
|
||
observer.observe(el, { | ||
attributes: true, | ||
attributeFilter: ['style'] | ||
}); | ||
|
||
update(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
'use strict'; | ||
|
||
window.addEventListener('load', function() { | ||
const el = document.getElementById('example-element'); | ||
const button = document.getElementById('play-pause'); | ||
window.addEventListener('load', () => { | ||
const el = document.getElementById('example-element'); | ||
const button = document.getElementById('play-pause'); | ||
|
||
button.addEventListener('click', function() { | ||
if (el.classList.contains('running')) { | ||
el.classList.remove('running'); | ||
button.textContent = 'Play'; | ||
} else { | ||
el.classList.add('running'); | ||
button.textContent = 'Pause'; | ||
} | ||
}); | ||
button.addEventListener('click', () => { | ||
if (el.classList.contains('running')) { | ||
el.classList.remove('running'); | ||
button.textContent = 'Play'; | ||
} else { | ||
el.classList.add('running'); | ||
button.textContent = 'Pause'; | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 12 additions & 12 deletions
24
live-examples/css-examples/motion-path/offset-playback.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
window.addEventListener('load', function() { | ||
const example = document.getElementById('example-element'); | ||
const button = document.getElementById('playback'); | ||
window.addEventListener('load', () => { | ||
const example = document.getElementById('example-element'); | ||
const button = document.getElementById('playback'); | ||
|
||
button.addEventListener('click', function() { | ||
if (example.classList.contains('running')) { | ||
example.classList.remove('running'); | ||
button.textContent = 'Play'; | ||
} else { | ||
example.classList.add('running'); | ||
button.textContent = 'Pause'; | ||
} | ||
}); | ||
button.addEventListener('click', () => { | ||
if (example.classList.contains('running')) { | ||
example.classList.remove('running'); | ||
button.textContent = 'Play'; | ||
} else { | ||
example.classList.add('running'); | ||
button.textContent = 'Pause'; | ||
} | ||
}); | ||
}); |
52 changes: 26 additions & 26 deletions
52
live-examples/css-examples/transforms/transform-origin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
'use strict'; | ||
|
||
window.addEventListener('load', function() { | ||
function update() { | ||
const selected = document.querySelector('.selected code'); | ||
window.addEventListener('load', () => { | ||
function update() { | ||
const selected = document.querySelector('.selected code'); | ||
|
||
/* Restart the animation | ||
/* Restart the animation | ||
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Animations/Tips */ | ||
el.className = ''; | ||
window.requestAnimationFrame(function() { | ||
window.requestAnimationFrame(function() { | ||
el.className = selected.dataset.animation; | ||
}); | ||
}); | ||
el.className = ''; | ||
window.requestAnimationFrame(() => { | ||
window.requestAnimationFrame(() => { | ||
el.className = selected.dataset.animation; | ||
}); | ||
}); | ||
|
||
const transformOrigin = getComputedStyle(el).transformOrigin; | ||
const pos = transformOrigin.split(/\s+/); | ||
crosshair.style.left = 'calc(' + pos[0] + ' - 12px)'; | ||
crosshair.style.top = 'calc(' + pos[1] + ' - 12px)'; | ||
} | ||
const transformOrigin = getComputedStyle(el).transformOrigin; | ||
const pos = transformOrigin.split(/\s+/); | ||
crosshair.style.left = `calc(${pos[0]} - 12px)`; | ||
crosshair.style.top = `calc(${pos[1]} - 12px)`; | ||
} | ||
|
||
const crosshair = document.getElementById('crosshair'); | ||
const el = document.getElementById('example-element'); | ||
const crosshair = document.getElementById('crosshair'); | ||
const el = document.getElementById('example-element'); | ||
|
||
const observer = new MutationObserver(function() { | ||
update(); | ||
}); | ||
const observer = new MutationObserver(() => { | ||
update(); | ||
}); | ||
|
||
observer.observe(el, { | ||
attributes: true, | ||
attributeFilter: ['style'] | ||
}); | ||
observer.observe(el, { | ||
attributes: true, | ||
attributeFilter: ['style'] | ||
}); | ||
|
||
update(); | ||
crosshair.style.opacity = '1'; | ||
update(); | ||
crosshair.style.opacity = '1'; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present']; | ||
const words = [ | ||
'spray', | ||
'limit', | ||
'elite', | ||
'exuberant', | ||
'destruction', | ||
'present' | ||
]; | ||
|
||
const result = words.filter(word => word.length > 6); | ||
const result = words.filter((word) => word.length > 6); | ||
|
||
console.log(result); | ||
// expected output: Array ["exuberant", "destruction", "present"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const array1 = [5, 12, 8, 130, 44]; | ||
|
||
const found = array1.find(element => element > 10); | ||
const found = array1.find((element) => element > 10); | ||
|
||
console.log(found); | ||
// expected output: 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const arr1 = [1, 2, [3], [4, 5], 6, []]; | ||
|
||
const flattened = arr1.flatMap(num => num); | ||
const flattened = arr1.flatMap((num) => num); | ||
|
||
console.log(flattened); | ||
// expected output: Array [1, 2, 3, 4, 5, 6] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
console.log(Array.from('foo')); | ||
// expected output: Array ["f", "o", "o"] | ||
|
||
console.log(Array.from([1, 2, 3], x => x + x)); | ||
console.log(Array.from([1, 2, 3], (x) => x + x)); | ||
// expected output: Array [2, 4, 6] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
const inventory = [ | ||
{ name: 'asparagus', type: 'vegetables', quantity: 5 }, | ||
{ name: 'bananas', type: 'fruit', quantity: 0 }, | ||
{ name: 'bananas', type: 'fruit', quantity: 0 }, | ||
{ name: 'goat', type: 'meat', quantity: 23 }, | ||
{ name: 'cherries', type: 'fruit', quantity: 5 }, | ||
{ name: 'fish', type: 'meat', quantity: 22 } | ||
]; | ||
|
||
const result = inventory.groupBy( ({ type }) => type ); | ||
const result = inventory.groupBy(({ type }) => type); | ||
|
||
console.log(result.vegetables); | ||
// expected output: Array [Object { name: "asparagus", type: "vegetables", quantity: 5 }] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
const array1 = [1, 4, 9, 16]; | ||
|
||
// pass a function to map | ||
const map1 = array1.map(x => x * 2); | ||
const map1 = array1.map((x) => x * 2); | ||
|
||
console.log(map1); | ||
// expected output: Array [2, 8, 18, 32] |
Oops, something went wrong.