Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/*.js
demo/*
spec/*
20 changes: 20 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"rules": {
"indent": ["error", 2],
"max-len": ["error", 180],
"camelcase": "error",
"no-trailing-spaces": "error"
}
}
19 changes: 0 additions & 19 deletions .jscsrc

This file was deleted.

18 changes: 7 additions & 11 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
/*eslint-disable camelcase */
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-protractor-runner');
grunt.loadNpmTasks('grunt-contrib-connect');
Expand Down Expand Up @@ -58,12 +57,8 @@ module.exports = function(grunt) {
}
},

jshint: {
all: ['src/*.js']
},

jscs: {
all: ['*.js', 'src/*.js', ],
eslint: {
target: ['*.js', 'src/*.js']
},

watch: {
Expand Down Expand Up @@ -107,7 +102,8 @@ module.exports = function(grunt) {
}
});

grunt.registerTask('lint', ['jshint', 'jscs']);
grunt.registerTask('default', ['sass', 'cssmin', 'jshint', 'jscs', 'copy', 'uglify']);
grunt.registerTask('lint', ['eslint']);
grunt.registerTask('default', ['sass', 'cssmin', 'eslint', 'copy', 'uglify']);
grunt.registerTask('e2e-test', ['connect', 'protractor_webdriver', 'protractor']);
};
/*eslint-enable camelcase */
2 changes: 1 addition & 1 deletion doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Change log

## v0.5.2-dev (upcoming changes)

TBD
- switch to eslint ([#763](https://github.com/gridstack/gridstack.js/issues/763)).

## v0.5.2 (2019-11-13)

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@
"grunt-contrib-connect": "^2.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-cssmin": "^3.0.0",
"grunt-contrib-jshint": "^2.1.0",
"grunt-contrib-uglify": "^4.0.1",
"grunt-contrib-watch": "^1.1.0",
"grunt-jscs": "^3.0.1",
"grunt-eslint": "^20.1.0",
"grunt-protractor-runner": "^5.0.0",
"grunt-protractor-webdriver": "^0.2.5",
"grunt-sass": "2.1.0",
Expand Down
28 changes: 14 additions & 14 deletions src/gridstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,15 @@
}
};

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

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

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

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

/**
* @class GridStackDragDropPlugin
Expand Down Expand Up @@ -653,7 +653,7 @@

this.container = $(el);

// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
/*eslint-disable camelcase */
if (typeof opts.handle_class !== 'undefined') {
opts.handleClass = opts.handle_class;
obsoleteOpts('handle_class', 'handleClass');
Expand Down Expand Up @@ -694,7 +694,7 @@
opts.alwaysShowResizeHandle = opts.always_show_resize_handle;
obsoleteOpts('always_show_resize_handle', 'alwaysShowResizeHandle');
}
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
/*eslint-enable camelcase */

opts.itemClass = opts.itemClass || 'grid-stack-item';
var isNested = this.container.closest('.' + opts.itemClass).length > 0;
Expand Down Expand Up @@ -805,14 +805,14 @@
var _this = this;
this.container.children('.' + this.opts.itemClass + ':not(.' + this.opts.placeholderClass + ')')
.each(function(index, el) {
el = $(el);
elements.push({
el: el,
// if x,y are missing (autoPosition) add them to end of list - keep their respective DOM order
i: (parseInt(el.attr('data-gs-x')) || 100) +
(parseInt(el.attr('data-gs-y')) || 100) * _this.opts.width
el = $(el);
elements.push({
el: el,
// if x,y are missing (autoPosition) add them to end of list - keep their respective DOM order
i: (parseInt(el.attr('data-gs-x')) || 100) +
(parseInt(el.attr('data-gs-y')) || 100) * _this.opts.width
});
});
});
Utils.sortBy(elements, function(x) { return x.i; }).forEach(function(item) {
this._prepareElement(item.el);
}, this);
Expand Down Expand Up @@ -1833,7 +1833,7 @@
this.container.addClass('grid-stack-' + gridWidth);
};

// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
/*eslint-disable camelcase */
GridStackEngine.prototype.batch_update = obsolete(GridStackEngine.prototype.batchUpdate);
GridStackEngine.prototype._fix_collisions = obsolete(GridStackEngine.prototype._fixCollisions,
'_fix_collisions', '_fixCollisions');
Expand Down Expand Up @@ -1865,7 +1865,7 @@
'end_update', 'endUpdate');
GridStackEngine.prototype.can_be_placed_with_respect_to_height =
obsolete(GridStackEngine.prototype.canBePlacedWithRespectToHeight,
'can_be_placed_with_respect_to_height', 'canBePlacedWithRespectToHeight');
'can_be_placed_with_respect_to_height', 'canBePlacedWithRespectToHeight');
GridStack.prototype._trigger_change_event = obsolete(GridStack.prototype._triggerChangeEvent,
'_trigger_change_event', '_triggerChangeEvent');
GridStack.prototype._init_styles = obsolete(GridStack.prototype._initStyles,
Expand Down Expand Up @@ -1910,7 +1910,7 @@
'set_static', 'setStatic');
GridStack.prototype._set_static_class = obsolete(GridStack.prototype._setStaticClass,
'_set_static_class', '_setStaticClass');
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
/*eslint-enable camelcase */

scope.GridStackUI = GridStack;

Expand Down
Loading