chore: linting
This commit is contained in:
parent
b6b7db7327
commit
fa653a8859
@ -22,7 +22,7 @@ import toggleClass from './toggle-class';
|
||||
if (window.location.host === production) {
|
||||
Sentry.init({
|
||||
dsn: 'https://d4ad9866ad834437a4754e23937071e4@sentry.io/305555',
|
||||
whitelistUrls: [production].map(d => new RegExp(`https://(([a-z0-9])+(.))*${d}`)),
|
||||
whitelistUrls: [production].map((d) => new RegExp(`https://(([a-z0-9])+(.))*${d}`)),
|
||||
});
|
||||
}
|
||||
|
||||
@ -79,13 +79,13 @@ import toggleClass from './toggle-class';
|
||||
|
||||
function render(type) {
|
||||
// Remove active classes
|
||||
Array.from(buttons).forEach(button => toggleClass(button.parentElement, 'active', false));
|
||||
Array.from(buttons).forEach((button) => toggleClass(button.parentElement, 'active', false));
|
||||
|
||||
// Set active on parent
|
||||
toggleClass(document.querySelector(`[data-source="${type}"]`), 'active', true);
|
||||
|
||||
// Show cite
|
||||
Array.from(document.querySelectorAll('.plyr__cite')).forEach(cite => {
|
||||
Array.from(document.querySelectorAll('.plyr__cite')).forEach((cite) => {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
cite.hidden = true;
|
||||
});
|
||||
@ -110,7 +110,7 @@ import toggleClass from './toggle-class';
|
||||
}
|
||||
|
||||
// Bind to each button
|
||||
Array.from(buttons).forEach(button => {
|
||||
Array.from(buttons).forEach((button) => {
|
||||
button.addEventListener('click', () => {
|
||||
const type = button.getAttribute('data-source');
|
||||
|
||||
@ -123,7 +123,7 @@ import toggleClass from './toggle-class';
|
||||
});
|
||||
|
||||
// List for backwards/forwards
|
||||
window.addEventListener('popstate', event => {
|
||||
window.addEventListener('popstate', (event) => {
|
||||
if (event.state && Object.keys(event.state).includes('type')) {
|
||||
setSource(event.state.type);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ const container = document.getElementById('container');
|
||||
const tabClassName = 'tab-focus';
|
||||
|
||||
// Remove class on blur
|
||||
document.addEventListener('focusout', event => {
|
||||
document.addEventListener('focusout', (event) => {
|
||||
if (!event.target.classList || container.contains(event.target)) {
|
||||
return;
|
||||
}
|
||||
@ -12,7 +12,7 @@ document.addEventListener('focusout', event => {
|
||||
});
|
||||
|
||||
// Add classname to tabbed elements
|
||||
document.addEventListener('keydown', event => {
|
||||
document.addEventListener('keydown', (event) => {
|
||||
if (event.keyCode !== 9) {
|
||||
return;
|
||||
}
|
||||
|
85
src/js/plyr.d.ts
vendored
85
src/js/plyr.d.ts
vendored
@ -214,26 +214,17 @@ declare class Plyr {
|
||||
/**
|
||||
* Add an event listener for the specified event.
|
||||
*/
|
||||
on<K extends keyof Plyr.PlyrEventMap>(
|
||||
event: K,
|
||||
callback: (this: this, event: Plyr.PlyrEventMap[K]) => void,
|
||||
): void;
|
||||
on<K extends keyof Plyr.PlyrEventMap>(event: K, callback: (this: this, event: Plyr.PlyrEventMap[K]) => void): void;
|
||||
|
||||
/**
|
||||
* Add an event listener for the specified event once.
|
||||
*/
|
||||
once<K extends keyof Plyr.PlyrEventMap>(
|
||||
event: K,
|
||||
callback: (this: this, event: Plyr.PlyrEventMap[K]) => void,
|
||||
): void;
|
||||
once<K extends keyof Plyr.PlyrEventMap>(event: K, callback: (this: this, event: Plyr.PlyrEventMap[K]) => void): void;
|
||||
|
||||
/**
|
||||
* Remove an event listener for the specified event.
|
||||
*/
|
||||
off<K extends keyof Plyr.PlyrEventMap>(
|
||||
event: K,
|
||||
callback: (this: this, event: Plyr.PlyrEventMap[K]) => void,
|
||||
): void;
|
||||
off<K extends keyof Plyr.PlyrEventMap>(event: K, callback: (this: this, event: Plyr.PlyrEventMap[K]) => void): void;
|
||||
|
||||
/**
|
||||
* Check support for a mime type.
|
||||
@ -250,45 +241,45 @@ declare namespace Plyr {
|
||||
type MediaType = 'audio' | 'video';
|
||||
type Provider = 'html5' | 'youtube' | 'vimeo';
|
||||
type StandardEventMap = {
|
||||
'progress': PlyrEvent,
|
||||
'playing': PlyrEvent,
|
||||
'play': PlyrEvent,
|
||||
'pause': PlyrEvent,
|
||||
'timeupdate': PlyrEvent,
|
||||
'volumechange': PlyrEvent,
|
||||
'seeking': PlyrEvent,
|
||||
'seeked': PlyrEvent,
|
||||
'ratechange': PlyrEvent,
|
||||
'ended': PlyrEvent,
|
||||
'enterfullscreen': PlyrEvent,
|
||||
'exitfullscreen': PlyrEvent,
|
||||
'captionsenabled': PlyrEvent,
|
||||
'captionsdisabled': PlyrEvent,
|
||||
'languagechange': PlyrEvent,
|
||||
'controlshidden': PlyrEvent,
|
||||
'controlsshown': PlyrEvent,
|
||||
'ready': PlyrEvent
|
||||
progress: PlyrEvent;
|
||||
playing: PlyrEvent;
|
||||
play: PlyrEvent;
|
||||
pause: PlyrEvent;
|
||||
timeupdate: PlyrEvent;
|
||||
volumechange: PlyrEvent;
|
||||
seeking: PlyrEvent;
|
||||
seeked: PlyrEvent;
|
||||
ratechange: PlyrEvent;
|
||||
ended: PlyrEvent;
|
||||
enterfullscreen: PlyrEvent;
|
||||
exitfullscreen: PlyrEvent;
|
||||
captionsenabled: PlyrEvent;
|
||||
captionsdisabled: PlyrEvent;
|
||||
languagechange: PlyrEvent;
|
||||
controlshidden: PlyrEvent;
|
||||
controlsshown: PlyrEvent;
|
||||
ready: PlyrEvent;
|
||||
};
|
||||
// For retrocompatibility, we keep StandadEvent
|
||||
type StandadEvent = keyof Plyr.StandardEventMap;
|
||||
type Html5EventMap = {
|
||||
'loadstart': PlyrEvent,
|
||||
'loadeddata': PlyrEvent,
|
||||
'loadedmetadata': PlyrEvent,
|
||||
'canplay': PlyrEvent,
|
||||
'canplaythrough': PlyrEvent,
|
||||
'stalled': PlyrEvent,
|
||||
'waiting': PlyrEvent,
|
||||
'emptied': PlyrEvent,
|
||||
'cuechange': PlyrEvent,
|
||||
'error': PlyrEvent
|
||||
loadstart: PlyrEvent;
|
||||
loadeddata: PlyrEvent;
|
||||
loadedmetadata: PlyrEvent;
|
||||
canplay: PlyrEvent;
|
||||
canplaythrough: PlyrEvent;
|
||||
stalled: PlyrEvent;
|
||||
waiting: PlyrEvent;
|
||||
emptied: PlyrEvent;
|
||||
cuechange: PlyrEvent;
|
||||
error: PlyrEvent;
|
||||
};
|
||||
// For retrocompatibility, we keep Html5Event
|
||||
type Html5Event = keyof Plyr.Html5EventMap;
|
||||
type YoutubeEventMap = {
|
||||
'statechange': PlyrStateChangeEvent,
|
||||
'qualitychange': PlyrEvent,
|
||||
'qualityrequested': PlyrEvent
|
||||
statechange: PlyrStateChangeEvent;
|
||||
qualitychange: PlyrEvent;
|
||||
qualityrequested: PlyrEvent;
|
||||
};
|
||||
// For retrocompatibility, we keep YoutubeEvent
|
||||
type YoutubeEvent = keyof Plyr.YoutubeEventMap;
|
||||
@ -643,14 +634,14 @@ declare namespace Plyr {
|
||||
PLAYING = 1,
|
||||
PAUSED = 2,
|
||||
BUFFERING = 3,
|
||||
CUED = 5
|
||||
CUED = 5,
|
||||
}
|
||||
|
||||
interface PlyrStateChangeEvent extends CustomEvent {
|
||||
readonly detail: {
|
||||
readonly plyr: Plyr,
|
||||
readonly code: YoutubeState
|
||||
}
|
||||
readonly plyr: Plyr;
|
||||
readonly code: YoutubeState;
|
||||
};
|
||||
}
|
||||
|
||||
interface Support {
|
||||
|
@ -75,8 +75,8 @@ const tasks = {
|
||||
const sizeOptions = { showFiles: true, gzip: true };
|
||||
|
||||
// Clean out /dist
|
||||
gulp.task('clean', done => {
|
||||
const dirs = [paths.plyr.output, paths.demo.output].map(dir => path.join(dir, '**/*'));
|
||||
gulp.task('clean', (done) => {
|
||||
const dirs = [paths.plyr.output, paths.demo.output].map((dir) => path.join(dir, '**/*'));
|
||||
|
||||
// Don't delete the mp4
|
||||
dirs.push(`!${path.join(paths.plyr.output, '**/*.mp4')}`);
|
||||
@ -90,7 +90,7 @@ gulp.task('clean', done => {
|
||||
Object.entries(build.js).forEach(([filename, entry]) => {
|
||||
const { dist, formats, namespace, polyfill, src } = entry;
|
||||
|
||||
formats.forEach(format => {
|
||||
formats.forEach((format) => {
|
||||
const name = `js:${filename}:${format}`;
|
||||
const extension = format === 'es' ? 'mjs' : 'js';
|
||||
tasks.js.push(name);
|
||||
|
@ -27,7 +27,7 @@ const { version } = pkg;
|
||||
const minSuffix = '.min';
|
||||
|
||||
// Get AWS config
|
||||
Object.values(deploy).forEach(target => {
|
||||
Object.values(deploy).forEach((target) => {
|
||||
Object.assign(target, {
|
||||
publisher: publish.create({
|
||||
region: target.region,
|
||||
@ -102,7 +102,7 @@ const localPath = new RegExp('(../)?dist/', 'gi');
|
||||
const versionPath = `https://${deploy.cdn.domain}/${version}/`;
|
||||
const cdnpath = new RegExp(`${deploy.cdn.domain}/${regex}/`, 'gi');
|
||||
|
||||
const renameFile = rename(p => {
|
||||
const renameFile = rename((p) => {
|
||||
p.basename = p.basename.replace(minSuffix, ''); // eslint-disable-line
|
||||
p.dirname = p.dirname.replace('.', version); // eslint-disable-line
|
||||
});
|
||||
@ -120,7 +120,7 @@ const canDeploy = () => {
|
||||
return true;
|
||||
};
|
||||
|
||||
gulp.task('version', done => {
|
||||
gulp.task('version', (done) => {
|
||||
if (!canDeploy()) {
|
||||
done();
|
||||
return null;
|
||||
@ -135,7 +135,7 @@ gulp.task('version', done => {
|
||||
|
||||
return gulp
|
||||
.src(
|
||||
files.map(file => path.join(root, `src/js/${file}`)),
|
||||
files.map((file) => path.join(root, `src/js/${file}`)),
|
||||
{ base: '.' },
|
||||
)
|
||||
.pipe(replace(semver, `v${version}`))
|
||||
@ -144,7 +144,7 @@ gulp.task('version', done => {
|
||||
});
|
||||
|
||||
// Publish version to CDN bucket
|
||||
gulp.task('cdn', done => {
|
||||
gulp.task('cdn', (done) => {
|
||||
if (!canDeploy()) {
|
||||
done();
|
||||
return null;
|
||||
@ -198,7 +198,7 @@ gulp.task('purge', () => {
|
||||
.on('end', () => {
|
||||
const purge = new FastlyPurge(fastly.token);
|
||||
|
||||
list.forEach(url => {
|
||||
list.forEach((url) => {
|
||||
log(`Purging ${ansi.cyan(url)}...`);
|
||||
|
||||
purge.url(url, (error, result) => {
|
||||
@ -213,7 +213,7 @@ gulp.task('purge', () => {
|
||||
});
|
||||
|
||||
// Publish to demo bucket
|
||||
gulp.task('demo', done => {
|
||||
gulp.task('demo', (done) => {
|
||||
if (!canDeploy()) {
|
||||
done();
|
||||
return null;
|
||||
@ -248,7 +248,7 @@ gulp.task('demo', done => {
|
||||
.src(pages)
|
||||
.pipe(replace(localPath, versionPath))
|
||||
.pipe(
|
||||
rename(p => {
|
||||
rename((p) => {
|
||||
if (options.demo.uploadPath) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
p.dirname += options.demo.uploadPath;
|
||||
|
Loading…
x
Reference in New Issue
Block a user