Skip to content

Commit

Permalink
style: lower stylelint version
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanChain committed Feb 12, 2024
1 parent 26a6b32 commit e05fa1b
Show file tree
Hide file tree
Showing 7 changed files with 361 additions and 114 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@
"rimraf": "^5.0.5",
"source-map-loader": "^5.0.0",
"style-loader": "^3.3.4",
"stylelint": "^16.2.0",
"stylelint-config-recommended": "^14.0.0",
"stylelint-config-standard": "^36.0.0",
"stylelint": "^15.10.1",
"stylelint-config-recommended": "^13.0.0",
"stylelint-config-standard": "^34.0.0",
"stylelint-csstree-validator": "^3.0.0",
"stylelint-prettier": "^5.0.0",
"stylelint-prettier": "^4.0.0",
"typescript": "^5.3.3",
"yjs": "^13.6.11"
},
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
notebooks: INotebookTracker,
editors: IEditorTracker,
settingRegistry: ISettingRegistry | null,
statusBar: IStatusBar | null,
statusBar: IStatusBar | null
) => {
console.log('JupyterLab extension jupyterlab-wakatime is activated!')
const statusModel = new StatusModel()
Expand Down Expand Up @@ -69,7 +69,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
const wakatimeStatus = new WakaTimeStatus(statusModel)
statusBar.registerStatusItem('wakatime-status', {
item: wakatimeStatus,
align: 'right',
align: 'right'
})
pollStatus(statusModel)
}
Expand Down
33 changes: 21 additions & 12 deletions src/status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { GroupItem, TextItem } from '@jupyterlab/statusbar'

import wakatimeSVG from '../style/icons/wakatime.svg'


export const wakatimeIcon = new LabIcon({
name: 'jupyterlab-wakatime:wakatime',
svgstr: wakatimeSVG
Expand All @@ -32,17 +31,27 @@ export class StatusModel extends VDomModel {
get errorMsg() {
switch (this._error) {
// extension-defined error codes
case 0: return "WakaTime is working"
case 127: return "wakatime-cli not found"
case 400: return "Plugin error"
case 0:
return 'WakaTime is working'
case 127:
return 'wakatime-cli not found'
case 400:
return 'Plugin error'
// wakatime-cli error codes
case 112: return "Rate limited"
case 102: return "API or network error"
case 104: return "Invalid API key"
case 103: return "Config file parse error"
case 110: return "Config file read error"
case 111: return "Config file write error"
default: return "Unknown error"
case 112:
return 'Rate limited'
case 102:
return 'API or network error'
case 104:
return 'Invalid API key'
case 103:
return 'Config file parse error'
case 110:
return 'Config file read error'
case 111:
return 'Config file write error'
default:
return 'Unknown error'
}
}

Expand All @@ -62,7 +71,7 @@ export class StatusModel extends VDomModel {
export class WakaTimeStatus extends VDomRenderer<StatusModel> {
constructor(model: StatusModel) {
super(model)
this.addClass("jp-wakatime-status")
this.addClass('jp-wakatime-status')
}

render() {
Expand Down
6 changes: 3 additions & 3 deletions src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare module "\*.svg" {
const content: string;
export default content;
declare module '*.svg' {
const content: string
export default content
}
9 changes: 3 additions & 6 deletions src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ export class Heart {
this.statusModel = statusModel
this.debug = debug
}
async beat(
filepath: string,
type: 'switch' | 'change' | 'write'
) {
async beat(filepath: string, type: 'switch' | 'change' | 'write') {
console.log(type, filepath)
const now = Date.now()
if (type === 'change' && now - lastBeat < wakaInterval) {
Expand All @@ -33,7 +30,7 @@ export class Heart {
filepath: filepath,
timestamp: now / 1e3,
iswrite: type === 'write',
debug: this.debug,
debug: this.debug
}
lastBeat = now
const { code } = await requestAPI<{ code: number }>('heartbeat', {
Expand All @@ -51,7 +48,7 @@ const immediateInterval = (callback: () => void, ms: number) => {

export const pollStatus = (model: StatusModel) => {
immediateInterval(async () => {
const { time } = await requestAPI<{ time: string, error: number }>('status')
const { time } = await requestAPI<{ time: string; error: number }>('status')
model.time = time
}, 6e4)
}
2 changes: 1 addition & 1 deletion style/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
*/

.jp-wakatime-status:has([data-error]) {
background-color: var(--jp-warn-color3)
background-color: var(--jp-warn-color3);
}
Loading

0 comments on commit e05fa1b

Please sign in to comment.