Skip to content

Commit

Permalink
(core): upgrade core libs and fix resulting issues
Browse files Browse the repository at this point in the history
* updated core configuration for Typescript and linting and fixed errors
resulting from upgrade and rules enacted.
  • Loading branch information
icfantv committed Feb 3, 2017
1 parent e139650 commit 17b9714
Show file tree
Hide file tree
Showing 52 changed files with 105 additions and 165 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

10 changes: 8 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"rules": {
"eol-last": 1,
"semi": 2,
"quotes": [1, "single"],
"quotes": [1, "single", { "allowTemplateLiterals": true }],
"comma-dangle": 0,
"no-extra-boolean-cast": 1,
"no-unused-vars": 1,
Expand All @@ -22,7 +22,7 @@
"no-underscore-dangle": 1,
"no-shadow": 0, // TODO
"no-unexpected-multiline": 1,
"consistent-return": 1,
"consistent-return": 0, // ANG, shutting this off for now....it's a bit chatty
"no-extend-native": 1,
"space-before-blocks": 1,
"semi-spacing": 1,
Expand All @@ -32,6 +32,12 @@
"operator-assignment": [1, "always"],
"no-const-assign": 1,
"no-console": 1,
"no-control-regex": 0,
"no-case-declarations": 0,
"no-empty-pattern": 0
},
"parserOptions": {
"sourceType": "module"
},
"env": {
"browser": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class AppengineCacheConfigurer {
initializers: [(): ng.IPromise<ILoadBalancer[]> => this.loadBalancerReader.listLoadBalancers('appengine')]
};

static get $inject() { return ['$q', 'accountService', 'loadBalancerReader']; }
static get $inject() { return ['accountService', 'loadBalancerReader']; }

constructor(private $q: ng.IQService, private accountService: AccountService, private loadBalancerReader: any) { }
constructor(private accountService: AccountService, private loadBalancerReader: any) { }
}

export const APPENGINE_CACHE_CONFIGURER = 'spinnaker.appengine.cacheConfigurer.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ import {IModalService} from 'angular-ui-bootstrap';
import {cloneDeep, get} from 'lodash';

import {CloudProviderRegistry} from 'core/cloudProvider/cloudProvider.registry';
import {LoadBalancerReader} from 'core/loadBalancer/loadBalancer.read.service';
import {ILoadBalancer} from 'core/domain/index';
import {APPENGINE_LOAD_BALANCER_CHOICE_MODAL_CTRL} from './loadBalancerChoice.modal.controller';

class AppengineEditLoadBalancerStageCtrl {
static get $inject() { return ['$scope', '$uibModal', 'cloudProviderRegistry', 'loadBalancerReader']; }
static get $inject() { return ['$scope', '$uibModal', 'cloudProviderRegistry']; }

constructor(public $scope: any,
private $uibModal: IModalService,
private cloudProviderRegistry: CloudProviderRegistry,
private loadBalancerReader: LoadBalancerReader) {
private cloudProviderRegistry: CloudProviderRegistry) {
$scope.stage.loadBalancers = $scope.stage.loadBalancers || [];
$scope.stage.cloudProvider = 'appengine';
}
Expand All @@ -30,7 +28,7 @@ class AppengineEditLoadBalancerStageCtrl {
});
}

public editLoadBalancer(loadBalancer: ILoadBalancer, index: number) {
public editLoadBalancer(index: number) {
let config = this.cloudProviderRegistry.getValue('appengine', 'loadBalancer');
this.$uibModal.open({
templateUrl: config.createLoadBalancerTemplateUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h4 class="text-left">Load Balancers</h4>
{{ loadBalancer.region }}
</td>
<td class="condensed-actions">
<a class="btn btn-sm btn-link" href ng-click="editLoadBalancerStageCtrl.editLoadBalancer(loadBalancer, $index)">
<a class="btn btn-sm btn-link" href ng-click="editLoadBalancerStageCtrl.editLoadBalancer($index)">
<span class="glyphicon glyphicon-edit" uib-tooltip="Edit"></span></a>
<a class="btn btn-sm btn-link pad-left" href ng-click="editLoadBalancerStageCtrl.removeLoadBalancer($index)">
<span class="glyphicon glyphicon-trash" uib-tooltip="Remove"></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {module} from 'angular';
import {IModalService, IModalServiceInstance} from 'angular-ui-bootstrap';
import {cloneDeep} from 'lodash';

import {LoadBalancerReader} from 'core/loadBalancer/loadBalancer.read.service';
import {CloudProviderRegistry} from 'core/cloudProvider/cloudProvider.registry';
import {Application} from 'core/application/application.model';
import {ILoadBalancer} from 'core/domain/loadBalancer';
Expand All @@ -12,12 +11,11 @@ class AppengineLoadBalancerChoiceModalCtrl {
public loadBalancers: ILoadBalancer[];
public selectedLoadBalancer: ILoadBalancer;

static get $inject() { return ['$uibModal', '$uibModalInstance', 'application', 'loadBalancerReader', 'cloudProviderRegistry']; }
static get $inject() { return ['$uibModal', '$uibModalInstance', 'application', 'cloudProviderRegistry']; }

constructor(private $uibModal: IModalService,
private $uibModalInstance: IModalServiceInstance,
private application: Application,
private loadBalancerReader: LoadBalancerReader,
private cloudProviderRegistry: CloudProviderRegistry) {
this.initialize();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ export class AppengineServerGroupCommandBuilder {
});
}

public buildNewServerGroupCommandForPipeline(stage: IStage, pipeline: IPipeline): {backingData: {triggerOptions: Array<IAppengineGitTrigger | IAppengineJenkinsTrigger>}} {
public buildNewServerGroupCommandForPipeline(_stage: IStage, pipeline: IPipeline): {backingData: {triggerOptions: Array<IAppengineGitTrigger | IAppengineJenkinsTrigger>}} {
// We can't copy server group configuration for App Engine, and can't build the full command here because we don't have
// access to the application.
return {backingData: {triggerOptions: AppengineServerGroupCommandBuilder.getTriggerOptions(pipeline)}};
}

public buildServerGroupCommandFromPipeline(app: Application,
cluster: AppengineDeployDescription,
stage: IStage,
_stage: IStage,
pipeline: IPipeline): ng.IPromise<IAppengineServerGroupCommand> {
return this.buildNewServerGroupCommand(app, 'appengine', 'editPipeline')
.then((command: IAppengineServerGroupCommand) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class AppengineCloneServerGroupCtrl {

static get $inject() { return ['$scope',
'$uibModalInstance',
'title',
'serverGroupCommand',
'application',
'taskMonitorBuilder',
Expand All @@ -30,12 +29,11 @@ class AppengineCloneServerGroupCtrl {

constructor(public $scope: any,
private $uibModalInstance: any,
private title: string,
public serverGroupCommand: IAppengineServerGroupCommand,
private application: Application,
private taskMonitorBuilder: TaskMonitorBuilder,
taskMonitorBuilder: TaskMonitorBuilder,
private serverGroupWriter: ServerGroupWriter,
private commandBuilder: AppengineServerGroupCommandBuilder) {
commandBuilder: AppengineServerGroupCommandBuilder) {

if (['create', 'editPipeline'].includes(get<string>(serverGroupCommand, 'viewState.mode'))) {
$scope.command = serverGroupCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe ('Application Model', function () {
spyOn(loadBalancerReader, 'loadLoadBalancers').and.returnValue($q.when(loadBalancers));
spyOn(clusterService, 'loadServerGroups').and.returnValue($q.when(serverGroups));
spyOn(securityGroupReader, 'loadSecurityGroups').and.returnValue($q.when([]));
spyOn(securityGroupReader, 'getApplicationSecurityGroups').and.callFake(function(app: Application, groupsByName: any[]) {
spyOn(securityGroupReader, 'getApplicationSecurityGroups').and.callFake(function(_app: Application, groupsByName: any[]) {
return $q.when(groupsByName || []);
});
application = applicationModelBuilder.createApplication(applicationDataSourceRegistry.getDataSources());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ describe('Controller: ApplicationProviderFieldsCtrl', function () {
scope,
cloudProviderRegistry,
settings,
angular = require('angular'),
_ = require('lodash');

beforeEach(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ApplicationNameValidationMessagesController implements ng.IComponentContro

public constructor(private applicationNameValidator: ApplicationNameValidator) {}

public $onChanges(changes: ng.IOnChangesObject): void {
public $onChanges(): void {
this.applicationNameValidator.validate(this.name, this.cloudProviders).then(r => this.messages = r);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {module} from 'angular';
import { DirectiveFactory } from '../../../utils/tsDecorators/directiveFactoryDecorator';
import { DirectiveFactory } from 'core/utils/tsDecorators/directiveFactoryDecorator';
import {
APPLICATION_NAME_VALIDATOR,
ApplicationNameValidator, IApplicationNameValidationResult
Expand Down Expand Up @@ -52,7 +52,7 @@ class ValidateApplicationNameDirective implements ng.IDirective {
cloudProviders: '<',
};

link($scope: ng.IScope, $element: JQuery, $attrs: IValidateNameAttrs, ctrl: ng.INgModelController) {
link($scope: ng.IScope, _$element: JQuery, $attrs: IValidateNameAttrs, ctrl: ng.INgModelController) {
const $ctrl: ValidateApplicationNameController = $scope['$ctrl'];
$ctrl.$scope = $scope;
$ctrl.$attrs = $attrs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('Service: applicationReader', function () {
spyOn(loadBalancerReader, 'loadLoadBalancers').and.returnValue($q.when([]));
spyOn(clusterService, 'loadServerGroups').and.returnValue($q.when([]));
spyOn(securityGroupReader, 'loadSecurityGroups').and.returnValue($q.when([]));
spyOn(securityGroupReader, 'getApplicationSecurityGroups').and.callFake(function(app: Application, groupsByName: any) {
spyOn(securityGroupReader, 'getApplicationSecurityGroups').and.callFake(function(_app: Application, groupsByName: any) {
return $q.when(groupsByName || []);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ export interface IApplicationAttributes {

export class ApplicationWriter {

static get $inject() { return ['$q', 'taskExecutor', 'recentHistoryService']; }
static get $inject() { return ['taskExecutor', 'recentHistoryService']; }

public constructor(private $q: ng.IQService,
private taskExecutor: TaskExecutor,
public constructor(private taskExecutor: TaskExecutor,
private recentHistoryService: RecentHistoryService) {}

public createApplication(application: IApplicationAttributes): ng.IPromise<any> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import './chaosMonkeyExceptions.component.less';

export class ChaosMonkeyExceptionsController {

static get $inject() { return ['accountService', '$q']; }
static get $inject() { return ['accountService']; }

public accounts: IAccountDetails[] = [];
public regionsByAccount: any;
public config: any;
public configChanged: () => void;

public constructor(private accountService: AccountService, private $q: ng.IQService) {}
public constructor(private accountService: AccountService) {}

public addException(): void {
this.config.exceptions = this.config.exceptions || [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class ChaosMonkeyNewApplicationConfigController {
public enabled: boolean = false;
public applicationConfig: any;

public constructor(private settings: any) {
public constructor(settings: any) {
this.enabled = settings.feature && settings.feature.chaosMonkey;
if (this.enabled) {
this.applicationConfig.chaosMonkey = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ export class ExecutionDetailsSectionService {

private pendingOnComplete: ng.IPromise<any>;

static get $inject() { return ['$stateParams', '$state', '$q', '$timeout']; }
static get $inject() { return ['$stateParams', '$state', '$timeout']; }

public constructor(private $stateParams: IExecutionDetailsStateParams,
private $state: angular.ui.IStateService,
private $q: ng.IQService,
private $timeout: ng.ITimeoutService) {}

private sectionIsValid(availableSections: string[]): boolean {
Expand Down
1 change: 0 additions & 1 deletion app/scripts/modules/core/domain/IExecution.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {IOrchestratedItem} from './IOrchestratedItem';
import {ITrigger} from './ITrigger';
import {IExecutionTrigger} from './IExecutionTrigger';
import {IExecutionStage} from './IExecutionStage';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {IEntityRef} from 'core/domain/IEntityTags';
import {ENTITY_TAG_EDITOR_CTRL, EntityTagEditorCtrl, IOwnerOption} from './entityTagEditor.controller';
import {ENTITY_TAGS_HELP} from './entityTags.help';
import {Application} from 'core/application/application.model';
import {ENTITY_TAG_WRITER, EntityTagWriter} from './entityTags.write.service';

import './entityTagDetails.component.less';

Expand All @@ -19,10 +18,9 @@ class AddEntityTagLinksCtrl implements ng.IComponentController {
private onUpdate: () => any;
private ownerOptions: IOwnerOption[];

static get $inject() { return ['$uibModal', 'confirmationModalService', 'entityTagWriter']; }
static get $inject() { return ['$uibModal']; }

public constructor(private $uibModal: IModalService, private confirmationModalService: any,
private entityTagWriter: EntityTagWriter) {}
public constructor(private $uibModal: IModalService) {}

public addTag(tagType: string): void {
this.$uibModal.open({
Expand Down Expand Up @@ -79,7 +77,6 @@ class AddEntityTagLinksComponent implements ng.IComponentOptions {
export const ADD_ENTITY_TAG_LINKS_COMPONENT = 'spinnaker.core.entityTag.details.component';
module(ADD_ENTITY_TAG_LINKS_COMPONENT, [
ENTITY_TAG_EDITOR_CTRL,
ENTITY_TAG_WRITER,
ENTITY_TAGS_HELP
])
.component('addEntityTagLinks', new AddEntityTagLinksComponent());
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {IEntityRef, IEntityTags, IEntityTag} from '../domain/IEntityTags';

export class EntityTagWriter {

static get $inject() { return ['$q', 'taskExecutor']; }
static get $inject() { return ['taskExecutor']; }

public constructor(private $q: ng.IQService, private taskExecutor: TaskExecutor) {}
public constructor(private taskExecutor: TaskExecutor) {}

public upsertEntityTag(application: Application, tag: IEntityTag, entityRef: IEntityRef, isNew: boolean): ng.IPromise<any> {
return this.taskExecutor.executeTask({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ module.exports = angular
},
toModel: function(filterModel, property) {
var val = getParamVal(property);
return !Boolean(val);
return !val;
}
},
'number': {
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/modules/core/history/recentHistory.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class RecentHistoryService {

static get $inject() { return ['deckCacheFactory']; }

constructor(private deckCacheFactory: DeckCacheService) {
constructor(deckCacheFactory: DeckCacheService) {
deckCacheFactory.createCache('history', 'user', {
version: 3,
maxAge: moment.duration(90, 'days').asMilliseconds(),
Expand Down Expand Up @@ -136,7 +136,7 @@ module(RECENT_HISTORY_SERVICE, [
DECK_CACHE_SERVICE,
]).service('recentHistoryService', RecentHistoryService)
.run(($rootScope: ng.IRootScopeService, recentHistoryService: RecentHistoryService) => {
$rootScope.$on('$stateChangeSuccess', (event: IAngularEvent, toState: IState, toParams: any) => {
$rootScope.$on('$stateChangeSuccess', (_event: IAngularEvent, toState: IState, toParams: any) => {
if (toState.data && toState.data.history) {
recentHistoryService.addItem(toState.data.history.type, toState.name, toParams, toState.data.history.keyParams);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ export class V2ModalWizard implements ng.IComponentController {
public taskMonitor: any;
public dismiss: () => any;

public constructor(private $scope: ng.IScope, private v2modalWizardService: any) {
public constructor(private $scope: ng.IScope, v2modalWizardService: any) {
this.wizard = v2modalWizardService;
}

public $onInit() {
this.$scope.$on('waypoints-changed', (event: any, snapshot: any) => {
this.$scope.$on('waypoints-changed', (_event: any, snapshot: any) => {
let ids = snapshot.lastWindow
.map((entry: any) => entry.elem)
.filter((key: string) => this.wizard.getPage(key));
Expand Down
7 changes: 3 additions & 4 deletions app/scripts/modules/core/navigation/state.provider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {module} from 'angular';
import {IStateProvider, IUrlRouterProvider, IState} from 'angular-ui-router';
import {IUrlRouterProvider, IState} from 'angular-ui-router';
import {STATE_HELPER, StateHelper} from './stateHelper.provider';

require('./navigation.less');
Expand All @@ -16,10 +16,9 @@ export class StateConfigProvider implements ng.IServiceProvider {
children: [],
};

static get $inject() { return ['$stateProvider', '$urlRouterProvider', 'stateHelperProvider']; }
static get $inject() { return ['$urlRouterProvider', 'stateHelperProvider']; }

constructor(private $stateProvider: IStateProvider,
private $urlRouterProvider: IUrlRouterProvider,
constructor(private $urlRouterProvider: IUrlRouterProvider,
private stateHelperProvider: StateHelper) {}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class PipelineConfigService {
public constructor(private $q: ng.IQService,
private API: Api,
private authenticationService: AuthenticationService,
private viewStateCache: ViewStateCacheService) {
viewStateCache: ViewStateCacheService) {
this.configViewStateCache = viewStateCache.createCache('pipelineConfig', { version: 1 });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ describe('pipelineConfigValidator', () => {
validationCalled = true;
return 'did not skip';
},
skipValidation: (p: IPipeline, stage: IStage): boolean => {
skipValidation: (_p: IPipeline, stage: IStage): boolean => {
return stage.name === 'skip';
}
} as ICustomValidator
Expand Down Expand Up @@ -892,7 +892,7 @@ describe('pipelineConfigValidator', () => {
return buildStageTypeConfig([
{
type: 'custom',
validate: (p: IPipeline, s: IStage): string => {
validate: (_p: IPipeline, s: IStage): string => {
if (s.name.includes(' ')) {
return 'No spaces in targetCheck stage names';
}
Expand Down
Loading

0 comments on commit 17b9714

Please sign in to comment.