Skip to content

Commit

Permalink
Merge pull request #317 from ImageMarkup/eslint-config
Browse files Browse the repository at this point in the history
Use ESLint rules from eslint-config-girder
  • Loading branch information
brianhelba authored May 11, 2017
2 parents 51fcef0 + 4c418f2 commit 1a06c6c
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 62 deletions.
File renamed without changes.
23 changes: 23 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "girder",
"rules": {
"backbone/defaults-on-top": 2,
"backbone/event-scope": 0,
"backbone/no-changed-set": 2,
"backbone/no-collection-models": 2,
"backbone/no-el-assign": 2,
"backbone/no-native-jquery": [0, "selector"],
"backbone/no-silent": 2,
"backbone/no-view-model-attributes": 2,
"backbone/no-view-onoff-binding": 2,
"backbone/no-view-qualified-jquery": 2,
"backbone/render-return": 2
},
"settings": {
"backbone": {
"Collection": ["GirderCollection", "Collection"],
"Model": ["GirderModel", "Model"],
"View": ["GirderView", "View"],
}
}
}
7 changes: 4 additions & 3 deletions plugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ add_python_test(
add_eslint_test(
isic_archive_external
"${CMAKE_CURRENT_LIST_DIR}/web_external"
ESLINT_CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR}/web_external/.eslintrc.js"
ESLINT_IGNORE_FILE "${CMAKE_CURRENT_LIST_DIR}/web_external/.eslintignore")
ESLINT_CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR}/.eslintrc"
ESLINT_IGNORE_FILE "${CMAKE_CURRENT_LIST_DIR}/.eslintignore")
#add_puglint_test(
# isic_archive_external
# "${CMAKE_CURRENT_LIST_DIR}/web_external")
Expand All @@ -71,4 +71,5 @@ add_test(
COMMAND "${PUGLINT_EXECUTABLE}" -c "${CMAKE_CURRENT_LIST_DIR}/.pug-lintrc" "${CMAKE_CURRENT_LIST_DIR}/web_client/templates")
add_eslint_test(
isic_archive_grunt
"${CMAKE_CURRENT_LIST_DIR}/Gruntfile.js")
"${CMAKE_CURRENT_LIST_DIR}/Gruntfile.js"
ESLINT_CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR}/.eslintrc")
43 changes: 0 additions & 43 deletions web_external/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion web_external/Datasets/ApplyMetadataView.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ var ApplyMetadataSelectFileView = View.extend({
select.select2('destroy');

this.$el.html(ApplyMetadataSelectFilePageTemplate({
models: this.collection.models
models: this.collection.toArray()
}));

// Set up select box
Expand Down
2 changes: 1 addition & 1 deletion web_external/ImagesGallery/Detail/ImageDetailsPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var ImageDetailsPane = View.extend({
},

clearTooltips: function () {
$('[data-toggle="tooltip"]').tooltip('hide');
this.$('[data-toggle="tooltip"]').tooltip('hide');
}
});

Expand Down
10 changes: 5 additions & 5 deletions web_external/ImagesGallery/Facets/ImagesFacetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ import exImageUrl from '!url-loader!svg-fill-loader!./ex.svg?fill=#999999';
var ImagesFacetView = View.extend({
className: 'isic-images-facet',

events: {
'show.bs.collapse .isic-images-facet-content': '_toggleCollapseIndicator',
'hide.bs.collapse .isic-images-facet-content': '_toggleCollapseIndicator'
},

/**
* @param {ImagesFacetModel} settings.completeFacet
* @param {ImagesFacetModel} settings.filteredFacet
Expand All @@ -31,11 +36,6 @@ var ImagesFacetView = View.extend({
this.title = this.completeFacet.schema().title;
},

events: {
'show.bs.collapse .isic-images-facet-content': '_toggleCollapseIndicator',
'hide.bs.collapse .isic-images-facet-content': '_toggleCollapseIndicator'
},

_toggleCollapseIndicator: function () {
this.$('.isic-images-facet-indicator')
.toggleClass('icon-down-open')
Expand Down
14 changes: 7 additions & 7 deletions web_external/StudyResults/StudyResultsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var StudyResultsImageHeaderView = View.extend({
render: function () {
this.$el.html(StudyResultsImageHeaderPageTemplate({
hasStudy: !_.isUndefined(this.study.id),
numImages: this.collection.models.length
numImages: this.collection.size()
}));

return this;
Expand Down Expand Up @@ -137,7 +137,7 @@ var StudyResultsSelectStudyView = View.extend({
select.select2('destroy');

this.$el.html(StudyResultsSelectStudyPageTemplate({
models: this.collection.models
models: this.collection.toArray()
}));

// Set up select box
Expand Down Expand Up @@ -208,7 +208,7 @@ var StudyResultsSelectImageView = View.extend({

render: function () {
this.$el.html(StudyResultsSelectImagePageTemplate({
models: this.collection.models,
models: this.collection.toArray(),
apiRoot: this.apiRoot
}));

Expand Down Expand Up @@ -241,7 +241,7 @@ var StudyResultsSelectUsersView = View.extend({
select.select2('destroy');

this.$el.html(StudyResultsSelectUsersPageTemplate({
models: this.collection.models
models: this.collection.toArray()
}));

// Set up select box
Expand Down Expand Up @@ -292,7 +292,7 @@ var StudyResultsSelectLocalFeaturesView = View.extend({
}, this)));

this.$el.html(StudyResultsSelectLocalFeaturesPageTemplate({
models: collection.models
models: collection.toArray()
}));

// Set up select box
Expand Down Expand Up @@ -346,7 +346,7 @@ var StudyResultsGlobalFeaturesTableView = View.extend({

render: function () {
this.$el.html(StudyResultsGlobalFeaturesTableTemplate({
features: this.collection.models
features: this.collection.toArray()
}));

return this;
Expand Down Expand Up @@ -666,7 +666,7 @@ var StudyResultsView = View.extend({
this.images.reset(imageModels);

// Populate users collection
this.users.reset(this.study.users().models);
this.users.reset(this.study.users().models); // eslint-disable-line backbone/no-view-collection-models

// Fetch featureset
var featureset = this.study.featureset();
Expand Down
4 changes: 2 additions & 2 deletions web_external/Tasks/TasksView.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ var TasksGroupView = View.extend({
linkPrefix: this.linkPrefix,
resourceName: this.resourceName,
total: this.numTasks(),
tasks: this.collection.models
tasks: this.collection.toArray()
}));

return this;
},

// Return total number of tasks in collection
numTasks: function () {
return this.collection.models.reduce(function (total, model) {
return this.collection.reduce(function (total, model) {
return total + model.get('count');
}, 0);
}
Expand Down

0 comments on commit 1a06c6c

Please sign in to comment.