Skip to content

Commit

Permalink
refactor: use linting for lint-staged
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianWoelki committed Oct 1, 2023
1 parent 6aa591e commit 5c4e7d1
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"license": "MIT",
"lint-staged": {
"*.{json,js,ts,jsx,tsx,html}": [
"prettier --write --ignore-unknown"
"pnpm lint"
]
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions src/@types/internalPluginInjector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default abstract class InternalPluginInjector {
return this.plugin.app.workspace.getLeavesOfType('file-explorer') as unknown as FileExplorerWorkspaceLeaf[];
}

// eslint-disable-next-line
onMount(): void {}

abstract get enabled(): boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/@types/obsidian.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface BookmarkInternalPlugin extends InternalPlugin {
};
}

interface FileExplorerInternalPlugin extends InternalPlugin {}
type FileExplorerInternalPlugin = InternalPlugin

interface InternalPlugins {
starred: StarredInternalPlugin;
Expand Down
1 change: 1 addition & 0 deletions src/iconPackBrowserModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default class IconPackBrowserModal extends FuzzySuggestModal<IconPack> {
this.inputEl.placeholder = 'Select to download icon pack';
}

// eslint-disable-next-line
onAddedIconPack(): void {}

onOpen(): void {
Expand Down
2 changes: 1 addition & 1 deletion src/iconPackManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ const generateIcon = (iconPackName: string, iconName: string, content: string):
}

const svgViewboxMatch = content.match(svgViewboxRegex);
let svgViewbox: string = '';
let svgViewbox = '';
if (svgViewboxMatch && svgViewboxMatch.length !== 0) {
svgViewbox = svgViewboxMatch[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/iconsPickerModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class IconsPickerModal extends FuzzySuggestModal<any> {
private plugin: IconFolderPlugin;
private path: string;

private renderIndex: number = 0;
private renderIndex = 0;

private recentlyUsedItems: Set<string>;

Expand Down
1 change: 1 addition & 0 deletions src/internal-plugins/bookmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export default class BookmarkInternalPlugin extends InternalPluginInjector {
return;
}

// eslint-disable-next-line
const self = this;
this.plugin.register(
around(this.bookmark.instance, {
Expand Down
1 change: 1 addition & 0 deletions src/internal-plugins/starred.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default class StarredInternalPlugin extends InternalPluginInjector {
return;
}

// eslint-disable-next-line
const self = this;
this.plugin.register(
around(this.starred.instance, {
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default class IconFolderPlugin extends Plugin {
console.log('...icons migrated');
}

// eslint-disable-next-line
// @ts-ignore - Required because an older version of the plugin saved the `migrated`
// property as a boolean instead of a number.
if (this.getSettings().migrated === true) {
Expand Down
2 changes: 1 addition & 1 deletion src/zipUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const getFileFromJSZipFile = async (file: JSZip.JSZipObject): Promise<Fil
* to set an extra path (like a directory inside the zip file) to filter the files.
* @returns Array of loaded files inside the zip file.
*/
export const readZipFile = async (bytes: ArrayBuffer, extraPath: string = ''): Promise<JSZip.JSZipObject[]> => {
export const readZipFile = async (bytes: ArrayBuffer, extraPath = ''): Promise<JSZip.JSZipObject[]> => {
const zipper = new JSZip();
const unzippedFiles = await zipper.loadAsync(bytes);
return Promise.resolve(unzippedFiles).then((unzipped) => {
Expand Down

0 comments on commit 5c4e7d1

Please sign in to comment.