Skip to content

Commit

Permalink
chore(tslint): Add prettier-tslint rules, manually fix lint errors th…
Browse files Browse the repository at this point in the history
…at don't have --fix
  • Loading branch information
christopherthielen authored and Justin Reynolds committed Apr 10, 2018
1 parent 532ab77 commit e74be82
Show file tree
Hide file tree
Showing 54 changed files with 239 additions and 504 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class LoadBalancerActions extends React.Component<ILoadBalancerActionsPro

const { app, loadBalancer } = this.props;

let application: Application = undefined;
let application: Application;

const loadBalancerAppName = loadBalancer.name.split('-')[0];
if (loadBalancerAppName === app.name) {
Expand Down
15 changes: 4 additions & 11 deletions app/scripts/modules/amazon/src/reactShims/aws.ngReact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,21 @@ import { ReactInject } from '@spinnaker/core';
import { ScalingPolicyDetailsSummary } from 'amazon/serverGroup/details/scalingPolicy/detailsSummary.component';
import { IScalingPolicySummaryProps } from 'amazon/serverGroup/details/scalingPolicy/ScalingPolicySummary';

// prettier-ignore
export class AwsNgReactInjector extends ReactInject {
public $injectorProxy = {} as IInjectorService;

// Reactified components
public ScalingPolicySummary: React.ComponentClass<IScalingPolicySummaryProps> = angular2react(
'scalingPolicySummary',
new ScalingPolicyDetailsSummary(),
this.$injectorProxy,
) as any;
public SubnetSelectField: React.ComponentClass<ISubnetSelectFieldProps> = angular2react(
'subnetSelectFieldWrapper',
new SubnetSelectFieldWrapperComponent(),
this.$injectorProxy,
) as any;
public ScalingPolicySummary: React.ComponentClass<IScalingPolicySummaryProps> = angular2react('scalingPolicySummary', new ScalingPolicyDetailsSummary(), this.$injectorProxy) as any;
public SubnetSelectField: React.ComponentClass<ISubnetSelectFieldProps> = angular2react('subnetSelectFieldWrapper', new SubnetSelectFieldWrapperComponent(), this.$injectorProxy) as any;

public initialize($injector: IInjectorService) {
const realInjector: { [key: string]: Function } = $injector as any;
const proxyInjector: { [key: string]: Function } = this.$injectorProxy as any;

Object.keys($injector)
.filter(key => typeof realInjector[key] === 'function')
.forEach(key => (proxyInjector[key] = realInjector[key].bind(realInjector)));
.forEach(key => proxyInjector[key] = realInjector[key].bind(realInjector));
}
}

Expand Down
26 changes: 8 additions & 18 deletions app/scripts/modules/amazon/src/reactShims/aws.react.injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,15 @@ import { AwsServerGroupTransformer } from '../serverGroup/serverGroup.transforme
import { AwsLoadBalancerTransformer } from '../loadBalancer/loadBalancer.transformer';
import { VpcReader } from '../vpc/vpc.read.service';

// prettier-ignore
export class AwsReactInject extends ReactInject {
public get amazonCertificateReader() {
return this.$injector.get('amazonCertificateReader') as AmazonCertificateReader;
}
public get autoScalingProcessService() {
return this.$injector.get('autoScalingProcessService') as any;
}
public get awsLoadBalancerTransformer() {
return this.$injector.get('awsLoadBalancerTransformer') as AwsLoadBalancerTransformer;
}
public get awsServerGroupCommandBuilder() {
return this.$injector.get('awsServerGroupCommandBuilder') as any;
}
public get awsServerGroupTransformer() {
return this.$injector.get('awsServerGroupTransformer') as AwsServerGroupTransformer;
}
public get vpcReader() {
return this.$injector.get('vpcReader') as VpcReader;
}
public get amazonCertificateReader() { return this.$injector.get('amazonCertificateReader') as AmazonCertificateReader; }
public get autoScalingProcessService() { return this.$injector.get('autoScalingProcessService') as any; }
public get awsLoadBalancerTransformer() { return this.$injector.get('awsLoadBalancerTransformer') as AwsLoadBalancerTransformer; }
public get awsServerGroupCommandBuilder() { return this.$injector.get('awsServerGroupCommandBuilder') as any; }
public get awsServerGroupTransformer() { return this.$injector.get('awsServerGroupTransformer') as AwsServerGroupTransformer; }
public get vpcReader() { return this.$injector.get('vpcReader') as VpcReader; }

public initialize($injector: IInjectorService) {
this.$injector = $injector;
}
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/modules/core/src/api/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '../authentication/authentication.initializer.service';
import { SETTINGS } from 'core/config/settings';

interface DefaultParams {
interface IDefaultParams {
timeout: number;
headers: { [key: string]: string };
}
Expand All @@ -26,7 +26,7 @@ export interface IRequestBuilder {

export class Api {
private gateUrl: string;
private defaultParams: DefaultParams;
private defaultParams: IDefaultParams;

constructor(
private $q: IQService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export interface IDataSourceConfig {
* (Optional) The application has potentially two default fields for each provider: region and credentials. These fields will
* only have a value if every data source that contributes values has just one unique value for each provider. Useful
* for setting initial values in modal dialogs when creating new server groups, load balancers, etc.
* If the data source should contribute to the application's default region or credentials, this field should be set
* to the field name that represents the provider on each data item.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import { Application } from 'core/application/application.model';
import { mock, IQService, IScope, IRootScopeService } from 'angular';
import { IModalService } from 'angular-ui-bootstrap';

import { ACCOUNT_SERVICE, AccountService } from 'core/account/account.service';
import { ACCOUNT_SERVICE, AccountService, IAccountDetails } from 'core/account/account.service';
import { CLOUD_PROVIDER_REGISTRY, CloudProviderRegistry } from 'core/cloudProvider/cloudProvider.registry';
import { PROVIDER_SELECTION_SERVICE, ProviderSelectionService } from './providerSelection.service';
import { SETTINGS } from 'core/config/settings';

import { IAccountDetails } from 'core/account/account.service';

function fakeAccount(provider: string): IAccountDetails {
return {
cloudProvider: provider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { IModalService } from 'angular-ui-bootstrap';
import { IPromise, module, IQService } from 'angular';
import { uniq } from 'lodash';

import { IAccountDetails } from 'core/account/account.service';

import { ACCOUNT_SERVICE, AccountService } from 'core/account/account.service';
import { IAccountDetails, ACCOUNT_SERVICE, AccountService } from 'core/account/account.service';
import { Application } from 'core/application/application.model';
import {
CLOUD_PROVIDER_REGISTRY,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { module } from 'angular';

import { IComponentOptions } from 'angular';
import { module, IComponentOptions } from 'angular';

export interface ICommit {
authorDisplayName: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { IController, IComponentOptions, module } from 'angular';
import { IModalInstanceService, IModalService } from 'angular-ui-bootstrap';

import { IBuildDiffInfo, ICreationMetadata, ICreationMetadataTag, IJenkinsInfo } from 'core/domain';
import { ICommit } from './commitHistory.component';
import { COMMIT_HISTORY_COMPONENT } from './commitHistory.component';
import { ICommit, COMMIT_HISTORY_COMPONENT } from './commitHistory.component';
import { EXECUTION_SERVICE, ExecutionService } from 'core/pipeline/service/execution.service';
import { JAR_DIFF_COMPONENT, IJarDiff } from './jarDiff.component';

Expand Down
4 changes: 2 additions & 2 deletions app/scripts/modules/core/src/domain/IJobConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface ParameterDefinitionList {
export interface IParameterDefinitionList {
defaultValue: string;
description?: string;
name: string;
Expand All @@ -10,6 +10,6 @@ export interface IJobConfig {
description: string;
displayName: string;
name: string;
parameterDefinitionList: ParameterDefinitionList[];
parameterDefinitionList: IParameterDefinitionList[];
url: string;
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { mock } from 'angular';
import { NUMBER_LIST_COMPONENT, NumberListConstraints } from './numberList.component';
import { NUMBER_LIST_COMPONENT, INumberListConstraints } from './numberList.component';

describe('Component: numberList', () => {
let $compile: ng.ICompileService,
model: number[],
stringModel: string,
$scope: ng.IScope,
elem: any,
constraints: NumberListConstraints,
constraints: INumberListConstraints,
onChange: () => any;

beforeEach(mock.module(NUMBER_LIST_COMPONENT));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { IController, IComponentOptions, module } from 'angular';
import './numberList.component.less';

export interface NumberListConstraints {
export interface INumberListConstraints {
min: number;
max: number;
}

export class NumberListController implements IController {
public model: number[] | string;
public constraints: NumberListConstraints;
public constraints: INumberListConstraints;
public label: string;
public backingModel: number[];
public parameterized: boolean;
Expand Down
3 changes: 1 addition & 2 deletions app/scripts/modules/core/src/instance/instance.states.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { module } from 'angular';
import { StateParams } from '@uirouter/angularjs';

import { APPLICATION_STATE_PROVIDER, ApplicationStateProvider } from 'core/application';
import { APPLICATION_STATE_PROVIDER, ApplicationStateProvider, Application } from 'core/application';
import { INestedState, STATE_CONFIG_PROVIDER, StateConfigProvider } from 'core/navigation';
import { Application } from 'core/application';
import { SkinService } from 'core/cloudProvider';

import { ApplicationModelBuilder } from '../application/applicationModel.builder';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ILogService, module } from 'angular';
import { chain, find, forOwn, groupBy, includes, intersection, map, some, sortBy, values, without } from 'lodash';
import { Debounce } from 'lodash-decorators';
import { Debounce, BindAll } from 'lodash-decorators';
import { Subject } from 'rxjs';
import { BindAll } from 'lodash-decorators';

import { Application } from 'core/application/application.model';
import { ILoadBalancer, ILoadBalancerGroup, IInstance, IServerGroup } from 'core/domain';
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/modules/core/src/modal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export * from './wizard/WizardModal';
export * from './wizard/WizardPage';
export { V2_MODAL_WIZARD_COMPONENT, V2ModalWizard } from './wizard/v2modalWizard.component';
export {
WizardPage,
IWizardPage,
V2_MODAL_WIZARD_SERVICE,
V2ModalWizardService,
WizardPageState,
IWizardPageState,
} from './wizard/v2modalWizard.service';
20 changes: 10 additions & 10 deletions app/scripts/modules/core/src/modal/wizard/v2modalWizard.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { module } from 'angular';
import { SCROLL_TO_SERVICE, ScrollToService } from 'core/utils/scrollTo/scrollTo.service';

export interface WizardPageState {
export interface IWizardPageState {
done: boolean;
blocked: boolean;
rendered: boolean;
Expand All @@ -11,16 +11,16 @@ export interface WizardPageState {
required: boolean;
}

export interface WizardPage {
state: WizardPageState;
export interface IWizardPage {
state: IWizardPageState;
key: string;
label: string;
}

export class V2ModalWizardService {
public renderedPages: WizardPage[] = [];
public pageRegistry: WizardPage[] = [];
public currentPage: WizardPage;
public renderedPages: IWizardPage[] = [];
public pageRegistry: IWizardPage[] = [];
public currentPage: IWizardPage;
public heading: string;

public constructor(private scrollToService: ScrollToService) {}
Expand All @@ -29,7 +29,7 @@ export class V2ModalWizardService {
this.heading = heading;
}

public getPage(key: string): WizardPage {
public getPage(key: string): IWizardPage {
return this.pageRegistry.find(p => p.key === key);
}

Expand All @@ -49,7 +49,7 @@ export class V2ModalWizardService {
this.getPage(key).state.done = false;
}

public setCurrentPage(page: WizardPage, skipScroll?: boolean): void {
public setCurrentPage(page: IWizardPage, skipScroll?: boolean): void {
this.pageRegistry.forEach(test => (test.state.current = test === page));
this.currentPage = page;
this.markClean(page.key);
Expand All @@ -63,7 +63,7 @@ export class V2ModalWizardService {
}
}

public registerPage(key: string, label: string, state?: WizardPageState): void {
public registerPage(key: string, label: string, state?: IWizardPageState): void {
state = state || {
done: false,
blocked: true,
Expand All @@ -78,7 +78,7 @@ export class V2ModalWizardService {
}

public renderPages(): void {
const renderedPages: WizardPage[] = this.pageRegistry.filter(page => page.state.rendered);
const renderedPages: IWizardPage[] = this.pageRegistry.filter(page => page.state.rendered);
this.renderedPages = renderedPages;
if (renderedPages.length === 1) {
this.setCurrentPage(renderedPages[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { V2_MODAL_WIZARD_SERVICE } from './v2modalWizard.service';
* scrolled into view
*/

export interface WizardPageState {
export interface IWizardPageState {
rendered: boolean;
done: boolean;
dirty: boolean;
Expand Down Expand Up @@ -68,7 +68,7 @@ export class WizardPageController implements IController {
/**
* Internal state of the page, initialized based on other public fields
*/
public state: WizardPageState;
public state: IWizardPageState;

public constructor(private $scope: ng.IScope, private v2modalWizardService: any) {
'ngInject';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ interface IClusterFilter {
}

class UrlBuilderUtils {
private static forEachSorted(obj: any, iterator: Function, context: any = undefined): void {
private static forEachSorted(obj: any, iterator: Function, context?: any): void {
const keys: string[] = Object.keys(obj).sort();
keys.forEach((key: string) => {
iterator.call(context, obj[key], key);
Expand Down
3 changes: 1 addition & 2 deletions app/scripts/modules/core/src/pagerDuty/PageModal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { IDeferred } from 'angular';
import { IModalServiceInstance } from 'angular-ui-bootstrap';
import * as React from 'react';
import { MouseEvent } from 'react';
import { Button, Modal } from 'react-bootstrap';
import { get } from 'lodash';
import { BindAll } from 'lodash-decorators';
Expand Down Expand Up @@ -75,7 +74,7 @@ export class PageModal extends React.Component<IPageModalProps, IPageModalState>
};
}

public close(evt?: MouseEvent<any>): void {
public close(evt?: React.MouseEvent<any>): void {
evt && evt.stopPropagation();
this.setState(this.getDefaultState(this.props));
this.props.closeCallback(false);
Expand Down
Loading

0 comments on commit e74be82

Please sign in to comment.