Skip to content

Commit

Permalink
Added grunt-eslint
Browse files Browse the repository at this point in the history
A big thanks to @Nishchit14 for writing the rules.
Closes #19.
  • Loading branch information
indrimuska committed Feb 24, 2016
1 parent 1e9e389 commit 292387d
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 13 deletions.
8 changes: 7 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ module.exports = function(grunt) {
},
file: 'package.json'
},
eslint: {
options: {
configFile: 'eslint.json'
},
target: ['src/angular-selector.js']
},
copy: {
main: {
files: {
Expand Down Expand Up @@ -56,7 +62,7 @@ module.exports = function(grunt) {
});

// Default tasks.
grunt.registerTask('default', ['copy', 'uglify', 'cssmin', 'sync-json']);
grunt.registerTask('default', ['eslint', 'copy', 'uglify', 'cssmin', 'sync-json']);
grunt.registerTask('update-patch', ['bumpup:patch', 'default']);

};
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-selector",
"version": "1.1.0",
"version": "1.1.1",
"authors": [
"Indri Muska <indrimuska@gmail.com>"
],
Expand Down
7 changes: 3 additions & 4 deletions dist/angular-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
};

// Remote fetching
scope.fetch = function () {
scope.fetch = function () {
var promise, search = scope.search || '';
if (!angular.isDefined(scope.remote))
throw 'Remote attribute is not defined';
Expand Down Expand Up @@ -191,8 +191,7 @@
var label = input.parent()[0],
styles = getStyles(label),
marginTop = parseFloat(styles.marginTop || 0),
marginLeft = parseFloat(styles.marginLeft || 0),
marginRight = parseFloat(styles.marginRight || 0);
marginLeft = parseFloat(styles.marginLeft || 0);

dropdown.css({
top: (label.offsetTop + label.offsetHeight + marginTop) + 'px',
Expand Down Expand Up @@ -444,7 +443,7 @@
});
};
scope.api.unset = function (value) {
var values = !value ? scope.selectedValues : (scope.selectedValues || []).filter(function (option) { return scope.optionEquals(option, value); });
var values = !value ? scope.selectedValues : (scope.selectedValues || []).filter(function (option) { return scope.optionEquals(option, value); }),
indexes =
scope.selectedValues.map(function (option, index) {
return scope.inOptions(values, option) ? index : -1;
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-selector.min.js

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"env": {
"browser": true
},
"globals": {
"angular": 1
},
"extends": "eslint:recommended",
"rules": {
"indent": [2, "tab", {"SwitchCase": 1}],
"quotes": [2, "single"],
"eqeqeq": 0,
"strict": 0,
"no-undef": 0,
"semi": [2, "always"]
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-selector",
"version": "1.1.0",
"version": "1.1.1",
"description": "A native AngularJS directive that transform a simple `<select>` box into a full html select with typeahead.",
"main": "Gruntfile.js",
"repository": {
Expand Down Expand Up @@ -29,6 +29,7 @@
"grunt-contrib-copy": "^0.8.1",
"grunt-contrib-cssmin": "^0.13.0",
"grunt-contrib-uglify": "^0.9.2",
"grunt-eslint": "^18.0.0",
"grunt-sync-json": "^0.4.0",
"load-grunt-tasks": "^3.2.0"
}
Expand Down
7 changes: 3 additions & 4 deletions src/angular-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
};

// Remote fetching
scope.fetch = function () {
scope.fetch = function () {
var promise, search = scope.search || '';
if (!angular.isDefined(scope.remote))
throw 'Remote attribute is not defined';
Expand Down Expand Up @@ -191,8 +191,7 @@
var label = input.parent()[0],
styles = getStyles(label),
marginTop = parseFloat(styles.marginTop || 0),
marginLeft = parseFloat(styles.marginLeft || 0),
marginRight = parseFloat(styles.marginRight || 0);
marginLeft = parseFloat(styles.marginLeft || 0);

dropdown.css({
top: (label.offsetTop + label.offsetHeight + marginTop) + 'px',
Expand Down Expand Up @@ -444,7 +443,7 @@
});
};
scope.api.unset = function (value) {
var values = !value ? scope.selectedValues : (scope.selectedValues || []).filter(function (option) { return scope.optionEquals(option, value); });
var values = !value ? scope.selectedValues : (scope.selectedValues || []).filter(function (option) { return scope.optionEquals(option, value); }),
indexes =
scope.selectedValues.map(function (option, index) {
return scope.inOptions(values, option) ? index : -1;
Expand Down

0 comments on commit 292387d

Please sign in to comment.