Skip to content

Commit 2682121

Browse files
authored
Merge pull request #192 from benjiwheeler/update-eslint
chore: update eslint version, modify hasOwnProperty calls
2 parents e4c9acd + 03b61b3 commit 2682121

File tree

8 files changed

+41701
-12
lines changed

8 files changed

+41701
-12
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cache:
44
directories:
55
- node_modules
66
node_js:
7-
- "8"
7+
- "10"
88
- "node"
99
install:
1010
- npm install

package-lock.json

Lines changed: 41690 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@
3838
"@commitlint/cli": "8.2.0",
3939
"@commitlint/config-conventional": "8.2.0",
4040
"@commitlint/travis-cli": "8.2.0",
41-
"babel-eslint": "10.0.3",
41+
"babel-eslint": "10.1.0",
4242
"babel-loader": "^8.0.4",
4343
"cz-conventional-changelog": "^3.0.2",
44-
"eslint": "5.7.0",
45-
"eslint-config-scratch": "5.1.0",
46-
"eslint-plugin-react": "7.12.4",
44+
"eslint": "^7.13.0",
45+
"eslint-config-scratch": "^6.0.0",
46+
"eslint-plugin-react": "^7.20.0",
4747
"file-loader": "4.1.0",
4848
"husky": "1.3.1",
4949
"json": "^9.0.4",

src/Asset.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ if (typeof TextDecoder === 'undefined' || typeof TextEncoder === 'undefined') {
99
_TextDecoder = encoding.TextDecoder;
1010
_TextEncoder = encoding.TextEncoder;
1111
} else {
12-
/* global TextDecoder TextEncoder */
1312
_TextDecoder = TextDecoder;
1413
_TextEncoder = TextEncoder;
1514
}
@@ -35,7 +34,7 @@ const memoizedToString = (function () {
3534

3635
const strings = {};
3736
return (assetId, data) => {
38-
if (!strings.hasOwnProperty(assetId)) {
37+
if (!Object.prototype.hasOwnProperty.call(strings, assetId)) {
3938
if (typeof btoa === 'undefined') {
4039
// Use a library that does not need btoa to run.
4140
/* eslint-disable-next-line global-require */

src/BuiltinHelper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class BuiltinHelper extends Helper {
8686
*/
8787
get (assetId) {
8888
let asset = null;
89-
if (this.assets.hasOwnProperty(assetId)) {
89+
if (Object.prototype.hasOwnProperty.call(this.assets, assetId)) {
9090
/** @type{BuiltinAssetRecord} */
9191
const assetRecord = this.assets[assetId];
9292
asset = new Asset(assetRecord.type, assetRecord.id, assetRecord.format, assetRecord.data);
@@ -133,7 +133,7 @@ class BuiltinHelper extends Helper {
133133
_store (assetType, dataFormat, data, id) {
134134
if (!dataFormat) throw new Error('Data cached without specifying its format');
135135
if (id !== '' && id !== null && typeof id !== 'undefined') {
136-
if (this.assets.hasOwnProperty(id) && assetType.immutable) return id;
136+
if (Object.prototype.hasOwnProperty.call(this.assets, id) && assetType.immutable) return id;
137137
} else if (assetType.immutable) {
138138
id = md5(data);
139139
} else {

src/ScratchStorage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class ScratchStorage {
145145
* @return {?string} The ID of the default asset of the given type, if any.
146146
*/
147147
getDefaultAssetId (type) {
148-
if (this.defaultAssetId.hasOwnProperty(type.name)) {
148+
if (Object.prototype.hasOwnProperty.call(this.defaultAssetId, type.name)) {
149149
return this.defaultAssetId[type.name];
150150
}
151151
}

src/WebHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class WebHelper extends Helper {
149149

150150
const method = create ? 'post' : 'put';
151151

152-
if (!store) return Promise.reject('No appropriate stores');
152+
if (!store) return Promise.reject(new Error('No appropriate stores'));
153153

154154
let tool = this.assetTool;
155155
if (assetType.name === 'Project') {

test/unit/add-helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class LoggingHelper {
3232
this.logContainer.push(this.label);
3333
return this.shouldSucceed ?
3434
Promise.resolve(new this.storage.Asset(assetType, assetId, dataFormat, Buffer.from(this.label))) :
35-
Promise.reject(`This is an expected failure from ${this.label}`);
35+
Promise.reject(new Error(`This is an expected failure from ${this.label}`));
3636
}
3737
}
3838

0 commit comments

Comments
 (0)