Update eslint-plugin-angular to the latest
eslint-plugin-angular in use by the project is quite old and the new library has changed rules. This patch updates the library and fixes the code where rule names have changed. Change-Id: I2e60a07b899325f17f38b96d40325602b4b58219 Closes-Bug: #1527417
This commit is contained in:
parent
2b6f9525a8
commit
846413c149
@ -41,10 +41,10 @@ rules:
|
|||||||
# Angular Plugin Customization
|
# Angular Plugin Customization
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
angular/ng_controller_as_vm:
|
angular/controller-as-vm:
|
||||||
- 1
|
- 1
|
||||||
- "ctrl"
|
- "ctrl"
|
||||||
|
|
||||||
# Remove after migrating to angular 1.4 or later.
|
# Remove after migrating to angular 1.4 or later.
|
||||||
angular/ng_no_cookiestore:
|
angular/no-cookiestore:
|
||||||
- 1
|
- 1
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
beforeEach(module('horizon.framework'));
|
beforeEach(module('horizon.framework'));
|
||||||
|
|
||||||
beforeEach(module('horizon.framework.util.bind-scope', function ($compileProvider) {
|
beforeEach(module('horizon.framework.util.bind-scope', function ($compileProvider) {
|
||||||
/* eslint-disable angular/ng_module_getter */
|
/* eslint-disable angular/module-getter */
|
||||||
$compileProvider.directive('testBindScope', testBindScope);
|
$compileProvider.directive('testBindScope', testBindScope);
|
||||||
/* eslint-enable angular/ng_module_getter */
|
/* eslint-enable angular/module-getter */
|
||||||
|
|
||||||
function testBindScope() {
|
function testBindScope() {
|
||||||
var directive = {
|
var directive = {
|
||||||
|
@ -17,18 +17,20 @@ limitations under the License.
|
|||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
/* eslint-disable angular/no-service-method */
|
||||||
angular
|
angular
|
||||||
.module('horizon.framework.util.http', [])
|
.module('horizon.framework.util.http', [])
|
||||||
.service('horizon.framework.util.http.service', ApiService);
|
.service('horizon.framework.util.http.service', ApiService);
|
||||||
|
/* eslint-enable angular/no-service-method */
|
||||||
|
|
||||||
ApiService.$inject = ['$http', '$window'];
|
ApiService.$inject = ['$http', '$window'];
|
||||||
|
|
||||||
function ApiService($http, $window) {
|
function ApiService($http, $window) {
|
||||||
|
|
||||||
var httpCall = function (method, url, data, config) {
|
var httpCall = function (method, url, data, config) {
|
||||||
/* eslint-disable angular/ng_window_service */
|
/* eslint-disable angular/window-service */
|
||||||
url = $window.WEBROOT + url;
|
url = $window.WEBROOT + url;
|
||||||
/* eslint-enable angular/ng_window_service */
|
/* eslint-enable angular/window-service */
|
||||||
|
|
||||||
url = url.replace(/\/+/g, '/');
|
url = url.replace(/\/+/g, '/');
|
||||||
|
|
||||||
@ -46,7 +48,7 @@ limitations under the License.
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.get = function(url, config) {
|
this.get = function(url, config) {
|
||||||
return httpCall('GET', url, undefined, config);
|
return httpCall('GET', url, null, config);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.post = function(url, data, config) {
|
this.post = function(url, data, config) {
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
terminal: true,
|
terminal: true,
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
compile: compile,
|
compile: compile,
|
||||||
$$tlb: true
|
$$tlb: true //eslint-disable-line angular/no-private-call
|
||||||
};
|
};
|
||||||
|
|
||||||
return directive;
|
return directive;
|
||||||
|
@ -48,10 +48,10 @@
|
|||||||
///////////////
|
///////////////
|
||||||
|
|
||||||
function expandDetail() {
|
function expandDetail() {
|
||||||
/*eslint-disable angular/ng_controller_as_vm */
|
/*eslint-disable angular/controller-as-vm */
|
||||||
// 'this' referred here is the this for the function not the controller
|
// 'this' referred here is the this for the function not the controller
|
||||||
var row = this.element.closest('tr');
|
var row = this.element.closest('tr');
|
||||||
/*eslint-enable angular/ng_controller_as_vm */
|
/*eslint-enable angular/controller-as-vm */
|
||||||
if (!row.hasClass('expanded')) {
|
if (!row.hasClass('expanded')) {
|
||||||
// Timeout needed to prevent
|
// Timeout needed to prevent
|
||||||
// $apply already in progress error
|
// $apply already in progress error
|
||||||
|
@ -79,20 +79,20 @@
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
/* eslint-disable angular/ng_window_service */
|
/* eslint-disable angular/window-service */
|
||||||
var markup =
|
var markup =
|
||||||
'<magic-search ' +
|
'<magic-search ' +
|
||||||
'template="' + window.STATIC_URL + 'framework/widgets/magic-search/magic-search.html" ' +
|
'template="' + window.STATIC_URL + 'framework/widgets/magic-search/magic-search.html" ' +
|
||||||
'strings="filterStrings" ' +
|
'strings="filterStrings" ' +
|
||||||
'facets="{{ filterFacets }}">' +
|
'facets="{{ filterFacets }}">' +
|
||||||
'</magic-search>';
|
'</magic-search>';
|
||||||
/* eslint-enable angular/ng_window_service */
|
/* eslint-enable angular/window-service */
|
||||||
|
|
||||||
$compile(angular.element(markup))($scope);
|
$compile(angular.element(markup))($scope);
|
||||||
|
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
|
|
||||||
$magicScope = $scope.$$childTail; //eslint-disable-line angular/ng_no_private_call
|
$magicScope = $scope.$$childTail; //eslint-disable-line angular/no-private-call
|
||||||
|
|
||||||
spyOn($magicScope, '$emit');
|
spyOn($magicScope, '$emit');
|
||||||
spyOn($magicScope, 'emitQuery');
|
spyOn($magicScope, 'emitQuery');
|
||||||
|
@ -89,9 +89,9 @@
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
/* eslint-disable angular/ng_window_service */
|
/* eslint-disable angular/window-service */
|
||||||
var msTemplate = window.STATIC_URL + 'framework/widgets/magic-search/magic-search.html';
|
var msTemplate = window.STATIC_URL + 'framework/widgets/magic-search/magic-search.html';
|
||||||
/* eslint-enable angular/ng_window_service */
|
/* eslint-enable angular/window-service */
|
||||||
var stMagicSearch =
|
var stMagicSearch =
|
||||||
'<st-magic-search>' +
|
'<st-magic-search>' +
|
||||||
' <magic-search ' +
|
' <magic-search ' +
|
||||||
|
@ -299,7 +299,7 @@
|
|||||||
* @returns {Item[]}
|
* @returns {Item[]}
|
||||||
*/
|
*/
|
||||||
Item.prototype.path = function (path) {
|
Item.prototype.path = function (path) {
|
||||||
path = typeof path !== 'undefined' ? path : [];
|
path = angular.isDefined(path) ? path : [];
|
||||||
if (this.parent) {
|
if (this.parent) {
|
||||||
this.parent.path(path);
|
this.parent.path(path);
|
||||||
}
|
}
|
||||||
@ -387,7 +387,7 @@
|
|||||||
* @returns {Item[]}
|
* @returns {Item[]}
|
||||||
*/
|
*/
|
||||||
Tree.prototype.flatten = function (branch, items) {
|
Tree.prototype.flatten = function (branch, items) {
|
||||||
items = typeof items !== 'undefined' ? items : [];
|
items = angular.isDefined(items) ? items : [];
|
||||||
|
|
||||||
angular.forEach(branch, function (item) {
|
angular.forEach(branch, function (item) {
|
||||||
items.push(item);
|
items.push(item);
|
||||||
@ -415,7 +415,7 @@
|
|||||||
|
|
||||||
angular.forEach(existing, function (value, key) {
|
angular.forEach(existing, function (value, key) {
|
||||||
var item = itemsMapping[key];
|
var item = itemsMapping[key];
|
||||||
if (typeof item === 'undefined') {
|
if (angular.isUndefined(item)) {
|
||||||
item = new Item().customProperty(key);
|
item = new Item().customProperty(key);
|
||||||
this.flatTree.push(item);
|
this.flatTree.push(item);
|
||||||
}
|
}
|
||||||
|
@ -30,10 +30,10 @@
|
|||||||
function TableController($scope) {
|
function TableController($scope) {
|
||||||
var ctrl = this;
|
var ctrl = this;
|
||||||
|
|
||||||
/*eslint-disable angular/ng_controller_as */
|
/*eslint-disable angular/controller-as */
|
||||||
$scope.selected = {};
|
$scope.selected = {};
|
||||||
$scope.numSelected = 0;
|
$scope.numSelected = 0;
|
||||||
/*eslint-enable angular/ng_controller_as */
|
/*eslint-enable angular/controller-as */
|
||||||
|
|
||||||
ctrl.isSelected = isSelected;
|
ctrl.isSelected = isSelected;
|
||||||
ctrl.select = select;
|
ctrl.select = select;
|
||||||
|
@ -234,14 +234,14 @@
|
|||||||
expandIcon.click();
|
expandIcon.click();
|
||||||
expandIcon.click();
|
expandIcon.click();
|
||||||
|
|
||||||
/*eslint-disable angular/ng_timeout_service */
|
/*eslint-disable angular/timeout-service */
|
||||||
// Wait for the slide down animation to complete before test
|
// Wait for the slide down animation to complete before test
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
var summaryRow = expandIcon.closest('tr');
|
var summaryRow = expandIcon.closest('tr');
|
||||||
expect(summaryRow.hasClass('expanded')).toBe(false);
|
expect(summaryRow.hasClass('expanded')).toBe(false);
|
||||||
done();
|
done();
|
||||||
}, 2000);
|
}, 2000);
|
||||||
/*eslint-enable angular/ng_timeout_service */
|
/*eslint-enable angular/timeout-service */
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
function ModalContainerController($scope, $modalInstance, launchContext) {
|
function ModalContainerController($scope, $modalInstance, launchContext) {
|
||||||
// $scope is used because the methods are shared between
|
// $scope is used because the methods are shared between
|
||||||
// wizard and modal-container controller
|
// wizard and modal-container controller
|
||||||
/*eslint-disable angular/ng_controller_as */
|
/*eslint-disable angular/controller-as */
|
||||||
$scope.launchContext = launchContext;
|
$scope.launchContext = launchContext;
|
||||||
$scope.close = function(args) {
|
$scope.close = function(args) {
|
||||||
$modalInstance.close(args);
|
$modalInstance.close(args);
|
||||||
@ -40,6 +40,6 @@
|
|||||||
$scope.cancel = function() {
|
$scope.cancel = function() {
|
||||||
$modalInstance.dismiss();
|
$modalInstance.dismiss();
|
||||||
};
|
};
|
||||||
/*eslint-enable angular/ng_controller_as */
|
/*eslint-enable angular/controller-as */
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
var viewModel = $scope.viewModel = {};
|
var viewModel = $scope.viewModel = {};
|
||||||
var initTask = $q.defer();
|
var initTask = $q.defer();
|
||||||
|
|
||||||
/*eslint-disable angular/ng_controller_as */
|
/*eslint-disable angular/controller-as */
|
||||||
$scope.initPromise = initTask.promise;
|
$scope.initPromise = initTask.promise;
|
||||||
$scope.currentIndex = -1;
|
$scope.currentIndex = -1;
|
||||||
$scope.workflow = $scope.workflow || {};
|
$scope.workflow = $scope.workflow || {};
|
||||||
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
$scope.switchTo = switchTo;
|
$scope.switchTo = switchTo;
|
||||||
$scope.showError = showError;
|
$scope.showError = showError;
|
||||||
/*eslint-enable angular/ng_controller_as */
|
/*eslint-enable angular/controller-as */
|
||||||
|
|
||||||
viewModel.btnText = extend({}, wizardLabels, $scope.workflow.btnText);
|
viewModel.btnText = extend({}, wizardLabels, $scope.workflow.btnText);
|
||||||
viewModel.btnIcon = $scope.workflow.btnIcon || {};
|
viewModel.btnIcon = $scope.workflow.btnIcon || {};
|
||||||
@ -78,10 +78,10 @@
|
|||||||
from: $scope.currentIndex,
|
from: $scope.currentIndex,
|
||||||
to: index
|
to: index
|
||||||
});
|
});
|
||||||
/*eslint-disable angular/ng_controller_as */
|
/*eslint-disable angular/controller-as */
|
||||||
$scope.currentIndex = index;
|
$scope.currentIndex = index;
|
||||||
$scope.openHelp = false;
|
$scope.openHelp = false;
|
||||||
/*eslint-enable angular/ng_controller_as*/
|
/*eslint-enable angular/controller-as*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function showError(errorMessage) {
|
function showError(errorMessage) {
|
||||||
@ -97,9 +97,9 @@
|
|||||||
|
|
||||||
function afterSubmit(args) {
|
function afterSubmit(args) {
|
||||||
$scope.$broadcast(wizardEvents.AFTER_SUBMIT);
|
$scope.$broadcast(wizardEvents.AFTER_SUBMIT);
|
||||||
/*eslint-disable angular/ng_controller_as */
|
/*eslint-disable angular/controller-as */
|
||||||
$scope.close(args);
|
$scope.close(args);
|
||||||
/*eslint-enable angular/ng_controller_as */
|
/*eslint-enable angular/controller-as */
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClickFinishBtn() {
|
function onClickFinishBtn() {
|
||||||
@ -184,12 +184,12 @@
|
|||||||
|
|
||||||
function switchToFirstReadyStep() {
|
function switchToFirstReadyStep() {
|
||||||
forEach(steps, function (step, index) {
|
forEach(steps, function (step, index) {
|
||||||
/*eslint-disable angular/ng_controller_as */
|
/*eslint-disable angular/controller-as */
|
||||||
if ($scope.currentIndex < 0 && step.ready) {
|
if ($scope.currentIndex < 0 && step.ready) {
|
||||||
$scope.currentIndex = index;
|
$scope.currentIndex = index;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*eslint-enable angular/ng_controller_as */
|
/*eslint-enable angular/controller-as */
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,10 +29,10 @@
|
|||||||
function LaunchInstanceWizardController($scope, launchInstanceModel, launchInstanceWorkflow) {
|
function LaunchInstanceWizardController($scope, launchInstanceModel, launchInstanceWorkflow) {
|
||||||
// Note: we set these attributes on the $scope so that the scope inheritance used all
|
// Note: we set these attributes on the $scope so that the scope inheritance used all
|
||||||
// through the launch instance wizard continues to work.
|
// through the launch instance wizard continues to work.
|
||||||
$scope.workflow = launchInstanceWorkflow; // eslint-disable-line angular/ng_controller_as
|
$scope.workflow = launchInstanceWorkflow; // eslint-disable-line angular/controller-as
|
||||||
$scope.model = launchInstanceModel; // eslint-disable-line angular/ng_controller_as
|
$scope.model = launchInstanceModel; // eslint-disable-line angular/controller-as
|
||||||
$scope.model.initialize(true);
|
$scope.model.initialize(true);
|
||||||
$scope.submit = $scope.model.createInstance; // eslint-disable-line angular/ng_controller_as
|
$scope.submit = $scope.model.createInstance; // eslint-disable-line angular/controller-as
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -76,10 +76,10 @@
|
|||||||
function onDeleteSuccess(e, removedImageIds) {
|
function onDeleteSuccess(e, removedImageIds) {
|
||||||
ctrl.imagesSrc = difference(ctrl.imagesSrc, removedImageIds, 'id');
|
ctrl.imagesSrc = difference(ctrl.imagesSrc, removedImageIds, 'id');
|
||||||
|
|
||||||
/* eslint-disable angular/ng_controller_as */
|
/* eslint-disable angular/controller-as */
|
||||||
$scope.selected = {};
|
$scope.selected = {};
|
||||||
$scope.numSelected = 0;
|
$scope.numSelected = 0;
|
||||||
/* eslint-enable angular/ng_controller_as */
|
/* eslint-enable angular/controller-as */
|
||||||
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
angular
|
angular
|
||||||
.module('horizon.app.core.openstack-service-api')
|
.module('horizon.app.core.openstack-service-api')
|
||||||
.service('horizon.app.core.openstack-service-api.heat', heatAPI);
|
.factory('horizon.app.core.openstack-service-api.heat', heatAPI);
|
||||||
|
|
||||||
heatAPI.$inject = [
|
heatAPI.$inject = [
|
||||||
'horizon.framework.util.http.service',
|
'horizon.framework.util.http.service',
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
angular
|
angular
|
||||||
.module('horizon.app.core.openstack-service-api')
|
.module('horizon.app.core.openstack-service-api')
|
||||||
.service('horizon.app.core.openstack-service-api.policy', PolicyService);
|
.factory('horizon.app.core.openstack-service-api.policy', PolicyService);
|
||||||
|
|
||||||
PolicyService.$inject = [
|
PolicyService.$inject = [
|
||||||
'$q',
|
'$q',
|
||||||
|
@ -132,11 +132,10 @@
|
|||||||
// does not have the requested child object.
|
// does not have the requested child object.
|
||||||
settingAtRequestedPath = pathElements.reduce(
|
settingAtRequestedPath = pathElements.reduce(
|
||||||
function (setting, nextPathElement) {
|
function (setting, nextPathElement) {
|
||||||
return setting ? setting[nextPathElement] : undefined;
|
return setting ? setting[nextPathElement] : undefined;//eslint-disable-line no-undefined
|
||||||
}, settings);
|
}, settings);
|
||||||
|
|
||||||
if (typeof settingAtRequestedPath === "undefined" &&
|
if (angular.isUndefined(settingAtRequestedPath) && angular.isDefined(defaultSetting)) {
|
||||||
(typeof defaultSetting !== "undefined")) {
|
|
||||||
settingAtRequestedPath = defaultSetting;
|
settingAtRequestedPath = defaultSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +242,7 @@
|
|||||||
|
|
||||||
// If expected is not defined, we default to expecting the setting
|
// If expected is not defined, we default to expecting the setting
|
||||||
// to be 'true' in order for it to be considered enabled.
|
// to be 'true' in order for it to be considered enabled.
|
||||||
expected = (typeof expected === "undefined") ? true : expected;
|
expected = angular.isUndefined(expected) ? true : expected;
|
||||||
|
|
||||||
function onSettingLoaded(setting) {
|
function onSettingLoaded(setting) {
|
||||||
if (angular.equals(expected, setting)) {
|
if (angular.equals(expected, setting)) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "1.2.1",
|
"eslint": "1.2.1",
|
||||||
"eslint-config-openstack": "1.2.3",
|
"eslint-config-openstack": "1.2.3",
|
||||||
"eslint-plugin-angular": "0.4.0",
|
"eslint-plugin-angular": "0.15.0",
|
||||||
"jasmine-core": "2.2.0",
|
"jasmine-core": "2.2.0",
|
||||||
"karma": "0.12.31",
|
"karma": "0.12.31",
|
||||||
"karma-chrome-launcher": "0.1.8",
|
"karma-chrome-launcher": "0.1.8",
|
||||||
|
Loading…
Reference in New Issue
Block a user