Skip to content

Commit

Permalink
add tslint rule to avoid the template strings if not interplating (#559)
Browse files Browse the repository at this point in the history
* add tslint rule to avoid the template strings if not interplating

* tslint: autofix

* enable avoid-escape also to allow single quotes for strings that contain double quotes
  • Loading branch information
prydonius authored Aug 31, 2018
1 parent 4992920 commit 767a153
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 14 deletions.
4 changes: 3 additions & 1 deletion dashboard/src/components/AppList/AppListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ class AppListItem extends React.Component<IAppListItemProps> {
</p>
<div>
<span
className={`ChartListItem__content__info_repo type-small type-color-white padding-t-tiny padding-h-normal`}
className={
"ChartListItem__content__info_repo type-small type-color-white padding-t-tiny padding-h-normal"
}
>
{app.namespace}
</span>
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/ChartList/ChartList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ChartList extends React.Component<IChartListProps, IChartListState> {
children={
<div>
Manage your Helm chart repositories in Kubeapps by visiting the{" "}
<Link to={`/config/repos`}>App repositories configuration</Link> page.
<Link to={"/config/repos"}>App repositories configuration</Link> page.
</div>
}
/>
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/ChartList/ChartListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ChartListItem extends React.Component<IChartListItemProps> {
const latestAppVersion = chart.relationships.latestChartVersion.data.app_version;
return (
<Card key={`${repo}/${name}`} responsive={true} className="ChartListItem">
<Link to={`/charts/` + chart.id} title={name}>
<Link to={"/charts/" + chart.id} title={name}>
<CardIcon icon={iconSrc} />
<CardContent>
<div className="ChartListItem__content">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ it("renders a redirect when the button is clicked", () => {
expect(redirect.exists()).toBe(true);
expect(redirect.props()).toMatchObject({
push: true,
to: `/apps/ns/test/new/testrepo/test/versions/1.2.3`,
to: "/apps/ns/test/new/testrepo/test/versions/1.2.3",
});
});
2 changes: 1 addition & 1 deletion dashboard/src/components/ChartView/ChartHeader.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ it("renders a header for the chart", () => {
expect(wrapper.text()).toContain("A Test Chart");
const repoLink = wrapper.find(Link);
expect(repoLink.exists()).toBe(true);
expect(repoLink.props()).toMatchObject({ to: `/charts/testrepo`, children: "testrepo" });
expect(repoLink.props()).toMatchObject({ to: "/charts/testrepo", children: "testrepo" });
expect(wrapper.find(ChartIcon).exists()).toBe(true);
expect(wrapper).toMatchSnapshot();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DeploymentErrors extends React.Component<IDeploymentErrorProps> {
case AppConflict:
return (
<NotFoundErrorAlert
header={`The given release name already exists in the cluster. Choose a different one`}
header={"The given release name already exists in the cluster. Choose a different one"}
/>
);
case ForbiddenError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ServiceCatalogNotInstalledAlert extends React.Component {
</a>{" "}
to browse, provision and manage external services within Kubeapps.
</p>
<Link className="button button-primary button-small" to={`/charts/svc-cat/catalog`}>
<Link className="button button-primary button-small" to={"/charts/svc-cat/catalog"}>
Install Catalog
</Link>
</div>
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/ProvisionButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class ProvisionButton extends React.Component<IProvisionButtonProps, IProvisionB
<PermissionsErrorAlert
namespace={namespace}
roles={RequiredRBACRoles}
action={`provision Service Instance`}
action={"provision Service Instance"}
/>
);
case NotFoundError:
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/UpgradeForm/SelectRepoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class SelectRepoForm extends React.Component<ISelectRepoFormProps, ISelectRepoFo
<PermissionsErrorAlert
namespace={this.props.kubeappsNamespace}
roles={[this.requiredRBACRoles()]}
action={`view App Repositories`}
action={"view App Repositories"}
/>
);
}
Expand Down
6 changes: 3 additions & 3 deletions dashboard/src/shared/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const app = {

export const api = {
apprepostories: {
base: `/api/kube/apis/kubeapps.com/v1alpha1`,
base: "/api/kube/apis/kubeapps.com/v1alpha1",
create: (namespace = "default") =>
`${api.apprepostories.base}/namespaces/${namespace}/apprepositories`,
},
Expand All @@ -31,13 +31,13 @@ export const api = {
},

serviceinstances: {
base: `/api/kube/apis/servicecatalog.k8s.io/v1beta1`,
base: "/api/kube/apis/servicecatalog.k8s.io/v1beta1",
create: (namespace = "default") =>
`${api.serviceinstances.base}/namespaces/${namespace}/serviceinstances`,
},

clusterservicebrokers: {
base: `/api/kube/apis/servicecatalog.k8s.io/v1beta1`,
base: "/api/kube/apis/servicecatalog.k8s.io/v1beta1",
sync: (broker: IServiceBroker) =>
`${api.clusterservicebrokers.base}/clusterservicebrokers/${broker.metadata.name}`,
},
Expand Down
3 changes: 2 additions & 1 deletion dashboard/tslint.ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
"jsRules": {},
"rules": {
"object-literal-sort-keys": false
"object-literal-sort-keys": false,
"quotemark": [true, "avoid-template", "avoid-escape"]
},
"rulesDirectory": []
}
3 changes: 2 additions & 1 deletion dashboard/tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"no-console": {
"severity": "warning"
},
"object-literal-sort-keys": false
"object-literal-sort-keys": false,
"quotemark": [true, "avoid-template", "avoid-escape"]
},
"rulesDirectory": []
}

0 comments on commit 767a153

Please sign in to comment.