Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Mar 21, 2024
1 parent 9e7a5a4 commit 77e1849
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 131 deletions.
248 changes: 124 additions & 124 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,127 +1,127 @@
{
"name": "@pyviz/jupyterlab_pyviz",
"version": "3.0.1",
"description": "A JupyterLab extension for rendering HoloViz content.",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://github.com/holoviz/pyviz_comms",
"bugs": {
"url": "https://github.com/holoviz/pyviz_comms/issues"
},
"license": "BSD-3-Clause",
"author": {
"name": "Philipp Rudiger"
},
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,.js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"schema/*.json",
"style/index.js"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"repository": {
"type": "git",
"url": "https://github.com/holoviz/pyviz_comms.git"
},
"scripts": {
"build": "jlpm build:lib && jlpm build:labextension:dev",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc --sourceMap",
"build:lib:prod": "tsc",
"build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:labextension",
"clean": "jlpm clean:lib",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"clean:labextension": "rimraf pyviz_comms/labextension pyviz_comms/_version.py",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
"lint": "jlpm prettier && jlpm eslint",
"lint:check": "jlpm prettier:check && jlpm eslint:check",
"prettier": "jlpm prettier:base --write --list-different",
"prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:check": "jlpm prettier:base --check",
"stylelint": "jlpm stylelint:check --fix",
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
"watch": "run-p watch:src watch:labextension",
"watch:labextension": "jupyter labextension watch .",
"watch:src": "tsc -w --sourceMap"
},
"dependencies": {
"@jupyterlab/application": "^4.0.3",
"@jupyterlab/apputils": "^4.1.3",
"@jupyterlab/coreutils": "^6.0.3",
"@jupyterlab/docregistry": "^4.0.3",
"@jupyterlab/fileeditor": "^4.0.3",
"@jupyterlab/mainmenu": "^4.0.3",
"@jupyterlab/notebook": "^4.0.3",
"@jupyterlab/settingregistry": "^4.0.3",
"@jupyterlab/ui-components": "^4.0.3",
"@lumino/coreutils": "^2.1.1",
"@lumino/signaling": "^2.1.1",
"tippy.js": "^6"
},
"resolutions": {
"@lumino/widgets": "^2.1.1",
"react": "^17.0.1",
"react-dom": "^17.0.1"
},
"peerDependencies": {
"@jupyter-widgets/base": "^2 || ^3 || ^4 || ^5 || ^6",
"@jupyter-widgets/jupyterlab-manager": "^5.0.4"
},
"devDependencies": {
"@jupyter-widgets/base": "^2 || ^3 || ^4 || ^5 || ^6",
"@jupyter-widgets/jupyterlab-manager": "^5.0.7",
"@jupyterlab/builder": "^4.0.0",
"@jupyterlab/testutils": "^3.0.0",
"@types/json-schema": "^7.0.11",
"@types/node": "^14.14.16",
"@types/react": "^18.0.26",
"@types/react-dom": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"css-loader": "^6.7.1",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^5.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.0",
"rimraf": "^4.4.1",
"source-map-loader": "^1.0.2",
"style-loader": "^3.3.1",
"stylelint": "^15.10.1",
"stylelint-config-recommended": "^13.0.0",
"stylelint-config-standard": "^34.0.0",
"stylelint-prettier": "^4.0.0",
"typescript": "~5.0.2",
"yjs": "^13.5.40"
},
"sideEffects": [
"style/*.css",
"style/index.js"
],
"styleModule": "style/index.js",
"jupyterlab": {
"extension": true,
"outputDir": "pyviz_comms/labextension",
"schemaDir": "schema",
"sharedPackages": {
"@jupyter-widgets/jupyterlab-manager": {
"bundled": false,
"singleton": true
},
"@jupyter-widgets/base": {
"bundled": false,
"singleton": true
}
}
"name": "@pyviz/jupyterlab_pyviz",
"version": "3.0.1",
"description": "A JupyterLab extension for rendering HoloViz content.",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://github.com/holoviz/pyviz_comms",
"bugs": {
"url": "https://github.com/holoviz/pyviz_comms/issues"
},
"license": "BSD-3-Clause",
"author": {
"name": "Philipp Rudiger"
},
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,.js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"schema/*.json",
"style/index.js"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"repository": {
"type": "git",
"url": "https://github.com/holoviz/pyviz_comms.git"
},
"scripts": {
"build": "jlpm build:lib && jlpm build:labextension:dev",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc --sourceMap",
"build:lib:prod": "tsc",
"build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:labextension",
"clean": "jlpm clean:lib",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"clean:labextension": "rimraf pyviz_comms/labextension pyviz_comms/_version.py",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
"lint": "jlpm prettier && jlpm eslint",
"lint:check": "jlpm prettier:check && jlpm eslint:check",
"prettier": "jlpm prettier:base --write --list-different",
"prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:check": "jlpm prettier:base --check",
"stylelint": "jlpm stylelint:check --fix",
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
"watch": "run-p watch:src watch:labextension",
"watch:labextension": "jupyter labextension watch .",
"watch:src": "tsc -w --sourceMap"
},
"dependencies": {
"@jupyterlab/application": "^4.0.3",
"@jupyterlab/apputils": "^4.1.3",
"@jupyterlab/coreutils": "^6.0.3",
"@jupyterlab/docregistry": "^4.0.3",
"@jupyterlab/fileeditor": "^4.0.3",
"@jupyterlab/mainmenu": "^4.0.3",
"@jupyterlab/notebook": "^4.0.3",
"@jupyterlab/settingregistry": "^4.0.3",
"@jupyterlab/ui-components": "^4.0.3",
"@lumino/coreutils": "^2.1.1",
"@lumino/signaling": "^2.1.1",
"tippy.js": "^6"
},
"resolutions": {
"@lumino/widgets": "^2.1.1",
"react": "^17.0.1",
"react-dom": "^17.0.1"
},
"peerDependencies": {
"@jupyter-widgets/base": "^2 || ^3 || ^4 || ^5 || ^6",
"@jupyter-widgets/jupyterlab-manager": "^5.0.4"
},
"devDependencies": {
"@jupyter-widgets/base": "^2 || ^3 || ^4 || ^5 || ^6",
"@jupyter-widgets/jupyterlab-manager": "^5.0.7",
"@jupyterlab/builder": "^4.0.0",
"@jupyterlab/testutils": "^3.0.0",
"@types/json-schema": "^7.0.11",
"@types/node": "^14.14.16",
"@types/react": "^18.0.26",
"@types/react-dom": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"css-loader": "^6.7.1",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^5.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.0",
"rimraf": "^4.4.1",
"source-map-loader": "^1.0.2",
"style-loader": "^3.3.1",
"stylelint": "^15.10.1",
"stylelint-config-recommended": "^13.0.0",
"stylelint-config-standard": "^34.0.0",
"stylelint-prettier": "^4.0.0",
"typescript": "~5.0.2",
"yjs": "^13.5.40"
},
"sideEffects": [
"style/*.css",
"style/index.js"
],
"styleModule": "style/index.js",
"jupyterlab": {
"extension": true,
"outputDir": "pyviz_comms/labextension",
"schemaDir": "schema",
"sharedPackages": {
"@jupyter-widgets/jupyterlab-manager": {
"bundled": false,
"singleton": true
},
"@jupyter-widgets/base": {
"bundled": false,
"singleton": true
}
}
}
}
17 changes: 13 additions & 4 deletions src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,30 @@ export class ContextManager implements IDisposable {
}
let layout;
try {
layout = await response.json();
layout = await response.json();
} catch {
return
return;
}
if (!layout) {
return;
}
let changed = false;
for (const cell of context.model.cells) {
const cell_layout = layout.cells[cell.id];
const cell_meta = cell.getMetadata();
if ((!('panel-layout' in cell_meta) && (cell_layout != null)) || (!JSONExt.deepEqual(cell_meta['panel-layout'], cell_layout))) {
if (
(!('panel-layout' in cell_meta) && cell_layout) ||
!JSONExt.deepEqual(cell_meta['panel-layout'], cell_layout)
) {
cell.setMetadata('panel-layout', cell_layout);
changed = true;
}
}
const nb_meta = context.model.getMetadata();
if ((!('panel-cell-order' in nb_meta) && (layout.order != null)) || !JSONExt.deepEqual(nb_meta['panel-cell-order'], layout.order)) {
if (
(!('panel-cell-order' in nb_meta) && layout.order) ||
!JSONExt.deepEqual(nb_meta['panel-cell-order'], layout.order)
) {
context.model.setMetadata('panel-cell-order', layout.order);
changed = true;
}
Expand Down
7 changes: 6 additions & 1 deletion src/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const CUSTOM_LOADER = `
<html>
<head>
<title>Jupyter Kernel Starting</title>
<link href="https://fonts.googleapis.com/css2?family=Kumbh+Sans:wght@900&display=swap" rel="stylesheet">
<style>
body {
display: flex;
Expand All @@ -74,7 +75,11 @@ const CUSTOM_LOADER = `
flex-direction: column;
height: 100vh;
background-color: #f7f7f7;
font-family: Futura;
font-family: "Kumbh Sans", "Segoe UI", Arial, Helvetica, sans-serif;
}
h1 {
font-weight: 900;
}
.loading-container {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export class HVJSExec extends Widget implements IRenderMime.IRenderer {
this._server_id = null;
} else if (this._document_id) {
const id = this._document_id;
if (this._manager.comm != null && this._dispose) {
if (this._manager.comm && this._dispose) {
this._manager.comm.send({ event_type: 'delete', id: id });
}
if ((window as any).PyViz !== undefined) {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
"target": "ES2018",
"types": ["node"]
},
"include": ["src/*"]
"include": ["src/*.ts"]
}

0 comments on commit 77e1849

Please sign in to comment.