diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 074e996605..0000000000 --- a/.eslintignore +++ /dev/null @@ -1,21 +0,0 @@ -src/phaser-esm.js -src/phaser-arcade-physics.js -src/animations/config.json -src/physics/matter-js/lib/ -src/physics/matter-js/poly-decomp/ -src/polyfills/ -src/renderer/webgl/shaders/ -src/geom/polygon/Earcut.js -src/utils/array/StableSort.js -src/utils/object/Extend.js -src/structs/RTree.js -plugins/spine/dist/ -plugins/spine/src/runtimes/ -scripts/ -webpack.* -webpack.config.js -webpack-nospector.config.js -webpack.dist.config.js -webpack.fb.config.js -webpack.fb.dist.config.js -build/ diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index c0c33cfeab..0000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "root": true, - "env": { - "browser": true, - "es6": true, - "commonjs": true - }, - "plugins": [ - "es5" - ], - "extends": [ - "eslint:recommended" - ], - "globals": { - "WEBGL_RENDERER": true, - "CANVAS_RENDERER": true, - "Phaser": 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-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" ], - "no-unused-vars": [ "error", { "args": "none" } ], - - "accessor-pairs": "error", - "curly": "error", - "eqeqeq": [ "error", "smart" ], - "no-alert": "error", - "no-caller": "error", - "no-console": [ "error", { "allow": ["warn", "log"] } ], - "no-floating-decimal": "error", - "no-invalid-this": "error", - "no-multi-spaces": "error", - "no-multi-str": "error", - "no-new-func": "error", - "no-new-wrappers": "error", - "no-redeclare": "error", - "no-self-assign": "error", - "no-self-compare": "error", - "yoda": [ "error", "never" ], - - "array-bracket-spacing": [ "error", "always" ], - "block-spacing": [ "error", "always" ], - "brace-style": [ "error", "allman", { "allowSingleLine": true } ], - "camelcase": "error", - "comma-dangle": [ "error", "never" ], - "comma-style": [ "error", "last" ], - "computed-property-spacing": [ "error", "never" ], - "consistent-this": [ "error", "_this" ], - "eol-last": [ "error" ], - "func-call-spacing": [ "error", "never" ], - "indent": [ "error", 4, { "SwitchCase": 1 } ], - "key-spacing": [ "error", { "beforeColon": false, "afterColon": true } ], - "keyword-spacing": [ "error", { "after": true } ], - "linebreak-style": [ "off" ], - "lines-around-comment": [ "error", { "beforeBlockComment": true, "afterBlockComment": false, "beforeLineComment": true, "afterLineComment": false, "allowBlockStart": true, "allowBlockEnd": false, "allowObjectStart": true, "allowArrayStart": true }], - "new-parens": "error", - "no-constant-condition": 0, - "no-array-constructor": "error", - "no-lonely-if": "error", - "no-mixed-spaces-and-tabs": "error", - "no-plusplus": "off", - "no-prototype-builtins": "off", - "no-trailing-spaces": [ "error", { "skipBlankLines": true, "ignoreComments": true } ], - "no-underscore-dangle": "off", - "no-whitespace-before-property": "error", - "object-curly-newline": [ "error", { "multiline": true, "minProperties": 0, "consistent": true } ], - "one-var-declaration-per-line": [ "error", "initializations" ], - "quote-props": [ "error", "as-needed" ], - "quotes": [ "error", "single" ], - "semi-spacing": [ "error", { "before": false, "after": true } ], - "semi": [ "error", "always" ], - "space-before-blocks": "error", - "space-before-function-paren": "error", - "space-in-parens": [ "error", "never" ], - "space-infix-ops": [ "error", { "int32Hint": true } ], - "wrap-regex": "error", - "spaced-comment": [ "error", "always", { "block": { "balanced": true, "exceptions": ["*", "!"] }} ], - "no-irregular-whitespace": ["error", { "skipComments": true }] - } -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000000..88d7c00e6a --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,184 @@ +// eslint.config.mjs +import { defineConfig } from 'eslint/config'; +import js from '@eslint/js'; +import globals from 'globals'; +import es5Plugin from 'eslint-plugin-es5'; +import { fixupPluginRules } from '@eslint/compat'; + +const projectGlobals = { + WEBGL_RENDERER: 'writable', + CANVAS_RENDERER: 'writable', + Phaser: 'writable', + process: 'writable', + ActiveXObject: 'writable' +}; + +const es5Rules = { + 'es5/no-arrow-functions': 'error', + 'es5/no-binary-and-octal-literals': 'error', + 'es5/no-block-scoping': 'error', + 'es5/no-classes': 'error', + 'es5/no-computed-properties': 'error', + 'es5/no-default-parameters': 'error', + 'es5/no-destructuring': 'error', + 'es5/no-for-of': 'error', + 'es5/no-generators': 'error', + 'es5/no-modules': 'error', + 'es5/no-object-super': 'error', + 'es5/no-rest-parameters': 'error', + 'es5/no-shorthand-properties': 'error', + 'es5/no-spread': 'error', + 'es5/no-template-literals': 'error', + 'es5/no-typeof-symbol': 'error', + 'es5/no-unicode-code-point-escape': 'error', + 'es5/no-unicode-regex': 'error' +}; + +const phaserRules = { + 'no-cond-assign': [ 'error', 'except-parens' ], + 'no-duplicate-case': [ 'error' ], + 'no-unused-vars': [ 'error', { args: 'none', caughtErrors: 'none' } ], + + 'accessor-pairs': 'error', + curly: 'error', + eqeqeq: [ 'error', 'smart' ], + 'no-alert': 'error', + 'no-caller': 'error', + 'no-console': [ 'error', { allow: [ 'warn', 'log' ] } ], + 'no-floating-decimal': 'error', + 'no-invalid-this': 'error', + 'no-multi-spaces': 'error', + 'no-multi-str': 'error', + 'no-new-func': 'error', + 'no-new-wrappers': 'error', + 'no-redeclare': 'error', + 'no-self-assign': 'error', + 'no-self-compare': 'error', + yoda: [ 'error', 'never' ], + + 'array-bracket-spacing': [ 'error', 'always' ], + 'block-spacing': [ 'error', 'always' ], + 'brace-style': [ 'error', 'allman', { allowSingleLine: true } ], + camelcase: 'error', + 'comma-dangle': [ 'error', 'never' ], + 'comma-style': [ 'error', 'last' ], + 'computed-property-spacing': [ 'error', 'never' ], + 'consistent-this': [ 'error', '_this' ], + 'eol-last': [ 'error' ], + 'func-call-spacing': [ 'error', 'never' ], + indent: [ 'error', 4, { SwitchCase: 1 } ], + 'key-spacing': [ 'error', { beforeColon: false, afterColon: true } ], + 'keyword-spacing': [ 'error', { after: true } ], + 'linebreak-style': [ 'off' ], + 'lines-around-comment': [ + 'error', + { + beforeBlockComment: true, + afterBlockComment: false, + beforeLineComment: true, + afterLineComment: false, + allowBlockStart: true, + allowBlockEnd: false, + allowObjectStart: true, + allowArrayStart: true + } + ], + 'new-parens': 'error', + 'no-constant-condition': 'off', + 'no-array-constructor': 'error', + 'no-lonely-if': 'error', + 'no-mixed-spaces-and-tabs': 'error', + 'no-plusplus': 'off', + 'no-prototype-builtins': 'off', + 'no-trailing-spaces': [ + 'error', + { + skipBlankLines: true, + ignoreComments: true + } + ], + 'no-underscore-dangle': 'off', + 'no-whitespace-before-property': 'error', + 'object-curly-newline': [ + 'error', + { + multiline: true, + minProperties: 0, + consistent: true + } + ], + 'one-var-declaration-per-line': [ 'error', 'initializations' ], + 'quote-props': [ 'error', 'as-needed' ], + quotes: [ 'error', 'single' ], + 'semi-spacing': [ 'error', { before: false, after: true } ], + semi: [ 'error', 'always' ], + 'space-before-blocks': 'error', + 'space-before-function-paren': 'error', + 'space-in-parens': [ 'error', 'never' ], + 'space-infix-ops': [ 'error', { int32Hint: true } ], + 'wrap-regex': 'error', + 'spaced-comment': [ + 'error', + 'always', + { + block: { + balanced: true, + exceptions: [ '*', '!' ] + } + } + ], + 'no-irregular-whitespace': [ 'error', { skipComments: true } ], + 'no-extra-semi': 'error', + 'no-useless-assignment': 'off', + 'no-constant-binary-expression': 'off' +}; + +export default defineConfig([ + { + ignores: [ + 'node_modules/**', + 'dist/**', + 'build/**', + 'coverage/**', + 'src/phaser-esm.js', + 'src/phaser-arcade-physics.js', + 'src/physics/matter-js/lib/**', + 'src/physics/matter-js/poly-decomp/**', + 'src/polyfills/**', + 'src/renderer/webgl/shaders/**', + 'src/geom/polygon/Earcut.js', + 'src/utils/array/StableSort.js', + 'src/utils/object/Extend.js', + 'src/structs/RTree.js', + 'plugins/spine/dist/**', + 'plugins/spine/src/runtimes/**', + 'scripts/**' + ] + }, + + js.configs.recommended, + + { + files: [ '**/*.js' ], + + languageOptions: { + ecmaVersion: 6, + sourceType: 'commonjs', + globals: { + ...globals.browser, + ...globals.es2015, + ...globals.commonjs, + ...projectGlobals + } + }, + + plugins: { + es5: fixupPluginRules(es5Plugin) + }, + + rules: { + ...es5Rules, + ...phaserRules + } + } +]); diff --git a/package-lock.json b/package-lock.json index 02280c70b9..5864a00aa7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,19 @@ { "name": "phaser", - "version": "4.0.0", + "version": "4.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "phaser", - "version": "4.0.0", + "version": "4.1.0", "license": "MIT", "dependencies": { "eventemitter3": "^5.0.4" }, "devDependencies": { + "@eslint/compat": "2.1.0", + "@eslint/js": "10.0.1", "@types/offscreencanvas": "^2019.7.3", "@types/source-map": "^0.5.7", "clean-webpack-plugin": "^4.0.0", @@ -20,6 +22,7 @@ "eslint-plugin-es5": "^1.5.0", "exports-loader": "^5.0.0", "fs-extra": "^11.3.4", + "globals": "17.6.0", "imports-loader": "^5.0.0", "jsdoc": "3.x.x", "jsdom": "^29.0.2", @@ -365,6 +368,27 @@ "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, + "node_modules/@eslint/compat": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-2.1.0.tgz", + "integrity": "sha512-LgaSCymEpw7tF53xvDw9SNsraPb1IBHxpdABIOM0hW8UAlP8znrjYtuxfR58FSJ3L9BhwD+FaPRFQpZq84Nh6g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "peerDependencies": { + "eslint": "^8.40 || 9 || 10" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, "node_modules/@eslint/config-array": { "version": "0.23.5", "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", @@ -406,6 +430,27 @@ "node": "^20.19.0 || ^22.13.0 || >=24" } }, + "node_modules/@eslint/js": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz", + "integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "eslint": "^10.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, "node_modules/@eslint/object-schema": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", @@ -2456,6 +2501,19 @@ "node": "*" } }, + "node_modules/globals": { + "version": "17.6.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.6.0.tgz", + "integrity": "sha512-sepffkT8stwnIYbsMBpoCHJuJM5l98FUF2AnE07hfvE0m/qp3R586hw4jF4uadbhvg1ooIdzuu7CsfD2jzCaNA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/globby": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", diff --git a/package.json b/package.json index 4d9e0a7c02..9f932409c1 100644 --- a/package.json +++ b/package.json @@ -32,8 +32,8 @@ "watch": "webpack --watch --config config/webpack.config.js", "watchns": "webpack --watch --config config/webpack-nospector.config.js", "dist": "webpack --config config/webpack.dist.config.js", - "lint": "eslint --config .eslintrc.json \"src/**/*.js\"", - "lintfix": "eslint --config .eslintrc.json \"src/**/*.js\" --fix", + "lint": "eslint \"src/**/*.js\"", + "lintfix": "npm run lint -- --fix", "sloc": "node-sloc \"./src\" --include-extensions \"js\"", "bundleshaders": "node scripts/bundle-shaders.js", "build-tsgen": "cd scripts/tsgen && tsc", @@ -57,6 +57,8 @@ "web audio" ], "devDependencies": { + "@eslint/compat": "2.1.0", + "@eslint/js": "10.0.1", "@types/offscreencanvas": "^2019.7.3", "@types/source-map": "^0.5.7", "clean-webpack-plugin": "^4.0.0", @@ -65,6 +67,7 @@ "eslint-plugin-es5": "^1.5.0", "exports-loader": "^5.0.0", "fs-extra": "^11.3.4", + "globals": "17.6.0", "imports-loader": "^5.0.0", "jsdoc": "3.x.x", "jsdom": "^29.0.2", diff --git a/src/gameobjects/bitmaptext/static/BitmapText.js b/src/gameobjects/bitmaptext/static/BitmapText.js index 59ca8a5947..d7687b4260 100644 --- a/src/gameobjects/bitmaptext/static/BitmapText.js +++ b/src/gameobjects/bitmaptext/static/BitmapText.js @@ -1129,7 +1129,7 @@ var BitmapText = new Class({ */ displayWidth: { - set: function(value) + set: function (value) { this.setScaleX(1); @@ -1161,7 +1161,7 @@ var BitmapText = new Class({ */ displayHeight: { - set: function(value) + set: function (value) { this.setScaleY(1); diff --git a/src/input/mouse/index.js b/src/input/mouse/index.js index 77d84914e9..130f3ab1ba 100644 --- a/src/input/mouse/index.js +++ b/src/input/mouse/index.js @@ -8,10 +8,8 @@ * @namespace Phaser.Input.Mouse */ -/* eslint-disable */ module.exports = { MouseManager: require('./MouseManager') }; -/* eslint-enable */ diff --git a/src/input/touch/index.js b/src/input/touch/index.js index 23e011c1cb..c106b06394 100644 --- a/src/input/touch/index.js +++ b/src/input/touch/index.js @@ -8,10 +8,8 @@ * @namespace Phaser.Input.Touch */ -/* eslint-disable */ module.exports = { TouchManager: require('./TouchManager') }; -/* eslint-enable */ diff --git a/src/math/random-data-generator/RandomDataGenerator.js b/src/math/random-data-generator/RandomDataGenerator.js index 25a1236a82..1659099d88 100644 --- a/src/math/random-data-generator/RandomDataGenerator.js +++ b/src/math/random-data-generator/RandomDataGenerator.js @@ -336,7 +336,7 @@ var RandomDataGenerator = new Class({ for (b = a = ''; a++ < 36; b += ~a % 5 | a * 3 & 4 ? (a ^ 15 ? 8 ^ this.frac() * (a ^ 20 ? 16 : 4) : 4).toString(16) : '-') { - // eslint-disable-next-line no-empty + // noop } return b; diff --git a/src/sound/BaseSound.js b/src/sound/BaseSound.js index ebcc687c71..720f2938a2 100644 --- a/src/sound/BaseSound.js +++ b/src/sound/BaseSound.js @@ -248,7 +248,6 @@ var BaseSound = new Class({ if (!this.markers[marker.name]) { - // eslint-disable-next-line no-console console.warn('Audio Marker: ' + marker.name + ' missing in Sound: ' + this.key); return false; @@ -322,7 +321,6 @@ var BaseSound = new Class({ { if (!this.markers[markerName]) { - // eslint-disable-next-line no-console console.warn('Marker: ' + markerName + ' missing in Sound: ' + this.key); return false; diff --git a/src/sound/html5/HTML5AudioSound.js b/src/sound/html5/HTML5AudioSound.js index 4d035d0712..29b0df1bf7 100644 --- a/src/sound/html5/HTML5AudioSound.js +++ b/src/sound/html5/HTML5AudioSound.js @@ -377,7 +377,6 @@ var HTML5AudioSound = new Class({ if (playPromise) { - // eslint-disable-next-line no-unused-vars playPromise.catch(function (reason) { console.warn(reason); diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 2131bf1e1e..ba747ec8b4 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -138,7 +138,6 @@ var NoAudioSoundManager = new Class({ * * @return {boolean} Always 'false' for the No Audio Sound Manager. */ - // eslint-disable-next-line no-unused-vars play: function (key, extra) { return false; @@ -157,7 +156,6 @@ var NoAudioSoundManager = new Class({ * * @return {boolean} Always 'false' for the No Audio Sound Manager. */ - // eslint-disable-next-line no-unused-vars playAudioSprite: function (key, spriteName, config) { return false; diff --git a/src/textures/parsers/PCTDecode.js b/src/textures/parsers/PCTDecode.js index 0f5cfd204c..7996be9c5e 100644 --- a/src/textures/parsers/PCTDecode.js +++ b/src/textures/parsers/PCTDecode.js @@ -57,7 +57,7 @@ var resolveFullName = function (raw, folders, extSuffix) } // Extension index: "name~N" (per-name, overrides line-level) - var extMatch = /~([1-5])$/.exec(name); + var extMatch = (/~([1-5])$/).exec(name); if (extMatch) { @@ -82,7 +82,7 @@ var expandNames = function (line, folders) { // Check for trailing extension suffix: ~N at very end var extSuffix = ''; - var extMatch = /~([1-5])$/.exec(line); + var extMatch = (/~([1-5])$/).exec(line); if (extMatch) { diff --git a/src/tilemaps/Tilemap.js b/src/tilemaps/Tilemap.js index c7db5bb57f..1819025737 100644 --- a/src/tilemaps/Tilemap.js +++ b/src/tilemaps/Tilemap.js @@ -355,7 +355,7 @@ var Tilemap = new Class({ if (typeof renderOrder === 'number') { - renderOrder = orders[ renderOrder ]; + renderOrder = orders[renderOrder]; } if (orders.indexOf(renderOrder) > -1) @@ -418,7 +418,7 @@ var Tilemap = new Class({ return null; } - var tileset = this.tilesets[ index ]; + var tileset = this.tilesets[index]; if (tileset) { @@ -607,7 +607,7 @@ var Tilemap = new Class({ return null; } - var layerData = this.layers[ index ]; + var layerData = this.layers[index]; // Check for an associated tilemap layer if (layerData.tilemapLayer) @@ -831,7 +831,7 @@ var Tilemap = new Class({ for (var c = 0; c < config.length; c++) { - var singleConfig = config[ c ]; + var singleConfig = config[c]; var id = GetFastValue(singleConfig, 'id', null); var gid = GetFastValue(singleConfig, 'gid', null); @@ -845,7 +845,7 @@ var Tilemap = new Class({ // Sweep to get all the objects we want to convert in this pass for (var s = 0; s < objects.length; s++) { - obj = objects[ s ]; + obj = objects[s]; if ( (id === null && gid === null && name === null && type === null) || @@ -869,7 +869,7 @@ var Tilemap = new Class({ for (var i = 0; i < toConvert.length; i++) { - obj = toConvert[ i ]; + obj = toConvert[i]; var sprite = new classType(scene); @@ -1259,7 +1259,7 @@ var Tilemap = new Class({ { for (var i = 0; i < location.length; i++) { - if (location[ i ].name === name) + if (location[i].name === name) { return i; } @@ -1282,7 +1282,7 @@ var Tilemap = new Class({ { var index = this.getLayerIndex(layer); - return (index !== null) ? this.layers[ index ] : null; + return (index !== null) ? this.layers[index] : null; }, /** @@ -1299,7 +1299,7 @@ var Tilemap = new Class({ { var index = this.getIndex(this.objects, name); - return (index !== null) ? this.objects[ index ] : null; + return (index !== null) ? this.objects[index] : null; }, /** @@ -1536,7 +1536,7 @@ var Tilemap = new Class({ { var index = this.getIndex(this.tilesets, name); - return (index !== null) ? this.tilesets[ index ] : null; + return (index !== null) ? this.tilesets[index] : null; }, /** @@ -1615,7 +1615,7 @@ var Tilemap = new Class({ layer: { get: function () { - return this.layers[ this.currentLayerIndex ]; + return this.layers[this.currentLayerIndex]; }, set: function (layer) @@ -1828,9 +1828,9 @@ var Tilemap = new Class({ for (var i = index; i < this.layers.length; i++) { - if (this.layers[ i ].tilemapLayer) + if (this.layers[i].tilemapLayer) { - this.layers[ i ].tilemapLayer.layerIndex--; + this.layers[i].tilemapLayer.layerIndex--; } } @@ -1865,7 +1865,7 @@ var Tilemap = new Class({ if (index !== null) { - layer = this.layers[ index ]; + layer = this.layers[index]; layer.tilemapLayer.destroy(); @@ -1898,9 +1898,9 @@ var Tilemap = new Class({ for (var i = 0; i < layers.length; i++) { - if (layers[ i ].tilemapLayer) + if (layers[i].tilemapLayer) { - layers[ i ].tilemapLayer.destroy(false); + layers[i].tilemapLayer.destroy(false); } } @@ -1938,7 +1938,7 @@ var Tilemap = new Class({ for (var i = 0; i < tiles.length; i++) { - var tile = tiles[ i ]; + var tile = tiles[i]; removed.push(this.removeTileAt(tile.x, tile.y, true, recalculateFaces, tile.tilemapLayer)); @@ -2062,7 +2062,7 @@ var Tilemap = new Class({ for (var i = 0; i < layers.length; i++) { - TilemapComponents.RenderDebug(graphics, styleConfig, layers[ i ]); + TilemapComponents.RenderDebug(graphics, styleConfig, layers[i]); } return this; @@ -2366,18 +2366,18 @@ var Tilemap = new Class({ // Update the base tile size on all layers & tiles for (var i = 0; i < this.layers.length; i++) { - this.layers[ i ].baseTileWidth = tileWidth; - this.layers[ i ].baseTileHeight = tileHeight; + this.layers[i].baseTileWidth = tileWidth; + this.layers[i].baseTileHeight = tileHeight; - var mapData = this.layers[ i ].data; - var mapWidth = this.layers[ i ].width; - var mapHeight = this.layers[ i ].height; + var mapData = this.layers[i].data; + var mapWidth = this.layers[i].width; + var mapHeight = this.layers[i].height; for (var row = 0; row < mapHeight; row++) { for (var col = 0; col < mapWidth; col++) { - var tile = mapData[ row ][ col ]; + var tile = mapData[row][col]; if (tile !== null) { @@ -2421,7 +2421,7 @@ var Tilemap = new Class({ { for (var col = 0; col < mapWidth; col++) { - var tile = mapData[ row ][ col ]; + var tile = mapData[row][col]; if (tile !== null) {