web: Cleanup ESLint configuration
* Cleanup .eslintrc.json files. * Avoid unnecessary eslint-* directives.
This commit is contained in:
parent
e8ec02418b
commit
f8a8b82c04
|
@ -10,10 +10,6 @@
|
|||
"commonjs": true
|
||||
},
|
||||
"rules": {
|
||||
"no-console": "off",
|
||||
"no-constant-condition": ["error", { "checkLoops": false }]
|
||||
},
|
||||
"globals": {
|
||||
"navigator": true
|
||||
"no-console": "off"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
"env": {
|
||||
"browser": true
|
||||
},
|
||||
"globals": {
|
||||
"__webpack_public_path__": true
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": [
|
||||
"@typescript-eslint", "jsdoc"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* eslint @typescript-eslint/naming-convention:off */
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
declare let __webpack_public_path__: string;
|
||||
|
||||
interface Error {
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
||||
/* eslint @typescript-eslint/ban-types: "off" */
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
Prototype?: any;
|
||||
Prototype?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,9 +12,9 @@ declare global {
|
|||
* https://tc39.github.io/ecma262/#sec-array.prototype.reduce
|
||||
*
|
||||
*/
|
||||
function polyfillArrayPrototypeReduce(): any {
|
||||
function polyfillArrayPrototypeReduce() {
|
||||
Object.defineProperty(Array.prototype, "reduce", {
|
||||
value: function (...args: any) {
|
||||
value(...args: unknown[]) {
|
||||
if (
|
||||
args.length === 0 &&
|
||||
window.Prototype &&
|
||||
|
@ -99,14 +96,14 @@ function tryPolyfillReflect(): void {
|
|||
}
|
||||
if (typeof Reflect.get !== "function") {
|
||||
Object.defineProperty(Reflect, "get", {
|
||||
value: function (target: any, key: any) {
|
||||
value<T>(target: T, key: keyof T) {
|
||||
return target[key];
|
||||
},
|
||||
});
|
||||
}
|
||||
if (typeof Reflect.set !== "function") {
|
||||
Object.defineProperty(Reflect, "set", {
|
||||
value: function (target: any, key: any, value: any) {
|
||||
value<T>(target: T, key: keyof T, value: T[keyof T]) {
|
||||
target[key] = value;
|
||||
},
|
||||
});
|
||||
|
@ -119,6 +116,7 @@ function tryPolyfillReflect(): void {
|
|||
* @param func The function to test.
|
||||
* @returns True if the function hasn't been overridden.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
function isNativeFunction(func: Function): boolean {
|
||||
const val =
|
||||
typeof Function.prototype.toString === "function"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
||||
|
||||
/**
|
||||
* Conditional ruffle loader
|
||||
*/
|
||||
|
@ -17,7 +15,7 @@ import { setPolyfillsOnLoad } from "./js-polyfills";
|
|||
* @returns A ruffle constructor that may be used to create new Ruffle
|
||||
* instances.
|
||||
*/
|
||||
async function fetchRuffle(): Promise<{ new (...args: any[]): Ruffle }> {
|
||||
async function fetchRuffle(): Promise<typeof Ruffle> {
|
||||
// Apply some pure JavaScript polyfills to prevent conflicts with external
|
||||
// libraries, if needed.
|
||||
setPolyfillsOnLoad();
|
||||
|
@ -33,7 +31,7 @@ async function fetchRuffle(): Promise<{ new (...args: any[]): Ruffle }> {
|
|||
return Ruffle;
|
||||
}
|
||||
|
||||
let lastLoaded: Promise<{ new (...args: any[]): Ruffle }> | null = null;
|
||||
let lastLoaded: Promise<typeof Ruffle> | null = null;
|
||||
|
||||
/**
|
||||
* Obtain an instance of `Ruffle`.
|
||||
|
@ -43,7 +41,7 @@ let lastLoaded: Promise<{ new (...args: any[]): Ruffle }> | null = null;
|
|||
* @returns A ruffle constructor that may be used to create new Ruffle
|
||||
* instances.
|
||||
*/
|
||||
export function loadRuffle(): Promise<{ new (...args: any[]): Ruffle }> {
|
||||
export function loadRuffle(): Promise<typeof Ruffle> {
|
||||
if (lastLoaded == null) {
|
||||
lastLoaded = fetchRuffle();
|
||||
}
|
||||
|
|
|
@ -132,8 +132,7 @@ export class RufflePlayer extends HTMLElement {
|
|||
private _metadata: MovieMetadata | null;
|
||||
private _readyState: ReadyState;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private ruffleConstructor: Promise<{ new (...args: any[]): Ruffle }>;
|
||||
private ruffleConstructor: Promise<typeof Ruffle>;
|
||||
private panicked = false;
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-non-null-assertion": "off"
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_" }]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,10 +67,7 @@ function disable() {
|
|||
}
|
||||
|
||||
utils.storage.onChanged.addListener((changes, namespace) => {
|
||||
if (
|
||||
namespace === "sync" &&
|
||||
Object.prototype.hasOwnProperty.call(changes, "ruffleEnable")
|
||||
) {
|
||||
if (namespace === "sync" && "ruffleEnable" in changes) {
|
||||
if (changes.ruffleEnable.newValue) {
|
||||
enable();
|
||||
} else {
|
||||
|
|
|
@ -79,16 +79,15 @@ async function queryTabStatus(
|
|||
optionsChanged();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function objectsEqual(x: any, y: any) {
|
||||
function objectsEqual<T>(x: T, y: T) {
|
||||
for (const [key, value] of Object.entries(x)) {
|
||||
if (y[key] !== value) {
|
||||
if (y[key as keyof T] !== value) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(y)) {
|
||||
if (x[key] !== value) {
|
||||
if (x[key as keyof T] !== value) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true
|
||||
},
|
||||
"globals": {
|
||||
"__webpack_public_path__": true
|
||||
},
|
||||
"ignorePatterns": ["swfobject.js"]
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true
|
||||
},
|
||||
"globals": {
|
||||
"__webpack_public_path__": "writable"
|
||||
}
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
{
|
||||
"env": {
|
||||
"node": true,
|
||||
"browser": true,
|
||||
"mocha": true
|
||||
},
|
||||
"globals": {
|
||||
"browser": true
|
||||
"browser": "readonly"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"ignorePatterns": ["swfobject.js"]
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-env node */
|
||||
|
||||
let chrome_binary = undefined;
|
||||
|
||||
if (process.platform === "win32" && process.env.CI) {
|
||||
|
|
Loading…
Reference in New Issue