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