Add eslint:recommended and update rules and globals

This commit is contained in:
Bill Thornton 2020-02-25 18:33:38 -05:00
parent c4c3078e06
commit f7997d5270
8 changed files with 56 additions and 7 deletions

View File

@ -3,6 +3,52 @@ env:
browser: true
amd: true
globals:
# New browser globals
DataView: readonly
MediaMetadata: readonly
Promise: readonly
# Deprecated browser globals
DocumentTouch: readonly
# Tizen globals
tizen: readonly
webapis: readonly
# WebOS globals
webOS: readonly
# Dependency globals
$: readonly
jQuery: readonly
queryString: readonly
requirejs: readonly
# Jellyfin globals
ApiClient: writable
AppInfo: writable
chrome: writable
ConnectionManager: writable
DlnaProfilePage: writable
Dashboard: writable
DashboardPage: writable
Emby: readonly
Events: writable
getParameterByName: writable
getWindowLocationSearch: writable
Globalize: writable
Hls: writable
humaneDate: writable
humaneElapsed: writable
LibraryMenu: writable
LinkParser: writable
LiveTvHelpers: writable
MetadataEditor: writable
pageClassOn: writable
pageIdOn: writable
PlaylistViewer: writable
UserParentalControlPage: writable
Windows: readonly
extends:
- eslint:recommended
rules:
block-spacing: ["error"]
brace-style: ["error"]
@ -11,17 +57,13 @@ rules:
eol-last: ["error"]
indent: ["error", 4, { "SwitchCase": 1 }]
keyword-spacing: ["error"]
line-comment-position: ["off"]
max-statements-per-line: ["error"]
no-empty: ["error"]
no-extra-semi: ["error"]
no-floating-decimal: ["error"]
no-multi-spaces: ["error"]
no-multiple-empty-lines: ["error", { "max": 1 }]
no-redeclare: ["warn"]
no-trailing-spaces: ["error"]
no-void: ["off"]
no-unused-vars: ["warn"]
no-useless-escape: ["warn"]
one-var: ["error", "never"]
padding-line-between-statements: ["off"]
semi: ["off"]
space-before-blocks: ["error"]
yoda: ["off"]

View File

@ -357,6 +357,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
return new Promise(function (resolve, reject) {
require(['shaka'], function () {
/* globals shaka */
var player = new shaka.Player(elem);

View File

@ -12,6 +12,7 @@ if (HTMLElement.prototype.nativeFocus === undefined) {
}, true);
var opts = Object.defineProperty({}, "preventScroll", {
// eslint-disable-next-line getter-return
get: function () {
supportsPreventScrollOption = true;
}

View File

@ -11,6 +11,7 @@ if (typeof Object.assign != 'function') {
var source = arguments[index];
if (source !== undefined && source !== null) {
for (var nextKey in source) {
// eslint-disable-next-line no-prototype-builtins
if (source.hasOwnProperty(nextKey)) {
output[nextKey] = source[nextKey];
}

View File

@ -1,3 +1,4 @@
/* eslint-env serviceworker */
(function () {
'use strict';

View File

@ -162,6 +162,7 @@ define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdr
function playSound(path, volume) {
lastSound = new Date().getTime();
require(['howler'], function (howler) {
/* globals Howl */
try {
var sound = new Howl({
src: [path],

View File

@ -1,5 +1,6 @@
define(['require', 'events', 'browser', 'appRouter', 'loading'], function (require, events, browser, appRouter, loading) {
"use strict";
/* globals YT */
function zoomIn(elem, iterations) {
var keyframes = [

View File

@ -1 +1,2 @@
/* eslint-env serviceworker */
importScripts("components/serviceworker/notifications.js");