diff --git a/Gruntfile.js b/Gruntfile.js index 5d885534b..f2d49647c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -394,6 +394,11 @@ module.exports = function (grunt) { options: { jshintrc: '.jshintrc' } }, + filters: { + src: ['filters/**/*.js'], + options: { jshintrc: 'filters/.jshintrc', } + }, + tooling: { src: [ 'Gruntfile.js', diff --git a/filters/.jshintrc b/filters/.jshintrc new file mode 100644 index 000000000..ec8189515 --- /dev/null +++ b/filters/.jshintrc @@ -0,0 +1,49 @@ +{ + "globals" : { "Phaser": false, "PIXI": false, "p2": false }, + // Ignore Environment Globals + "browser" : true, // Standard browser globals e.g. `window`, `document`. + + // Development + "devel" : true, // Allow developments statements e.g. `console.log();`. + + // ECMAScript Support + "es3" : true, // Support legacy browser and javascript environments. + "esnext" : false, // This option tells JSHint that your code uses ECMAScript 6 specific syntax. + "strict" : false, // Require `use strict` pragma in every file. + "globalstrict": false, // Allow global "use strict" (also enables 'strict'). + + // Functionality + "bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.). + "boss" : true, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments. + "camelcase" : false, // Force all variable names to use either camelCase style or UPPER_CASE with underscores. + "curly" : true, // Require {} for every new block or scope. + "eqeqeq" : false, // Require triple equals i.e. `===`. + "eqnull" : true, // Tolerate use of `== null`. + "evil" : false, // Tolerate use of `eval`. + "expr" : false, // Tolerate `ExpressionStatement` as Programs. + "forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`. + "freeze" : true, // Prohibits overwriting prototypes of native objects such as Array and Date. + "funcscope" : true, // This option suppresses warnings about declaring variables inside of control structures while accessing them later from the outside. + "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` + "latedef" : true, // Prohibit variable use before definition. + "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. + "laxcomma" : false, // This option suppresses warnings about comma-first coding style. + "loopfunc" : true, // Allow functions to be defined within loops. + "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. + "notypeof" : false, // This option suppresses warnings about invalid typeof operator values. + "shadow" : true, // Allows re-define variables later in code e.g. `var x=1; x=2;`. + "smarttabs" : false, // This option suppresses warnings about mixed tabs and spaces when the latter are used for alignmnent only. + "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`. + "undef" : true, // Require all non-global variables be declared before they are used. + "unused" : true, // This option warns when you define and never use your variables. + + // Styling + "indent" : false, // Specify indentation spacing + "newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`. + "noempty" : true, // Prohibit use of empty blocks. + "nonew" : true, // Prohibit use of constructors for side-effects. + "plusplus" : false, // Prohibit use of `++` & `--`. + "quotmark" : false, // This option enforces the consistency of quotation marks used throughout your code. + "sub" : true, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`. + "trailing" : true // Prohibit trailing whitespaces. +} diff --git a/filters/BinarySerpents.js b/filters/BinarySerpents.js index c8e51b84c..e8d9c59f4 100644 --- a/filters/BinarySerpents.js +++ b/filters/BinarySerpents.js @@ -81,7 +81,7 @@ Phaser.Filter.BinarySerpents.prototype.init = function (width, height, march, ma this.uniforms.march.value = march; this.uniforms.maxDistance.value = maxDistance; -} +}; Object.defineProperty(Phaser.Filter.BinarySerpents.prototype, 'fog', { diff --git a/filters/CausticLight.js b/filters/CausticLight.js index d909ab39c..8e4c5c373 100644 --- a/filters/CausticLight.js +++ b/filters/CausticLight.js @@ -6,7 +6,7 @@ Phaser.Filter.SampleFilter = function (game) { Phaser.Filter.call(this, game); this.uniforms.divisor = { type: '1f', value: 0.5 }; - + // The fragment shader source this.fragmentSrc = [ @@ -53,9 +53,9 @@ Phaser.Filter.SampleFilter.prototype.constructor = Phaser.Filter.SampleFilter; Phaser.Filter.SampleFilter.prototype.init = function (width, height, divisor) { - if (typeof divisor == 'undefined') { divisor = 0.5 }; + if (typeof divisor == 'undefined') { divisor = 0.5; } this.setResolution(width, height); this.uniforms.divisor.value = divisor; -} +}; diff --git a/filters/CheckerWave.js b/filters/CheckerWave.js index 93221c5ba..fd586cc54 100644 --- a/filters/CheckerWave.js +++ b/filters/CheckerWave.js @@ -91,7 +91,7 @@ Phaser.Filter.CheckerWave = function (game) { "gl_FragColor=color;", "}", "else gl_FragColor=vec4(0,0,0.1,alpha); //background color", - "}", + "}" ]; @@ -104,7 +104,7 @@ Phaser.Filter.CheckerWave.prototype.init = function (width, height) { this.setResolution(width, height); -} +}; Phaser.Filter.CheckerWave.prototype.setColor1 = function (red, green, blue) { @@ -112,7 +112,7 @@ Phaser.Filter.CheckerWave.prototype.setColor1 = function (red, green, blue) { this.uniforms.color1.value.y = green; this.uniforms.color1.value.z = blue; -} +}; Phaser.Filter.CheckerWave.prototype.setColor2 = function (red, green, blue) { @@ -120,7 +120,7 @@ Phaser.Filter.CheckerWave.prototype.setColor2 = function (red, green, blue) { this.uniforms.color2.value.y = green; this.uniforms.color2.value.z = blue; -} +}; Object.defineProperty(Phaser.Filter.CheckerWave.prototype, 'alpha', { diff --git a/filters/ColorBars.js b/filters/ColorBars.js index fd13e20de..8677caac7 100644 --- a/filters/ColorBars.js +++ b/filters/ColorBars.js @@ -6,7 +6,7 @@ Phaser.Filter.ColorBars = function (game) { Phaser.Filter.call(this, game); - this.uniforms.alpha = { type: '1f', value: 1 } + this.uniforms.alpha = { type: '1f', value: 1 }; // this.uniforms.origin = { type: '1f', value: 2.0 } this.fragmentSrc = [ @@ -70,7 +70,7 @@ Phaser.Filter.ColorBars.prototype.init = function (width, height) { this.setResolution(width, height); -} +}; Object.defineProperty(Phaser.Filter.ColorBars.prototype, 'alpha', { diff --git a/filters/Fire.js b/filters/Fire.js index dfcb13a4d..3c3a84faf 100644 --- a/filters/Fire.js +++ b/filters/Fire.js @@ -6,8 +6,8 @@ Phaser.Filter.Fire = function (game) { Phaser.Filter.call(this, game); - this.uniforms.alpha = { type: '1f', value: 1.0 } - this.uniforms.shift = { type: '1f', value: 1.6 } + this.uniforms.alpha = { type: '1f', value: 1.0 }; + this.uniforms.shift = { type: '1f', value: 1.6 }; this.uniforms.speed = { type: '2f', value: { x: 0.7, y: 0.4 } }; this.fragmentSrc = [ @@ -73,7 +73,7 @@ Phaser.Filter.Fire.prototype.init = function (width, height, alpha, shift) { this.uniforms.shift.value = shift; } -} +}; Object.defineProperty(Phaser.Filter.Fire.prototype, 'alpha', { diff --git a/filters/HueRotate.js b/filters/HueRotate.js index 2312a295f..3d41927e7 100644 --- a/filters/HueRotate.js +++ b/filters/HueRotate.js @@ -8,7 +8,7 @@ Phaser.Filter.HueRotate = function (game) { this.uniforms.alpha = { type: '1f', value: 1.0 }; this.uniforms.size = { type: '1f', value: 0.03 }; - this.uniforms.iChannel0 = { type: 'sampler2D', value: null, textureData: { repeat: true } } + this.uniforms.iChannel0 = { type: 'sampler2D', value: null, textureData: { repeat: true } }; this.fragmentSrc = [ @@ -64,7 +64,7 @@ Phaser.Filter.HueRotate.prototype.init = function (width, height, texture) { this.uniforms.iChannel0.value = texture; -} +}; Object.defineProperty(Phaser.Filter.HueRotate.prototype, 'alpha', { diff --git a/filters/LightBeam.js b/filters/LightBeam.js index 988301932..d4f5b03a3 100644 --- a/filters/LightBeam.js +++ b/filters/LightBeam.js @@ -6,12 +6,12 @@ Phaser.Filter.LightBeam = function (game) { Phaser.Filter.call(this, game); - this.uniforms.alpha = { type: '1f', value: 1 } - this.uniforms.thickness = { type: '1f', value: 70.0 } - this.uniforms.speed = { type: '1f', value: 1.0 } - this.uniforms.red = { type: '1f', value: 2.0 } - this.uniforms.green = { type: '1f', value: 1.0 } - this.uniforms.blue = { type: '1f', value: 1.0 } + this.uniforms.alpha = { type: '1f', value: 1 }; + this.uniforms.thickness = { type: '1f', value: 70.0 }; + this.uniforms.speed = { type: '1f', value: 1.0 }; + this.uniforms.red = { type: '1f', value: 2.0 }; + this.uniforms.green = { type: '1f', value: 1.0 }; + this.uniforms.blue = { type: '1f', value: 1.0 }; this.fragmentSrc = [ @@ -55,7 +55,7 @@ Phaser.Filter.LightBeam.prototype.init = function (width, height) { this.setResolution(width, height); -} +}; Object.defineProperty(Phaser.Filter.LightBeam.prototype, 'alpha', { diff --git a/filters/Marble.js b/filters/Marble.js index a960a0e7b..b8be8b6d8 100644 --- a/filters/Marble.js +++ b/filters/Marble.js @@ -6,12 +6,12 @@ Phaser.Filter.Marble = function (game) { Phaser.Filter.call(this, game); - this.uniforms.alpha = { type: '1f', value: 1.0 } + this.uniforms.alpha = { type: '1f', value: 1.0 }; // Drives speed, higher number will make it slower. - this.uniforms.fluid_speed = { type: '1f', value: 10.0 } + this.uniforms.fluid_speed = { type: '1f', value: 10.0 }; - this.uniforms.color_intensity = { type: '1f', value: 0.30 } + this.uniforms.color_intensity = { type: '1f', value: 0.30 }; // The fragment shader source this.fragmentSrc = [ @@ -69,7 +69,7 @@ Phaser.Filter.Marble.prototype.init = function (width, height, speed, intensity) this.uniforms.fluid_speed.value = speed; this.uniforms.color_intensity.value = intensity; -} +}; Object.defineProperty(Phaser.Filter.Marble.prototype, 'alpha', { diff --git a/filters/Plasma.js b/filters/Plasma.js index 638515db7..000d2114f 100644 --- a/filters/Plasma.js +++ b/filters/Plasma.js @@ -60,7 +60,7 @@ Phaser.Filter.Plasma.prototype.init = function (width, height, alpha, size) { this.uniforms.size.value = size; } -} +}; Object.defineProperty(Phaser.Filter.Plasma.prototype, 'alpha', { diff --git a/filters/SampleFilter.js b/filters/SampleFilter.js index a621da718..0e8878ba6 100644 --- a/filters/SampleFilter.js +++ b/filters/SampleFilter.js @@ -21,7 +21,7 @@ Phaser.Filter.SampleFilter = function (game) { */ this.uniforms.divisor = { type: '1f', value: 0.5 }; - + // The fragment shader source this.fragmentSrc = [ @@ -43,9 +43,9 @@ Phaser.Filter.SampleFilter.prototype.constructor = Phaser.Filter.SampleFilter; Phaser.Filter.SampleFilter.prototype.init = function (width, height, divisor) { - if (typeof divisor == 'undefined') { divisor = 0.5 }; + if (typeof divisor == 'undefined') { divisor = 0.5; } this.setResolution(width, height); this.uniforms.divisor.value = divisor; -} +}; diff --git a/filters/Tunnel.js b/filters/Tunnel.js index 113792969..abc3751f2 100644 --- a/filters/Tunnel.js +++ b/filters/Tunnel.js @@ -6,9 +6,9 @@ Phaser.Filter.Tunnel = function (game) { Phaser.Filter.call(this, game); - this.uniforms.alpha = { type: '1f', value: 1 } - this.uniforms.origin = { type: '1f', value: 2.0 } - this.uniforms.iChannel0 = { type: 'sampler2D', value: null, textureData: { repeat: true } } + this.uniforms.alpha = { type: '1f', value: 1 }; + this.uniforms.origin = { type: '1f', value: 2.0 }; + this.uniforms.iChannel0 = { type: 'sampler2D', value: null, textureData: { repeat: true } }; this.fragmentSrc = [ @@ -44,7 +44,7 @@ Phaser.Filter.Tunnel.prototype.init = function (width, height, texture) { texture.baseTexture._powerOf2 = true; -} +}; Object.defineProperty(Phaser.Filter.Tunnel.prototype, 'alpha', {