Skip to content

Commit

Permalink
Add GitHub action to lint code. (#1250)
Browse files Browse the repository at this point in the history
* Add GitHub action to lint code.

* Commit from GitHub Actions (Lint code)

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
demiankatz and github-actions[bot] authored Dec 11, 2024
1 parent 315112a commit 2f455a2
Show file tree
Hide file tree
Showing 12 changed files with 690 additions and 466 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint code

on: [push, pull_request]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Checkout
uses: actions/checkout@v4

- name: Install npm dependencies
run: npm install

- name: Lint code
run: npm run lint

- name: Auto-commit fixes
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
add: "['src/']"
2 changes: 1 addition & 1 deletion src/content-handlers/iiif/BaseConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export type SettingsDialogueContent = DialogueContent & {
clickToZoomEnabled: string;
pagingEnabled: string;
reducedMotion: string;
truncateThumbnailLabels: string;
truncateThumbnailLabels: string;
preserveViewport: string;
title: string;
website: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ const DownloadDialogue = ({
if (bodies.length == 0) {
return null;
}

return bodies[0];
}

Expand All @@ -342,7 +342,8 @@ const DownloadDialogue = ({
}

// presentation api version 3
const annotationBody: AnnotationBody | null = getCanvasImageAnnotationBody(canvas);
const annotationBody: AnnotationBody | null =
getCanvasImageAnnotationBody(canvas);
if (annotationBody) {
const format: MediaType | null = annotationBody.getFormat();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const $ = require("jquery");
import { SettingsDialogue as BaseSettingsDialogue } from "../../modules/uv-dialogues-module/SettingsDialogue";
import config from "./config/config.json";
import config from "./config/config.json";

export class SettingsDialogue extends BaseSettingsDialogue {
$clickToZoomEnabled: JQuery;
Expand Down Expand Up @@ -57,25 +57,35 @@ export class SettingsDialogue extends BaseSettingsDialogue {
);
this.$pagingEnabled.append(this.$pagingEnabledLabel);

if (config.options.truncateThumbnailLabels) {
this.$truncateThumbnailLabels = $('<div class="setting truncateThumbnailLabels"></div>');
if (config.options.truncateThumbnailLabels) {
this.$truncateThumbnailLabels = $(
'<div class="setting truncateThumbnailLabels"></div>'
);
this.$scroll.append(this.$truncateThumbnailLabels);

this.$truncateThumbnailLabelsCheckbox = $(
'<input id="truncateThumbnailLabels" type="checkbox" tabindex="0" />'
);
this.$truncateThumbnailLabels.append(this.$truncateThumbnailLabelsCheckbox);
this.$truncateThumbnailLabels.append(
this.$truncateThumbnailLabelsCheckbox
);

this.$truncateThumbnailLabelsLabel = $(
'<label for="truncateThumbnailLabels">' + this.content.truncateThumbnailLabels + "</label>"
'<label for="truncateThumbnailLabels">' +
this.content.truncateThumbnailLabels +
"</label>"
);
this.$truncateThumbnailLabels.append(this.$truncateThumbnailLabelsLabel);

this.$truncateThumbnailLabelsCheckbox.prop('checked', config.options.truncateThumbnailLabels);
this.$truncateThumbnailLabelsCheckbox.prop(
"checked",
config.options.truncateThumbnailLabels
);

this.$truncateThumbnailLabelsCheckbox.change(() => {
const settings: ISettings = {};
settings.truncateThumbnailLabels = this.$truncateThumbnailLabelsCheckbox.is(":checked");
settings.truncateThumbnailLabels =
this.$truncateThumbnailLabelsCheckbox.is(":checked");
this.updateSettings(settings);
});
}
Expand Down Expand Up @@ -191,13 +201,13 @@ export class SettingsDialogue extends BaseSettingsDialogue {
} else {
this.$preserveViewportCheckbox.removeAttr("checked");
}

if (this.$truncateThumbnailLabelsCheckbox) {
if (settings.truncateThumbnailLabels) {
this.$truncateThumbnailLabelsCheckbox.prop("checked", true);
} else {
this.$truncateThumbnailLabelsCheckbox.prop("checked", false);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,10 @@ export class ContentLeftPanel extends LeftPanel<ContentLeftPanelConfig> {
paged,
viewingDirection: viewingDirection || ViewingDirection.LEFT_TO_RIGHT,
selected: selectedIndices,
truncateThumbnailLabels: settings.truncateThumbnailLabels !== undefined ? settings.truncateThumbnailLabels : true,
truncateThumbnailLabels:
settings.truncateThumbnailLabels !== undefined
? settings.truncateThumbnailLabels
: true,
onClick: (thumb: Thumb) => {
this.extensionHost.publish(IIIFEvents.THUMB_SELECTED, thumb);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export class GalleryView extends BaseView<ContentLeftPanel> {
}

public applyExtendedLabelsStyles(): void {
this.$gallery.addClass('label-extended');
this.$gallery.addClass("label-extended");
}

}
Loading

0 comments on commit 2f455a2

Please sign in to comment.