Added eslint rules. Fixed incorrect ES6 use.

This commit is contained in:
Richard Davey 2018-06-11 09:05:52 +01:00
parent 5889737183
commit 0b8915520b
5 changed files with 37 additions and 5 deletions

View file

@ -5,17 +5,41 @@
"es6": true,
"commonjs": true
},
"extends": "eslint:recommended",
"plugins": [
"es5"
],
"extends": [
"eslint:recommended"
],
"globals": {
"WEBGL_RENDERER": true,
"CANVAS_RENDERER": true,
"Phaser": true,
"p2": true,
"process": true,
"ActiveXObject": true
},
"rules": {
"es5/no-arrow-functions": 2,
"es5/no-binary-and-octal-literals": 2,
"es5/no-block-scoping": 2,
"es5/no-classes": 2,
"es5/no-computed-properties": 2,
"es5/no-default-parameters": 2,
"es5/no-destructuring": 2,
"es5/no-es6-static-methods": 2,
"es5/no-for-of": 2,
"es5/no-generators": 2,
"es5/no-modules": 2,
"es5/no-object-super": 2,
"es5/no-rest-parameters": 2,
"es5/no-shorthand-properties": 2,
"es5/no-spread": 2,
"es5/no-template-literals": 2,
"es5/no-typeof-symbol": 2,
"es5/no-unicode-code-point-escape": 2,
"es5/no-unicode-regex": 2,
"no-cond-assign": [ "error", "except-parens" ],
"no-duplicate-case": [ "error" ],

View file

@ -121,12 +121,13 @@ TODO - Out of Canvas events
* If you set Phaser to use a pre-existing Canvas element it is no longer re-added to the DOM (thanks @NQNStudios)
* The `TweenManager.getTweensOf` method has been fixed to remove a potential endless loop should multiple targets be passed in to it (thanks @cyantree)
* Interactive Objects inside of Containers would still fire their input events even if the Container (or any ancestor) was set to be invisible. Objects now check their ancestor tree during the input cull and now properly skip input events if not visible. Fix #3620 (thanks @NemoStein)
* Fixed Device.os incorrectly reporting Linux as OS on Android devices (thanks @AleBles)
### Examples, Documentation and TypeScript
Thanks to the work of @hexus we have now documented all of the Math namespace and made good progress on the Game Objects.
I personally have also documented the entire Input system, which was 328 classes, properties and methods to describe.
I personally have also documented the entire Input system, which was 328 classes, properties and methods to describe, as well as lots of other areas.
## Version 3.9.0 - Yui - 24th May 2018

8
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "phaser",
"version": "3.9.0-beta1",
"version": "3.10.0-beta1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -2411,6 +2411,12 @@
"text-table": "0.2.0"
}
},
"eslint-plugin-es5": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-es5/-/eslint-plugin-es5-1.3.1.tgz",
"integrity": "sha512-2oq0R/3XoAsiMwllwsHmnk0gA7+KSvRHUAiJ7Pa/iKrClywVd1q/G7LDZHXU5YD+9kVNxlK155ElXrmX8uLW8A==",
"dev": true
},
"eslint-scope": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz",

View file

@ -40,6 +40,7 @@
"devDependencies": {
"clean-webpack-plugin": "^0.1.19",
"eslint": "^4.19.1",
"eslint-plugin-es5": "^1.3.1",
"fs-extra": "^6.0.0",
"node-sloc": "^0.1.10",
"uglifyjs-webpack-plugin": "^1.2.5",

View file

@ -56,7 +56,7 @@ var Parse2DArray = function (name, data, tileWidth, tileHeight, insertNull)
{
var tileIndex = parseInt(row[x], 10);
if (Number.isNaN(tileIndex) || tileIndex === -1)
if (isNaN(tileIndex) || tileIndex === -1)
{
tiles[y][x] = insertNull
? null