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 browser: true
amd: 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: rules:
block-spacing: ["error"] block-spacing: ["error"]
brace-style: ["error"] brace-style: ["error"]
@ -11,17 +57,13 @@ rules:
eol-last: ["error"] eol-last: ["error"]
indent: ["error", 4, { "SwitchCase": 1 }] indent: ["error", 4, { "SwitchCase": 1 }]
keyword-spacing: ["error"] keyword-spacing: ["error"]
line-comment-position: ["off"]
max-statements-per-line: ["error"] max-statements-per-line: ["error"]
no-empty: ["error"]
no-extra-semi: ["error"]
no-floating-decimal: ["error"] no-floating-decimal: ["error"]
no-multi-spaces: ["error"] no-multi-spaces: ["error"]
no-multiple-empty-lines: ["error", { "max": 1 }] no-multiple-empty-lines: ["error", { "max": 1 }]
no-redeclare: ["warn"]
no-trailing-spaces: ["error"] no-trailing-spaces: ["error"]
no-void: ["off"] no-unused-vars: ["warn"]
no-useless-escape: ["warn"]
one-var: ["error", "never"] one-var: ["error", "never"]
padding-line-between-statements: ["off"]
semi: ["off"]
space-before-blocks: ["error"] 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) { return new Promise(function (resolve, reject) {
require(['shaka'], function () { require(['shaka'], function () {
/* globals shaka */
var player = new shaka.Player(elem); var player = new shaka.Player(elem);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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