Skip to content

Commit 0682c60

Browse files
add ESLint
1 parent bb31f7b commit 0682c60

8 files changed

+861
-11
lines changed

.eslintrc

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
root: true
2+
3+
extends: 'eslint:recommended'
4+
5+
rules:
6+
no-cond-assign: 0
7+
no-constant-condition: 0
8+
no-console: 0
9+
no-empty: 0
10+
no-extra-semi: 0
11+
no-octal: 0
12+
no-undef: 0
13+
no-unused-vars: 0
14+
linebreak-style: [2, unix]
15+
no-trailing-spaces: 2
16+
no-unneeded-ternary: 2
17+
quotes: [2, single, avoid-escape]
18+
semi: 2
19+
semi-spacing: 2
20+
mootools-indent: [2, tab, {SwitchCase: 1, VariableDeclarator: 1, IndentRootIIFE: false}]
21+
mootools-whitespace: 2

Gruntfile.js

+18-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
"use strict";
1+
'use strict';
22

3-
module.exports = function(grunt) {
3+
module.exports = function(grunt){
44

55
require('load-grunt-tasks')(grunt);
66
var browser = process.env.BROWSER;
77
var travisBuild = process.env.BUILD;
88
var pullRequest = process.env.TRAVIS_PULL_REQUEST;
99

1010
grunt.initConfig({
11+
eslint: {
12+
target: ['Gruntfile.js', 'Specs/**/*.js', 'Source/**/*.js'],
13+
options: {
14+
rulePaths: ['Tests/eslint/rules']
15+
}
16+
},
17+
1118
'connect': {
1219
testserver: {
1320
options: {
@@ -16,11 +23,11 @@ module.exports = function(grunt) {
1623
// to avoid https://github.com/joyent/libuv/issues/826
1724
port: 8000,
1825
hostname: '0.0.0.0',
19-
middleware: function(connect, options) {
26+
middleware: function(connect, options){
2027
return [
21-
function(req, resp, next) {
28+
function(req, resp, next){
2229
// cache get requests to speed up tests on travis
23-
if (req.method === 'GET') {
30+
if (req.method === 'GET'){
2431
resp.setHeader('Cache-control', 'public, max-age=3600');
2532
}
2633

@@ -37,7 +44,7 @@ module.exports = function(grunt) {
3744

3845
options: {
3946
name: {
40-
More: 'Source/',
47+
More: 'Source/',
4148
Core: 'node_modules/mootools-core/'
4249
}
4350
},
@@ -86,8 +93,8 @@ module.exports = function(grunt) {
8693
singleRun: true,
8794
frameworks: ['jasmine', 'sinon'],
8895
files: [
89-
'Tests/Utilities/*.js',
90-
'mootools-*.js',
96+
'Tests/Utilities/*.js',
97+
'mootools-*.js',
9198
{pattern: 'Tests/Specs/assets/*.*', included: false, served: true}
9299
],
93100
sauceLabs: {
@@ -194,7 +201,7 @@ module.exports = function(grunt) {
194201
version: '6',
195202
deviceOrientation: 'portrait'
196203
}
197-
},
204+
}
198205
},
199206

200207
continuous: {
@@ -221,8 +228,8 @@ module.exports = function(grunt) {
221228

222229
});
223230

224-
var compatBuild = ['clean', 'packager:all', 'packager:specs'];
225-
var nocompatBuild = ['clean', 'packager:morenocompat', 'packager:specs-nocompat'];
231+
var compatBuild = ['clean', 'eslint', 'packager:all', 'packager:specs'];
232+
var nocompatBuild = ['clean', 'eslint', 'packager:morenocompat', 'packager:specs-nocompat'];
226233

227234
var tasks = travisBuild == 'default' ? compatBuild : nocompatBuild;
228235
tasks = pullRequest != 'false' ? tasks.concat('karma:continuous') : tasks.concat('karma:sauceTask');

Source/Locale/Locale.fr-FR.Form.Validator.js

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ provides: [Locale.fr-FR.Form.Validator]
1919
...
2020
*/
2121

22+
/*eslint mootools-whitespace:0*/
23+
2224
Locale.define('fr-FR', 'FormValidator', {
2325

2426
required: 'Ce champ est obligatoire.',

Source/Locale/Locale.hu-HU.Form.Validator.js

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ provides: [Locale.hu-HU.Form.Validator]
1818
...
1919
*/
2020

21+
/*eslint mootools-whitespace:0*/
22+
2123
Locale.define('hu-HU', 'FormValidator', {
2224

2325
required: 'A mező kitöltése kötelező.',

Source/Locale/Locale.it-IT.Form.Validator.js

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ provides: [Locale.it-IT.Form.Validator]
1919
...
2020
*/
2121

22+
/*eslint mootools-whitespace:0*/
23+
2224
Locale.define('it-IT', 'FormValidator', {
2325

2426
required: 'Il campo è obbligatorio.',

0 commit comments

Comments
 (0)