Skip to content

Commit 6c403df

Browse files
committed
eslint support
changing from jshint and jscs to eslint
1 parent 57c6511 commit 6c403df

8 files changed

Lines changed: 50 additions & 52 deletions

File tree

.bithoundrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"**/spec/**"
1111
],
1212
"critics": {
13-
"lint": "jshint"
13+
"lint": "eslint"
1414
}
1515
}

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/*.js
2+
demo/*
3+
spec/*

.eslintrc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"commonjs": true,
5+
"es6": true,
6+
"node": true
7+
},
8+
"parserOptions": {
9+
"ecmaFeatures": {
10+
"jsx": true
11+
},
12+
"sourceType": "module"
13+
},
14+
"rules": {
15+
"indent": ["error", 4],
16+
"max-len": ["error", 120],
17+
"camelcase": "error",
18+
"no-trailing-spaces": "error"
19+
}
20+
}

.jscsrc

Lines changed: 0 additions & 19 deletions
This file was deleted.

Gruntfile.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
1+
/*eslint-disable camelcase */
22
module.exports = function(grunt) {
33
grunt.loadNpmTasks('grunt-sass');
44
grunt.loadNpmTasks('grunt-contrib-cssmin');
55
grunt.loadNpmTasks('grunt-contrib-copy');
66
grunt.loadNpmTasks('grunt-contrib-uglify');
7-
grunt.loadNpmTasks('grunt-contrib-jshint');
8-
grunt.loadNpmTasks('grunt-jscs');
7+
grunt.loadNpmTasks('grunt-eslint');
98
grunt.loadNpmTasks('grunt-contrib-watch');
109
grunt.loadNpmTasks('grunt-protractor-runner');
1110
grunt.loadNpmTasks('grunt-contrib-connect');
@@ -57,12 +56,8 @@ module.exports = function(grunt) {
5756
}
5857
},
5958

60-
jshint: {
61-
all: ['src/*.js']
62-
},
63-
64-
jscs: {
65-
all: ['*.js', 'src/*.js', ],
59+
eslint: {
60+
target: ['*.js', 'src/*.js']
6661
},
6762

6863
watch: {
@@ -96,7 +91,6 @@ module.exports = function(grunt) {
9691
},
9792
},
9893
},
99-
10094
protractor_webdriver: {
10195
all: {
10296
options: {
@@ -106,7 +100,8 @@ module.exports = function(grunt) {
106100
}
107101
});
108102

109-
grunt.registerTask('lint', ['jshint', 'jscs']);
110-
grunt.registerTask('default', ['sass', 'cssmin', 'jshint', 'jscs', 'copy', 'uglify']);
103+
grunt.registerTask('lint', ['eslint']);
104+
grunt.registerTask('default', ['sass', 'cssmin', 'eslint', 'copy', 'uglify']);
111105
grunt.registerTask('e2e-test', ['connect', 'protractor_webdriver', 'protractor']);
112106
};
107+
/*eslint-enable camelcase */

karma.conf.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ module.exports = function(config) {
1515

1616
// list of files / patterns to load in the browser
1717
files: [
18-
'node_modules/jquery/dist/jquery.min.js',
19-
'node_modules/components-jqueryui/jquery-ui.min.js',
20-
'node_modules/lodash/lodash.min.js',
21-
'src/gridstack.js',
22-
'src/gridstack.jQueryUI.js',
23-
'spec/*-spec.js'
18+
'node_modules/jquery/dist/jquery.min.js',
19+
'node_modules/components-jqueryui/jquery-ui.min.js',
20+
'node_modules/lodash/lodash.min.js',
21+
'src/gridstack.js',
22+
'src/gridstack.jQueryUI.js',
23+
'spec/*-spec.js'
2424
],
2525

2626

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@
4444
"grunt-contrib-connect": "^1.0.2",
4545
"grunt-contrib-copy": "^1.0.0",
4646
"grunt-contrib-cssmin": "^2.1.0",
47-
"grunt-contrib-jshint": "^1.0.0",
4847
"grunt-contrib-uglify": "^2.3.0",
4948
"grunt-contrib-watch": "^1.0.0",
50-
"grunt-jscs": "^3.0.1",
49+
"grunt-eslint": "^20.1.0",
5150
"grunt-protractor-runner": "^5.0.0",
5251
"grunt-protractor-webdriver": "^0.2.5",
5352
"grunt-sass": "^2.0.0",

src/gridstack.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@
128128
}
129129
};
130130

131-
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
131+
/*eslint-disable camelcase */
132132
Utils.is_intercepted = obsolete(Utils.isIntercepted, 'is_intercepted', 'isIntercepted');
133133

134134
Utils.create_stylesheet = obsolete(Utils.createStylesheet, 'create_stylesheet', 'createStylesheet');
135135

136136
Utils.remove_stylesheet = obsolete(Utils.removeStylesheet, 'remove_stylesheet', 'removeStylesheet');
137137

138138
Utils.insert_css_rule = obsolete(Utils.insertCSSRule, 'insert_css_rule', 'insertCSSRule');
139-
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
139+
/*eslint-enable camelcase */
140140

141141
/**
142142
* @class GridStackDragDropPlugin
@@ -546,7 +546,7 @@
546546

547547
this.container = $(el);
548548

549-
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
549+
/*eslint-disable camelcase */
550550
if (typeof opts.handle_class !== 'undefined') {
551551
opts.handleClass = opts.handle_class;
552552
obsoleteOpts('handle_class', 'handleClass');
@@ -587,7 +587,7 @@
587587
opts.alwaysShowResizeHandle = opts.always_show_resize_handle;
588588
obsoleteOpts('always_show_resize_handle', 'alwaysShowResizeHandle');
589589
}
590-
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
590+
/*eslint-enable camelcase */
591591

592592
opts.itemClass = opts.itemClass || 'grid-stack-item';
593593
var isNested = this.container.closest('.' + opts.itemClass).length > 0;
@@ -695,12 +695,12 @@
695695
var _this = this;
696696
this.container.children('.' + this.opts.itemClass + ':not(.' + this.opts.placeholderClass + ')')
697697
.each(function(index, el) {
698-
el = $(el);
699-
elements.push({
700-
el: el,
701-
i: parseInt(el.attr('data-gs-x')) + parseInt(el.attr('data-gs-y')) * _this.opts.width
698+
el = $(el);
699+
elements.push({
700+
el: el,
701+
i: parseInt(el.attr('data-gs-x')) + parseInt(el.attr('data-gs-y')) * _this.opts.width
702+
});
702703
});
703-
});
704704
_.chain(elements).sortBy(function(x) { return x.i; }).each(function(i) {
705705
self._prepareElement(i.el);
706706
}).value();
@@ -1690,7 +1690,7 @@
16901690
this.container.addClass('grid-stack-' + gridWidth);
16911691
};
16921692

1693-
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
1693+
/*eslint-disable camelcase */
16941694
GridStackEngine.prototype.batch_update = obsolete(GridStackEngine.prototype.batchUpdate);
16951695
GridStackEngine.prototype._fix_collisions = obsolete(GridStackEngine.prototype._fixCollisions,
16961696
'_fix_collisions', '_fixCollisions');
@@ -1722,7 +1722,7 @@
17221722
'end_update', 'endUpdate');
17231723
GridStackEngine.prototype.can_be_placed_with_respect_to_height =
17241724
obsolete(GridStackEngine.prototype.canBePlacedWithRespectToHeight,
1725-
'can_be_placed_with_respect_to_height', 'canBePlacedWithRespectToHeight');
1725+
'can_be_placed_with_respect_to_height', 'canBePlacedWithRespectToHeight');
17261726
GridStack.prototype._trigger_change_event = obsolete(GridStack.prototype._triggerChangeEvent,
17271727
'_trigger_change_event', '_triggerChangeEvent');
17281728
GridStack.prototype._init_styles = obsolete(GridStack.prototype._initStyles,
@@ -1767,7 +1767,7 @@
17671767
'set_static', 'setStatic');
17681768
GridStack.prototype._set_static_class = obsolete(GridStack.prototype._setStaticClass,
17691769
'_set_static_class', '_setStaticClass');
1770-
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
1770+
/*eslint-enable camelcase */
17711771

17721772
scope.GridStackUI = GridStack;
17731773

0 commit comments

Comments
 (0)