Skip to content

Commit

Permalink
Upgrade to react-jsonschema-form 2 (#41)
Browse files Browse the repository at this point in the history
* bump lab versions, pin robot version

* update tsconfig from lab core

* upgrade linting stack, null checks

* add a canary element for rendered markdown

* more null checks

* start actual rjsf upgrade

* update cookiecutter pantry detection

* bump versions
  • Loading branch information
bollwyvl committed May 10, 2020
1 parent 3b3dd12 commit ef5384b
Show file tree
Hide file tree
Showing 35 changed files with 1,404 additions and 497 deletions.
38 changes: 38 additions & 0 deletions .eslintignore
@@ -0,0 +1,38 @@
node_modules
**/build
**/lib
**/node_modules
**/mock_packages
**/static
**/typings
**/schemas
**/themes
coverage
*.map.js
*.bundle.js
_*.d.ts

dev_mode/index.js
!dev_mode/static/index.out.js
dev_mode/workspaces
docs/_build
docs/api
docs/_static
docs/build
examples/chrome-example-test.js
jupyterlab/chrome-test.js
jupyterlab/geckodriver
packages/extensionmanager-extension/examples/listings
packages/ui-components/src/icon/iconimports.ts
jupyterlab/staging/yarn.js
jupyterlab/staging/index.js

# jetbrains IDE stuff
.idea/

# ms IDE stuff
.history/
.vscode/

envs/
atest/
52 changes: 52 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,52 @@
module.exports = {
env: {
browser: true,
es6: true,
commonjs: true,
node: true
},
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:react/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.eslint.json'
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
'@typescript-eslint/interface-name-prefix': [
'error',
{ prefixWithI: 'always' }
],
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/ban-ts-ignore': 'warn',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/triple-slash-reference': 'warn',
'@typescript-eslint/no-inferrable-types': 'off',
'no-inner-declarations': 'off',
'no-prototype-builtins': 'off',
'no-control-regex': 'warn',
'no-undef': 'warn',
'no-case-declarations': 'warn',
'no-useless-escape': 'off',
'prefer-const': 'off'
},
settings: {
react: {
version: 'detect'
}
}
};
13 changes: 13 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,17 @@
# CHANGELOG

## `jupyter_starters 0.5.0a0`

- [#41][] handle more recent cookiecutter metadata

## `@deathbeds/jupyterlab-rjsf 0.5.0a0`

- [#41][] upgrade `react-jsonschema-form` to `@rjsf/core`

## `@deathbeds/jupyterlab-starters 0.5.0a0`

- [#41][] upgrade `@deathbeds/jupyterlab-rjsf`

## `@deathbeds/jupyterlab-rjsf 0.4.0a0`

- [#38][] split out `rjsf` into its own package
Expand Down Expand Up @@ -89,3 +101,4 @@
[#35]: https://github.com/deathbeds/jupyterlab-starters/pull/35
[#38]: https://github.com/deathbeds/jupyterlab-starters/pull/38
[#39]: https://github.com/deathbeds/jupyterlab-starters/pull/39
[#41]: https://github.com/deathbeds/jupyterlab-starters/pull/41
3 changes: 2 additions & 1 deletion anaconda-project.yml
Expand Up @@ -38,6 +38,7 @@ env_specs:
- pytest-asyncio
- pytest-cov
- pytest-flake8
- robotframework <3.2
- robotframework-lint
- robotframework-seleniumlibrary
- ruamel_yaml
Expand Down Expand Up @@ -68,7 +69,7 @@ env_specs:
packages:
- cookiecutter
- importlib_metadata
- jupyterlab >=2.1.0,<3.0.0a0
- jupyterlab >=2,<3.0.0a0
- nodejs >=11,<12
- python >=3.7,<3.8.0a0
- python-fastjsonschema
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Expand Up @@ -12,9 +12,9 @@ variables:
PYTHONUNBUFFERED: 1
ATEST_RETRIES: 4

PY_JLST_VERSION: 0.4.0a0
JS_JLST_VERSION: 0.4.0-a0
JS_RJSF_VERSION: 0.4.0-a0
PY_JLST_VERSION: 0.5.0a0
JS_JLST_VERSION: 0.5.0-a0
JS_RJSF_VERSION: 0.5.0-a0

FIRST_PARTY_LABEXTENSIONS: >-
packages/jupyterlab-starters/deathbeds-jupyterlab-starters-$(JS_JLST_VERSION).tgz
Expand Down
4 changes: 2 additions & 2 deletions ci/env-lint.yml
Expand Up @@ -8,12 +8,12 @@ dependencies:
- black
- flake8
- isort
- jupyterlab >=2.1.0,<3.0.0a0
- jupyterlab >=2,<3.0.0a0
- mypy
- nodejs
- pylint
- pytest-azurepipelines
- python >=3.8,<3.9.0a0
- robotframework
- robotframework <3.2
- robotframework-lint
- ruamel_yaml
3 changes: 2 additions & 1 deletion ci/env-test.yml.in
Expand Up @@ -6,7 +6,7 @@ channels:

dependencies:
- cookiecutter
- firefox
- firefox =68
- geckodriver
- jupyterlab {lab}
- nodejs
Expand All @@ -15,4 +15,5 @@ dependencies:
- pytest-cov
- pytest-flake8
- python {python}
- robotframework <3.2
- robotframework-seleniumlibrary
4 changes: 2 additions & 2 deletions ci/job.test.yml
Expand Up @@ -15,10 +15,10 @@ parameters:
lab: '>=2,<2.1.0a0'
- name: ThreeSeven
spec: '>=3.7,<3.8.0a0'
lab: '>=2,<2.1.0a0'
lab: '>=2.1,<2.2.0a0'
- name: ThreeEight
spec: '>=3.8,<3.9.0a0'
lab: '>=2.1,<3.0.0a0'
lab: '>=2,<3.0.0a0'
env_update: conda env update -n jupyterlab-starters --file env-test.yml --quiet
lab_ext: jupyter labextension install --no-build $(FIRST_PARTY_LABEXTENSIONS)
link_mod: jupyter labextension link --no-build $(FIRST_PARTY_MODULES)
Expand Down
2 changes: 1 addition & 1 deletion docs/environment.yml
Expand Up @@ -7,7 +7,7 @@ channels:
dependencies:
- cookiecutter
- importlib_metadata
- jupyterlab >=2.1.0,<3.0.0a0
- jupyterlab >=2,<3.0.0a0
- nbsphinx >=0.5.0,<0.5.1a0
- nodejs >=11,<12
- pip
Expand Down
2 changes: 1 addition & 1 deletion docs/rtd.yml
Expand Up @@ -10,7 +10,7 @@ dependencies:
- fastjsonschema
- graphviz
- importlib_metadata
- jupyterlab >=2.1.0,<3.0.0a0
- jupyterlab >=2,<3.0.0a0
- nbsphinx >=0.5.0,<0.5.1a0
- pytest-check-links
- recommonmark
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Expand Up @@ -7,7 +7,7 @@ channels:
dependencies:
- cookiecutter
- importlib_metadata
- jupyterlab >=2.1.0,<3.0.0a0
- jupyterlab >=2,<3.0.0a0
- nodejs >=11,<12
- python >=3.7,<3.8.0a0
- python-fastjsonschema
Expand Down
18 changes: 10 additions & 8 deletions package.json
@@ -1,12 +1,14 @@
{
"devDependencies": {
"@adobe/jsonschema2md": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.19.0",
"eslint": "^6.8.0",
"lerna": "^3.13.2",
"prettier": "^1.19.1",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1",
"tslint-react": "^4.0.0",
"tslint": "^5.15.0",
"typescript": "~3.7.2"
},
"private": true,
Expand All @@ -16,13 +18,13 @@
"bundle": "lerna run --parallel bundle",
"clean": "lerna run --parallel clean",
"lab:link": "lerna run lab:link",
"lint:check": "jlpm prettier:check && jlpm tslint:check",
"lint": "jlpm prettier:fix && jlpm tslint:fix",
"lint:check": "jlpm prettier:check && jlpm eslint:check",
"lint": "jlpm prettier:fix && jlpm eslint:fix",
"prettier:check": "prettier --check '**/*{.ts,.tsx,.js,.jsx,.css,.json,.md,.yml}'",
"prettier:fix": "prettier --write '**/*{.ts,.tsx,.js,.jsx,.css,.json,.md,.yml}'",
"test": "lerna run --stream --concurrency=1 test",
"tslint:check": "tslint -c tslint.json --project tsconfigbase.json 'packages/**/*{.ts,.tsx}'",
"tslint:fix": "tslint --fix -c tslint.json --project tsconfigbase.json 'packages/**/*{.ts,.tsx}'",
"eslint:fix": "eslint --ext .js,.jsx,.ts,.tsx --fix .",
"eslint:check": "eslint --ext .js,.jsx,.ts,.tsx .",
"watch": "lerna run --parallel watch"
},
"workspaces": {
Expand Down
5 changes: 2 additions & 3 deletions packages/jupyterlab-rjsf/package.json
@@ -1,6 +1,6 @@
{
"name": "@deathbeds/jupyterlab-rjsf",
"version": "0.4.0a0",
"version": "0.5.0a0",
"description": "React JSON Schema Form for JupyterLab",
"keywords": [
"jupyter",
Expand Down Expand Up @@ -30,15 +30,14 @@
"upload": "jlpm publish ."
},
"dependencies": {
"react-jsonschema-form": "~1.8.1",
"@rjsf/core": "~2.0.0",
"react-codemirror2": "^6.0.0"
},
"peerDependencies": {
"@jupyterlab/application": "2"
},
"devDependencies": {
"@types/codemirror": "^0.0.74",
"@types/react-jsonschema-form": "^1.6.6",
"@jupyterlab/application": "2",
"react": "*",
"rimraf": "~2.6.2",
Expand Down
6 changes: 4 additions & 2 deletions packages/jupyterlab-rjsf/src/async-component/index.tsx
Expand Up @@ -16,7 +16,9 @@ export function asyncComponent<T extends asyncComponent.TImportable>(
let COMPONENT: T;
let PROMISE: Promise<T>;

return class extends React.Component {
return class extends React.Component<any, any> {
readonly displayName = 'AsyncComponent';

state: asyncComponent.IState = {
__async_component: null
};
Expand Down Expand Up @@ -95,6 +97,6 @@ export namespace asyncComponent {
* Apparently this can't be <T> yet...
*/
export interface IState {
__async_component: TImportable;
__async_component: TImportable | null;
}
}
2 changes: 1 addition & 1 deletion packages/jupyterlab-rjsf/src/fields/index.ts
Expand Up @@ -2,7 +2,7 @@ import { CodeMirrorField } from './codemirror';
import { JSONObjectField } from './jsonobject';
import { MarkdownField } from './markdown';
import { XMLField } from './xml';
import { FormProps } from 'react-jsonschema-form';
import { FormProps } from '@rjsf/core';

export const CUSTOM_UI_WIDGETS = {
'codemirror-xml': XMLField,
Expand Down
4 changes: 2 additions & 2 deletions packages/jupyterlab-rjsf/src/fields/jsonobject/index.tsx
@@ -1,8 +1,8 @@
import * as React from 'react';

import ObjectField from 'react-jsonschema-form/lib/components/fields/ObjectField';
import ObjectField from '@rjsf/core/lib/components/fields/ObjectField';

import * as rjsfUtils from 'react-jsonschema-form/lib/utils';
import { utils as rjsfUtils } from '@rjsf/core';

import { UnControlled } from 'react-codemirror2';

Expand Down
7 changes: 3 additions & 4 deletions packages/jupyterlab-rjsf/src/form/Form/Form.tsx
Expand Up @@ -7,11 +7,10 @@ import { asyncComponent } from '../../async-component';
*/
const Form = asyncComponent(async () => {
const { withTheme } = await import(
/* webpackChunkName: "react-jsonschema-form" */ 'react-jsonschema-form'
/* webpackChunkName: "@rjsf/core" */ '@rjsf/core'
);
const Theme = (
await import(/* webpackChunkName: "react-jsonschema-form" */ '../Theme')
).default;
const Theme = (await import(/* webpackChunkName: "@rjsf/core" */ '../Theme'))
.default;
return withTheme(Theme);
});

Expand Down
6 changes: 3 additions & 3 deletions packages/jupyterlab-rjsf/src/form/Theme/Theme.ts
@@ -1,7 +1,7 @@
import { ThemeProps } from 'react-jsonschema-form';
import { getDefaultRegistry } from 'react-jsonschema-form/lib/utils';
import { ThemeProps } from '@rjsf/core';
import { utils } from '@rjsf/core';

const { fields, widgets } = getDefaultRegistry();
const { fields, widgets } = utils.getDefaultRegistry();

const Theme: ThemeProps = {
fields: { ...fields },
Expand Down

0 comments on commit ef5384b

Please sign in to comment.