Skip to content

Commit

Permalink
fix(eslint): Fix eslint warnings for no-case-declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Feb 14, 2019
1 parent 3470a3a commit 8cba7ac
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class CloudfoundryDeployServiceStageConfig extends React.Component<
let manifestInput;

switch (manifest.type) {
case 'direct':
case 'direct': {
const direct = manifest as { type: string } & ICloudfoundryServiceManifestDirectSource;
manifestInput = (
<CreateServiceInstanceDirectInput
Expand All @@ -196,17 +196,20 @@ export class CloudfoundryDeployServiceStageConfig extends React.Component<
/>
);
break;
}
case 'userProvidedArtifact':
case 'artifact':
case 'artifact': {
const artifact = manifest as { type: string } & ICloudfoundryServiceManifestArtifactSource;
manifestInput = (
<CreateServiceInstanceArtifactInput onChange={serviceManifestSourceUpdated} serviceInput={artifact} />
);
break;
case 'userProvided':
}
case 'userProvided': {
const userProvided = manifest as { type: string } & ICloudFoundryServiceUserProvidedSource;
manifestInput = <CreateUserProvidedInput onChange={serviceManifestSourceUpdated} serviceInput={userProvided} />;
break;
}
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class CloudFoundryServerGroupConfigurationSettings
implements IWizardPageComponent<ICloudFoundryCreateServerGroupCommand> {
private manifestTypeUpdated = (type: string): void => {
switch (type) {
case 'artifact':
case 'artifact': {
const emptyManifestArtifact = {
account: '',
reference: '',
Expand All @@ -48,7 +48,8 @@ export class CloudFoundryServerGroupConfigurationSettings
this.props.formik.setFieldValue('manifest', emptyManifestArtifact);
this.capacityUpdated('1');
break;
case 'trigger':
}
case 'trigger': {
const emptyManifestTrigger = {
account: '',
pattern: '',
Expand All @@ -57,7 +58,8 @@ export class CloudFoundryServerGroupConfigurationSettings
this.props.formik.setFieldValue('manifest', emptyManifestTrigger);
this.capacityUpdated('1');
break;
case 'direct':
}
case 'direct': {
const emptyManifestDirect = {
memory: '1024M',
diskQuota: '1024M',
Expand All @@ -72,6 +74,7 @@ export class CloudFoundryServerGroupConfigurationSettings
};
this.props.formik.setFieldValue('manifest', emptyManifestDirect);
break;
}
}
};

Expand Down
6 changes: 4 additions & 2 deletions app/scripts/modules/core/src/instance/InstanceListBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class InstanceListBody extends React.Component<IInstanceListBodyProps, II
? a.id.localeCompare(b.id)
: a.launchTime - b.launchTime
: a.availabilityZone.localeCompare(b.availabilityZone);
case 'discoveryState':
case 'discoveryState': {
const aHealth = (a.health || []).filter(health => health.type === 'Discovery'),
bHealth = (b.health || []).filter(health => health.type === 'Discovery');
if (aHealth.length && !bHealth.length) {
Expand All @@ -127,7 +127,8 @@ export class InstanceListBody extends React.Component<IInstanceListBodyProps, II
? a.id.localeCompare(b.id)
: a.launchTime - b.launchTime
: aHealth[0].state.localeCompare(bHealth[0].state);
case 'loadBalancerSort':
}
case 'loadBalancerSort': {
const aHealth2 = (a.health || []).filter(health => health.type === 'LoadBalancer');
const bHealth2 = (b.health || []).filter(health => health.type === 'LoadBalancer');

Expand All @@ -144,6 +145,7 @@ export class InstanceListBody extends React.Component<IInstanceListBodyProps, II
? a.id.localeCompare(b.id)
: a.launchTime - b.launchTime
: aHealthStr.localeCompare(bHealthStr);
}
default:
return -1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class PipelineRegistry {
return this.getStageTypes().find(s => s.key === 'unmatched') || null;
case 1:
return matches[0];
default:
default: {
const provider = stage.cloudProvider || stage.cloudProviderType || 'aws';
const matchesForStageCloudProvider = matches.filter(stageType => {
return stageType.cloudProvider === provider;
Expand All @@ -232,6 +232,7 @@ export class PipelineRegistry {
} else {
return matchesForStageCloudProvider[0];
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class TemplateAwareExpressionParser {
break;
case '}':
case ']':
case ')':
case ')': {
if (!stack.length) {
throw new Error(
"Found closing '" +
Expand All @@ -242,15 +242,17 @@ class TemplateAwareExpressionParser {
);
}
break;
}
case "'":
case '"':
case '"': {
// jump to the end of the literal
const endLiteral = expressionString.indexOf(ch, pos + 1);
if (endLiteral === -1) {
throw new Error('Found non terminating string literal starting at position ' + pos);
}
pos = endLiteral;
break;
}
}
pos++;
}
Expand Down
3 changes: 2 additions & 1 deletion app/scripts/modules/core/src/search/widgets/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export class Search extends React.Component<ISearchProps, ISearchState> {
case Key.ENTER:
this.handleFilterSelection();
break;
case Key.ESCAPE:
case Key.ESCAPE: {
const text = this.inputElement.value;
if (this.hasModifier(text) && !this.getSearchText(text)) {
this.inputElement.value = '';
Expand All @@ -258,6 +258,7 @@ export class Search extends React.Component<ISearchProps, ISearchState> {
isOpen: false,
});
break;
}
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ class GceLoadBalancingPolicySelectorController implements IController {
switch (get(index[loadBalancer], 'loadBalancerType')) {
case 'SSL':
case 'TCP':
case 'HTTP':
case 'HTTP': {
const lbBackendServices: string[] = get(index[loadBalancer], 'backendServices');
const filteredBackendServices = globalBackendServices.filter((service: IGceBackendService) =>
lbBackendServices.includes(service.name),
);
const portNames = filteredBackendServices.map((service: IGceBackendService) => service.portName);
const portNameIntersection = intersection(portNames, inUsePortNames);
return portNames.filter(portName => !portNameIntersection.includes(portName));
}
default:
return [];
}
Expand Down

0 comments on commit 8cba7ac

Please sign in to comment.