Skip to content

Commit

Permalink
Merge pull request #723 from seotts/update-eslint
Browse files Browse the repository at this point in the history
Update eslint, babel-eslint, and eslint-scratch-config and fix resulting errors
  • Loading branch information
Sarah Otts authored Nov 10, 2020
2 parents 527733c + 00710f3 commit 50b4ccd
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
},
"devDependencies": {
"babel-core": "^6.23.1",
"babel-eslint": "^8.2.1",
"babel-eslint": "^10.1.0",
"babel-loader": "^7.1.4",
"babel-polyfill": "^6.22.0",
"babel-preset-env": "^1.6.1",
"copy-webpack-plugin": "^4.5.1",
"docdash": "^0.4.0",
"eslint": "^4.6.1",
"eslint-config-scratch": "^5.0.0",
"eslint": "^7.13.0",
"eslint-config-scratch": "^6.0.0",
"gh-pages": "^1.0.0",
"jsdoc": "^3.6.0",
"json": "^9.0.4",
Expand Down
14 changes: 7 additions & 7 deletions src/RenderWebGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ class RenderWebGL extends EventEmitter {
* @returns {int} The ID of the new Drawable.
*/
createDrawable (group) {
if (!group || !this._layerGroups.hasOwnProperty(group)) {
if (!group || !Object.prototype.hasOwnProperty.call(this._layerGroups, group)) {
log.warn('Cannot create a drawable without a known layer group');
return;
}
Expand Down Expand Up @@ -542,7 +542,7 @@ class RenderWebGL extends EventEmitter {
* @param {string} group Group name that the drawable belongs to
*/
destroyDrawable (drawableID, group) {
if (!group || !this._layerGroups.hasOwnProperty(group)) {
if (!group || !Object.prototype.hasOwnProperty.call(this._layerGroups, group)) {
log.warn('Cannot destroy drawable without known layer group.');
return;
}
Expand Down Expand Up @@ -596,7 +596,7 @@ class RenderWebGL extends EventEmitter {
* @return {?number} New order if changed, or null.
*/
setDrawableOrder (drawableID, order, group, optIsRelative, optMin) {
if (!group || !this._layerGroups.hasOwnProperty(group)) {
if (!group || !Object.prototype.hasOwnProperty.call(this._layerGroups, group)) {
log.warn('Cannot set the order of a drawable without a known layer group.');
return;
}
Expand Down Expand Up @@ -650,7 +650,7 @@ class RenderWebGL extends EventEmitter {

twgl.bindFramebufferInfo(gl, null);
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
gl.clearColor.apply(gl, this._backgroundColor4f);
gl.clearColor(...this._backgroundColor4f);
gl.clear(gl.COLOR_BUFFER_BIT);

this._drawThese(this._drawList, ShaderManager.DRAW_MODE.default, this._projection);
Expand Down Expand Up @@ -1124,7 +1124,7 @@ class RenderWebGL extends EventEmitter {

let hit = RenderConstants.ID_NONE;
for (const hitID in hits) {
if (hits.hasOwnProperty(hitID) && (hits[hitID] > hits[hit])) {
if (Object.prototype.hasOwnProperty.call(hits, hitID) && (hits[hitID] > hits[hit])) {
hit = hitID;
}
}
Expand Down Expand Up @@ -1379,7 +1379,7 @@ class RenderWebGL extends EventEmitter {
gl.viewport(0, 0, bounds.width, bounds.height);
const projection = twgl.m4.ortho(bounds.left, bounds.right, bounds.top, bounds.bottom, -1, 1);

gl.clearColor.apply(gl, this._backgroundColor4f);
gl.clearColor(...this._backgroundColor4f);
gl.clear(gl.COLOR_BUFFER_BIT);
this._drawThese(this._drawList, ShaderManager.DRAW_MODE.default, projection);

Expand Down Expand Up @@ -1873,7 +1873,7 @@ class RenderWebGL extends EventEmitter {
const uniforms = {};

let effectBits = drawable.enabledEffects;
effectBits &= opts.hasOwnProperty('effectMask') ? opts.effectMask : effectBits;
effectBits &= Object.prototype.hasOwnProperty.call(opts, 'effectMask') ? opts.effectMask : effectBits;
const newShader = this._shaderManager.getShader(drawMode, effectBits);

// Manually perform region check. Do not create functions inside a
Expand Down
2 changes: 1 addition & 1 deletion src/ShaderManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ShaderManager {
*/
this._shaderCache = {};
for (const modeName in ShaderManager.DRAW_MODE) {
if (ShaderManager.DRAW_MODE.hasOwnProperty(modeName)) {
if (Object.prototype.hasOwnProperty.call(ShaderManager.DRAW_MODE, modeName)) {
this._shaderCache[modeName] = [];
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/playground/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ image.src = 'https://cdn.assets.scratch.mit.edu/internalapi/asset/7e24c99c1b853e

// SVG (cat 1-a)
const xhr = new XMLHttpRequest();
xhr.addEventListener('load', function () {
xhr.addEventListener('load', () => {
const skinId = renderer.createSVGSkin(xhr.responseText);
if (wantedSkin === WantedSkinType.vector) {
renderer.updateDrawableProperties(drawableID2, {
Expand All @@ -56,10 +56,10 @@ if (wantedSkin === WantedSkinType.pen) {
});

canvas.addEventListener('click', event => {
let rect = canvas.getBoundingClientRect();
const rect = canvas.getBoundingClientRect();

let x = event.clientX - rect.left;
let y = event.clientY - rect.top;
const x = event.clientX - rect.left;
const y = event.clientY - rect.top;

renderer.penLine(penSkinID, {
color4f: [Math.random(), Math.random(), Math.random(), 1],
Expand Down Expand Up @@ -184,7 +184,7 @@ canvas.addEventListener('mousemove', event => {
canvas.addEventListener('click', event => {
const mousePos = getMousePosition(event, canvas);
const pickID = renderer.pick(mousePos.x, mousePos.y);
console.log('You clicked on ' + (pickID < 0 ? 'nothing' : 'ID# ' + pickID));
console.log(`You clicked on ${(pickID < 0 ? 'nothing' : `ID# ${pickID}`)}`);
if (pickID >= 0) {
console.dir(renderer.extractDrawable(pickID, mousePos.x, mousePos.y));
}
Expand Down
6 changes: 3 additions & 3 deletions src/playground/queryPlayground.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ renderCanvas.addEventListener('click', event => {
}
});

const rgb2fillStyle = (rgb) => {
return `rgb(${rgb[0]},${rgb[1]},${rgb[2]})`;
};
const rgb2fillStyle = rgb => (
`rgb(${rgb[0]},${rgb[1]},${rgb[2]})`
);

const makeCursorImage = () => {
const canvas = document.createElement('canvas');
Expand Down
2 changes: 1 addition & 1 deletion test/helper/page-util.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global window, VirtualMachine, ScratchStorage, ScratchSVGRenderer */
/* global VirtualMachine, ScratchStorage, ScratchSVGRenderer */
/* eslint-env browser */

// Wait for all SVG skins to be loaded.
Expand Down
2 changes: 1 addition & 1 deletion test/integration/pick-tests.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global vm, render, Promise */
/* global vm, render */
const {chromium} = require('playwright-chromium');
const test = require('tap').test;
const path = require('path');
Expand Down
2 changes: 1 addition & 1 deletion test/integration/scratch-tests.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global vm, Promise */
/* global vm */
const {chromium} = require('playwright-chromium');
const test = require('tap').test;
const path = require('path');
Expand Down

0 comments on commit 50b4ccd

Please sign in to comment.