Skip to content

Commit

Permalink
Tidy up code
Browse files Browse the repository at this point in the history
  • Loading branch information
watsonbox committed Sep 22, 2024
1 parent e721e13 commit 582e36b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ActivityImporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class ActivityImporter {
await this.stravaApi.refreshTokenIfExpired();

try {
let params: { per_page: number; after?: number } = {
const params: { per_page: number; after?: number } = {
per_page: this.PER_PAGE
};

Expand Down
4 changes: 2 additions & 2 deletions src/ActivityRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export class ActivityRenderer {
}

renderFrontMatter(activity: Activity) {
let frontMatter: { [id: string]: unknown } = {
const frontMatter: { [id: string]: unknown } = {
id: activity.id
};

this.frontMatterProperties!.forEach((property) => {
this.frontMatterProperties?.forEach((property) => {
frontMatter[property] = property === "icon" ? this.getActivityIcon(activity.sport_type) : activity[property];
});

Expand Down
3 changes: 2 additions & 1 deletion src/ActivitySerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { ActivityRenderer } from "./ActivityRenderer";

// On Unix-like systems / is reserved and <>:"/\|?* as well as non-printable characters \u0000-\u001F on Windows
// credit: https://github.com/sindresorhus/filename-reserved-regex
// eslint-disable-next-line no-control-regex
const REPLACEMENT_CHAR = '-';
// eslint-disable-next-line no-control-regex
const ILLEGAL_CHAR_REGEX_FILE = /[<>:"/\\|?*\u0000-\u001F]/g;
// eslint-disable-next-line no-control-regex
const ILLEGAL_CHAR_REGEX_FOLDER = /[<>:"\\|?*\u0000-\u001F]/g;

export class ActivitySerializer {
Expand Down
4 changes: 2 additions & 2 deletions src/SettingsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class SettingsTab extends PluginSettingTab {
});

if (this.plugin.settings.authentication.stravaAccessToken) {
let el = containerEl.createEl("div");
const el = containerEl.createEl("div");
el.setText("✅");
containerEl.find(".strava-sync-authenticate > .setting-item-control ").prepend(el);
}
Expand Down Expand Up @@ -271,7 +271,7 @@ export class SettingsTab extends PluginSettingTab {
text.inputEl.setAttr('cols', 50)
})

let el = containerEl.createEl("div");
const el = containerEl.createEl("div");
el.innerHTML = `<img src="${this.STRAVA_POWERED_BY_IMAGE_URL}" />`;
el.classList.add("strava-powered-by");
containerEl.appendChild(el);
Expand Down

0 comments on commit 582e36b

Please sign in to comment.