Skip to content

Commit d6a4367

Browse files
committed
refactor: perform linting
1 parent 6fb211d commit d6a4367

28 files changed

+314
-301
lines changed

src/api/Constants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const PortalSVG = ( siteUrl: string ): string =>
2929
Github Custom CSS
3030
*/
3131

32-
export const GithubCSS =
32+
export const GithubCSS =
3333
`
3434
.footer { display: none; }
3535
`;
@@ -38,9 +38,9 @@ export const GithubCSS =
3838
Leaf header button
3939
*/
4040

41-
export const LeafButton_Refresh =
41+
export const LeafButtonRefresh =
4242
{
4343
id: "GISTR",
4444
icon: 'gistr-plugin-refresh',
4545
name: "Refresh Gistr Plugin",
46-
}
46+
}

src/api/Electron/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
process.env.DIST = join( __dirname, '../..' )
22
process.env.PUBLIC = app.isPackaged ? process.env.DIST : join( process.env.DIST, '../public' )
3-
process.env[ 'ELECTRON_DISABLE_SECURITY_WARNINGS' ] = 'true'
3+
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true'
44

55
import {createMenu} from './menu'
66
import { app, BrowserWindow, shell, ipcMain, dialog, webContents, nativeTheme } from 'electron'
@@ -137,7 +137,7 @@ ipcMain.handle( 'moveToTrash', ( e, path: string ) =>
137137
return shell.trashItem(path)
138138
} )
139139

140-
ipcMain.handle( 'appInfo', (e) =>
140+
ipcMain.handle( 'appInfo', () =>
141141
{
142142
return {
143143
index: app.isPackaged ? indexHtml : url,
@@ -155,4 +155,4 @@ ipcMain.handle( 'printPdf', ( e, id: string ) =>
155155
{
156156
printBackground: true
157157
} )
158-
} )
158+
} )

src/api/Electron/menu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Menu, app, BrowserWindow, shell, MenuItemConstructorOptions, nativeImage, ipcMain} from 'electron'
1+
import {Menu, app, BrowserWindow, shell, nativeImage} from 'electron'
22
import {join} from 'path'
33
export const createMenu = (win: BrowserWindow) => {
44
// const devMenu = [

src/api/Env.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable no-console */
2+
13
import { App, PluginManifest, apiVersion } from 'obsidian'
24
import { lng } from 'src/lang'
35

@@ -24,8 +26,7 @@ type HttpsUrl = `https://${ string }`
2426
Repository Strings
2527
*/
2628

27-
type Repo =
28-
{
29+
interface Repo {
2930
urlDocs?: HttpsUrl
3031
urlRepo?: HttpsUrl
3132
urlWiki?: HttpsUrl
@@ -40,8 +41,7 @@ type Repo =
4041
Api Strings
4142
*/
4243

43-
type Api =
44-
{
44+
interface Api {
4545
github?: HttpsUrl
4646
}
4747

@@ -109,10 +109,7 @@ export abstract class Env
109109
Base
110110
*/
111111

112-
static get pluginBase( ): string
113-
{
114-
return 'app://obsidian.md'
115-
}
112+
static readonly pluginBase = 'app://obsidian.md';
116113

117114
/*
118115
Plugin ID
@@ -180,4 +177,4 @@ export abstract class Env
180177
return `${ process.env.BUILD_DATE }`
181178
}
182179

183-
}
180+
}

src/api/NoxComponent.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class NoxComponent extends Setting
2121

2222
return this
2323
}
24-
24+
2525
public setName( name: string | DocumentFragment ): this
2626
{
2727
super.setName( name )
@@ -44,8 +44,8 @@ export class NoxComponent extends Setting
4444

4545
public addNoxTextbox
4646
(
47-
cb: ( comp: TextComponent ) => unknown,
48-
onReset: ( comp: TextComponent ) => string,
47+
cb: ( _comp: TextComponent ) => unknown,
48+
onReset: ( _comp: TextComponent ) => string,
4949
): this
5050
{
5151
return super.addText( ( comp ) =>
@@ -61,8 +61,8 @@ export class NoxComponent extends Setting
6161

6262
public addNoxTextarea
6363
(
64-
cb: ( comp: TextAreaComponent ) => unknown,
65-
onReset: ( comp: TextAreaComponent ) => string,
64+
cb: ( _comp: TextAreaComponent ) => unknown,
65+
onReset: ( _comp: TextAreaComponent ) => string,
6666
): this
6767
{
6868
return super.addTextArea( ( comp ) =>
@@ -78,8 +78,8 @@ export class NoxComponent extends Setting
7878

7979
public addNoxToggle
8080
(
81-
cb: ( comp: ToggleComponent ) => unknown,
82-
onReset: ( comp: ToggleComponent ) => boolean,
81+
cb: ( _comp: ToggleComponent ) => unknown,
82+
onReset: ( _comp: ToggleComponent ) => boolean,
8383
): this
8484
{
8585
return super.addToggle( ( comp ) =>
@@ -95,8 +95,8 @@ export class NoxComponent extends Setting
9595

9696
public addNoxDropdown< T extends string = string >
9797
(
98-
cb: ( comp: DropdownComponent ) => unknown,
99-
onReset: ( comp: DropdownComponent ) => T,
98+
cb: ( _comp: DropdownComponent ) => unknown,
99+
onReset: ( _comp: DropdownComponent ) => T,
100100
): this
101101
{
102102
return super.addDropdown( ( comp ) =>
@@ -112,8 +112,8 @@ export class NoxComponent extends Setting
112112

113113
public addNoxSlider
114114
(
115-
cb: ( comp: SliderComponent ) => unknown,
116-
onReset: ( comp: SliderComponent ) => number,
115+
cb: ( _comp: SliderComponent ) => unknown,
116+
onReset: ( _comp: SliderComponent ) => number,
117117
): this
118118
{
119119
return super.addSlider( ( comp ) =>
@@ -129,8 +129,8 @@ export class NoxComponent extends Setting
129129

130130
public addNoxMomentFormat
131131
(
132-
cb: ( comp: MomentFormatComponent ) => unknown,
133-
onReset: ( comp: MomentFormatComponent ) => string,
132+
cb: ( _comp: MomentFormatComponent ) => unknown,
133+
onReset: ( _comp: MomentFormatComponent ) => string,
134134
): this
135135
{
136136
return super.addMomentFormat( ( comp ) =>
@@ -144,7 +144,7 @@ export class NoxComponent extends Setting
144144
Reset button functionality
145145
*/
146146

147-
private addReset< T, V extends ValueComponent< T > >( comp: V, onReset: ( comp: V ) => T ): V
147+
private addReset< T, V extends ValueComponent< T > >( comp: V, onReset: ( _comp: V ) => T ): V
148148
{
149149
this.addExtraButton( ( btn ) =>
150150
{

src/api/Saturyn/CodeblockProcessor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type Options = SaturynParams &
2323

2424
export function SaturynCodeblock( plugin: GistrPlugin )
2525
{
26-
plugin.registerMarkdownCodeBlockProcessor( 'gistr-web', ( code, el, arg ) =>
26+
plugin.registerMarkdownCodeBlockProcessor( 'gistr-web', ( code, el ) =>
2727
{
2828
el.addClass( 'saturyn-view' )
2929
const pnl = SaturynHandleSyntax( plugin, code )

src/api/Saturyn/FormPortalEdit.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { SettingsDefaults } from 'src/settings/defaults'
66
import { NoxComponent } from 'src/api'
77
import { lng } from 'src/lang'
88

9-
export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLElement, params: SaturynParams, onSubmit?: ( result: SaturynParams ) => void ) =>
9+
export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLElement, params: SaturynParams, onSubmit?: ( _result: SaturynParams ) => void ) =>
1010
{
1111

1212
const elm = contentEl
@@ -38,7 +38,7 @@ export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLEleme
3838
params.url = val
3939
}),
4040
( ) =>
41-
(
41+
(
4242
SettingsDefaults.sy_save_list_datetime.toString( ) as string
4343
),
4444
)
@@ -66,7 +66,7 @@ export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLEleme
6666
params.title = val
6767
}),
6868
( ) =>
69-
(
69+
(
7070
params.title.toString( ) as string
7171
),
7272
)
@@ -76,7 +76,7 @@ export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLEleme
7676
MarkdownRenderer.render( plugin.app, md_notFinished, ct_Note, "" + md_notFinished, plugin )
7777

7878
elm.createEl( 'div', { cls: "gistr-settings-section-separator-15", text: "" } )
79-
79+
8080
/*
8181
Dock
8282
*/
@@ -100,13 +100,13 @@ export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLEleme
100100
params.dock = val as SaturynParamsType
101101
}),
102102
( ) =>
103-
(
103+
(
104104
SettingsDefaults.theme as string
105105
),
106106
)
107107

108108
elm.createEl( 'div', { cls: "gistr-settings-section-separator", text: "" } )
109-
109+
110110
/*
111111
PIN to Menu
112112
*/
@@ -127,7 +127,7 @@ export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLEleme
127127
params.hasRibbon = val
128128
}),
129129
( ) =>
130-
(
130+
(
131131
SettingsDefaults.ge_enable_updatenoti as boolean
132132
),
133133
)
@@ -158,7 +158,7 @@ export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLEleme
158158
params.profileKey = val
159159
}),
160160
( ) =>
161-
(
161+
(
162162
SettingsDefaults.sy_save_list_datetime.toString( ) as string
163163
),
164164
)
@@ -190,7 +190,7 @@ export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLEleme
190190
params.zoom = val
191191
}),
192192
( ) =>
193-
(
193+
(
194194
SettingsDefaults.og_opacity as number
195195
),
196196
).settingEl.createDiv( '', ( el ) =>
@@ -226,13 +226,13 @@ export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLEleme
226226
advancedOptions.removeClass( 'saturyn--advanced-options--show' )
227227
}),
228228
( ) =>
229-
(
229+
(
230230
SettingsDefaults.ge_enable_updatenoti as boolean
231231
),
232232
)
233233

234234
elm.createEl( 'div', { cls: "gistr-settings-section-separator", text: "" } )
235-
235+
236236
/*
237237
Advanced Toggle
238238
*/
@@ -260,7 +260,7 @@ export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLEleme
260260
params.icon = val
261261
}),
262262
( ) =>
263-
(
263+
(
264264
SettingsDefaults.css_og.toString( ) as string
265265
),
266266
)
@@ -286,7 +286,7 @@ export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLEleme
286286
params.userAgent = val
287287
}),
288288
( ) =>
289-
(
289+
(
290290
SettingsDefaults.css_og.toString( ) as string
291291
),
292292
)
@@ -312,7 +312,7 @@ export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLEleme
312312
params.css = val
313313
}),
314314
( ) =>
315-
(
315+
(
316316
SettingsDefaults.css_og.toString( ) as string
317317
),
318318
)
@@ -338,7 +338,7 @@ export const SaturynFormPortalEdit = ( plugin: GistrPlugin, contentEl: HTMLEleme
338338
params.js = val
339339
}),
340340
( ) =>
341-
(
341+
(
342342
SettingsDefaults.css_og.toString( ) as string
343343
),
344344
)

src/api/Saturyn/ModalPortalEdit.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import { SaturynParams } from './Parameters'
66
export class SaturynModalPortalEdit extends Modal
77
{
88
portalOptions: SaturynParams
9-
onSubmit: ( result: SaturynParams ) => void
9+
onSubmit: ( _result: SaturynParams ) => void
1010
readonly plugin: GistrPlugin
1111
private cblk_preview: HTMLElement
1212

13-
constructor( app: App, plugin: GistrPlugin, portalOptions: SaturynParams, onSubmit: ( res: SaturynParams ) => void )
13+
constructor( app: App, plugin: GistrPlugin, portalOptions: SaturynParams, onSubmit: ( _res: SaturynParams ) => void )
1414
{
1515
super( app )
1616

@@ -26,7 +26,7 @@ export class SaturynModalPortalEdit extends Modal
2626
onOpen( )
2727
{
2828
const { contentEl } = this
29-
29+
3030
/*
3131
Style main modal
3232
*/
@@ -50,4 +50,4 @@ export class SaturynModalPortalEdit extends Modal
5050
const { contentEl } = this
5151
contentEl.empty( )
5252
}
53-
}
53+
}

src/api/Saturyn/Parameters.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type SaturynParamsType = 'left' | 'center' | 'right'
1616
dock: 'left' || 'center' || 'right'
1717
*/
1818

19-
export type SaturynParams =
19+
export interface SaturynParams
2020
{
2121
id: string,
2222
icon: string,
@@ -29,4 +29,4 @@ export type SaturynParams =
2929
css?: string,
3030
js?: string,
3131
dock?: SaturynParamsType,
32-
}
32+
}

src/api/Saturyn/ParametersHandle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ export const SaturynParamsHandle = ( portal: Partial< SaturynParams > ): Saturyn
3939
portal.title = portal.url
4040
}
4141

42-
return <SaturynParams>portal
43-
}
42+
return portal as SaturynParams
43+
}

src/api/Saturyn/PortalInitialize.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class SaturynPortalInitialize extends ItemView
1010
private frame: WebviewTag | HTMLIFrameElement
1111
private readonly bUseIframe: boolean = false
1212
private IframeCB: Function[]
13-
private bFrameReady: boolean = false
13+
private bFrameReady = false
1414

1515
constructor( leaf: WorkspaceLeaf, params: SaturynParams )
1616
{
@@ -204,4 +204,4 @@ export class SaturynPortalInitialize extends ItemView
204204
await this.frame.loadURL( url )
205205
}
206206
}
207-
}
207+
}

0 commit comments

Comments
 (0)