Skip to content

Commit 1f124e8

Browse files
lucas-koehlersdirix
authored andcommitted
Format remaining files with prettier
Part of eclipsesource#1551
1 parent 9350211 commit 1f124e8

File tree

98 files changed

+1193
-1141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1193
-1141
lines changed

.devcontainer/devcontainer.json

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
22
// https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/javascript-node
33
{
4-
"name": "Node.js",
5-
"build": {
6-
"dockerfile": "Dockerfile",
7-
// Update 'VARIANT' to pick a Node version: 14, 16
8-
"args": {
9-
"VARIANT": "14"
10-
}
11-
},
12-
// Set *default* container specific settings.json values on container create.
13-
// Add the IDs of extensions you want installed when the container is created.
14-
"customizations": {
15-
"extensions": [
16-
"DavidAnson.vscode-markdownlint",
17-
"dbaeumer.vscode-eslint",
18-
"esbenp.prettier-vscode",
19-
"vue.volar"
20-
]
21-
},
22-
// Use 'postCreateCommand' to run commands after the container is created.
23-
"postCreateCommand": "npm ci && npm run init && npm run build",
24-
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
25-
"remoteUser": "node"
26-
}
4+
"name": "Node.js",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
// Update 'VARIANT' to pick a Node version: 14, 16
8+
"args": {
9+
"VARIANT": "14"
10+
}
11+
},
12+
// Set *default* container specific settings.json values on container create.
13+
// Add the IDs of extensions you want installed when the container is created.
14+
"customizations": {
15+
"extensions": [
16+
"DavidAnson.vscode-markdownlint",
17+
"dbaeumer.vscode-eslint",
18+
"esbenp.prettier-vscode",
19+
"vue.volar"
20+
]
21+
},
22+
// Use 'postCreateCommand' to run commands after the container is created.
23+
"postCreateCommand": "npm ci && npm run init && npm run build",
24+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
25+
"remoteUser": "node"
26+
}

.github/config/changelog.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
"sort": "DESC",
33
"pr_template": "- [${{LABELS}}] ${{TITLE}} (#${{NUMBER}})",
44
"template": "${{UNCATEGORIZED}}",
5-
"ignore_labels": [
6-
"dependencies"
7-
]
5+
"ignore_labels": ["dependencies"]
86
}

.github/workflows/ci.yaml

+26-26
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@ jobs:
1515
- windows-latest
1616
name: Run on ${{ matrix.os }}
1717
steps:
18-
- uses: actions/checkout@v2
19-
- name: Setup node
20-
uses: actions/setup-node@v2
21-
with:
22-
node-version: 14
23-
- name: Build
24-
run: |
25-
npm ci
26-
npm run init
27-
npm run build
28-
npm run bundle
29-
- name: Test
30-
if: matrix.os == 'windows-latest'
31-
run: |
32-
npm run test
33-
- name: Test & Coverage
34-
if: matrix.os == 'ubuntu-latest'
35-
run: |
36-
npm run test-cov
37-
npm run check-format
38-
npm run merge-report && cat coverage/lcov.info
39-
- name: Upload Coveralls Report
40-
if: success() && matrix.os == 'ubuntu-latest'
41-
uses: coverallsapp/github-action@master
42-
with:
43-
github-token: ${{ secrets.GITHUB_TOKEN }}
18+
- uses: actions/checkout@v2
19+
- name: Setup node
20+
uses: actions/setup-node@v2
21+
with:
22+
node-version: 14
23+
- name: Build
24+
run: |
25+
npm ci
26+
npm run init
27+
npm run build
28+
npm run bundle
29+
- name: Test
30+
if: matrix.os == 'windows-latest'
31+
run: |
32+
npm run test
33+
- name: Test & Coverage
34+
if: matrix.os == 'ubuntu-latest'
35+
run: |
36+
npm run test-cov
37+
npm run check-format
38+
npm run merge-report && cat coverage/lcov.info
39+
- name: Upload Coveralls Report
40+
if: success() && matrix.os == 'ubuntu-latest'
41+
uses: coverallsapp/github-action@master
42+
with:
43+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
release:
9-
if: |
9+
if: |
1010
startsWith(github.ref, 'refs/tags/v') &&
1111
!contains(github.ref, 'alpha') &&
1212
!contains(github.ref, 'beta') &&

.prettierrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ module.exports = {
33
singleQuote: true,
44
jsxSingleQuote: true,
55
endOfLine: 'auto',
6-
}
6+
};

.vscode/extensions.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"DavidAnson.vscode-markdownlint",
77
"dbaeumer.vscode-eslint",
88
"esbenp.prettier-vscode",
9-
"ms-vscode-remote.remote-containers",
9+
"ms-vscode-remote.remote-containers"
1010
],
1111
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
1212
"unwantedRecommendations": []
13-
}
13+
}

.vscode/settings.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,38 @@
1212
"editor.defaultFormatter": "esbenp.prettier-vscode",
1313
"editor.codeActionsOnSave": {
1414
"source.fixAll.eslint": true
15-
},
15+
}
1616
},
1717
"[javascriptreact]": {
1818
"editor.defaultFormatter": "esbenp.prettier-vscode",
1919
"editor.codeActionsOnSave": {
2020
"source.fixAll.eslint": true
21-
},
21+
}
2222
},
2323
"[json]": {
24-
"editor.defaultFormatter": "esbenp.prettier-vscode",
24+
"editor.defaultFormatter": "esbenp.prettier-vscode"
2525
},
2626
"[typescript]": {
2727
"editor.defaultFormatter": "esbenp.prettier-vscode",
2828
"editor.codeActionsOnSave": {
2929
"source.fixAll.eslint": true
30-
},
30+
}
3131
},
3232
"[typescriptreact]": {
3333
"editor.defaultFormatter": "esbenp.prettier-vscode",
3434
"editor.codeActionsOnSave": {
3535
"source.fixAll.eslint": true
36-
},
36+
}
3737
},
3838
"[vue]": {
3939
"editor.defaultFormatter": "esbenp.prettier-vscode",
4040
"editor.codeActionsOnSave": {
4141
"source.fixAll.eslint": true
42-
},
42+
}
4343
},
4444
"search.exclude": {
4545
"**/docs": true,
4646
"**/node_modules": true,
4747
"**/lib": true
48-
},
49-
}
48+
}
49+
}

MIGRATION.md

+52-38
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,16 @@ interface TesterContext {
2424
config: any;
2525
}
2626

27-
type Tester = (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => boolean;
28-
type RankedTester = (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => number;
27+
type Tester = (
28+
uischema: UISchemaElement,
29+
schema: JsonSchema,
30+
context: TesterContext
31+
) => boolean;
32+
type RankedTester = (
33+
uischema: UISchemaElement,
34+
schema: JsonSchema,
35+
context: TesterContext
36+
) => number;
2937
```
3038

3139
This allows the testers to resolve any `$ref` they might encounter in their handed over `schema` by using the context's `rootSchema`.
@@ -50,30 +58,37 @@ To restore the old behavior, you can use `json-schema-ref-parser` or other libra
5058
```ts
5159
import React, { useState } from 'react';
5260
import { JsonForms } from '@jsonforms/react';
53-
import { materialCells, materialRenderers } from '@jsonforms/material-renderers';
61+
import {
62+
materialCells,
63+
materialRenderers,
64+
} from '@jsonforms/material-renderers';
5465
import $RefParser from '@apidevtools/json-schema-ref-parser';
5566
import JsonRefs from 'json-refs';
5667

5768
import mySchemaWithReferences from 'myschema.json';
5869

5970
const refParserOptions = {
6071
dereference: {
61-
circular: false
62-
}
63-
}
72+
circular: false,
73+
},
74+
};
6475

6576
function App() {
6677
const [data, setData] = useState(initialData);
6778
const [resolvedSchema, setSchema] = useState();
6879

6980
useEffect(() => {
70-
$RefParser.dereference(mySchemaWithReferences).then(res => setSchema(res.$schema));
81+
$RefParser
82+
.dereference(mySchemaWithReferences)
83+
.then((res) => setSchema(res.$schema));
7184
// or
72-
JsonRefs.resolveRefs(mySchemaWithReferences).then(res => setSchema(res.resolved));
73-
},[]);
85+
JsonRefs.resolveRefs(mySchemaWithReferences).then((res) =>
86+
setSchema(res.resolved)
87+
);
88+
}, []);
7489

75-
if(resolvedSchema === undefined) {
76-
return <div> Loading... </div>
90+
if (resolvedSchema === undefined) {
91+
return <div> Loading... </div>;
7792
}
7893

7994
return (
@@ -143,12 +158,12 @@ export const schema = {
143158
type: 'object',
144159
properties: {
145160
name: {
146-
type: 'string'
147-
}
161+
type: 'string',
162+
},
148163
},
149-
required: ['name']
164+
required: ['name'],
150165
};
151-
export const data = {name: 'Send email to Adrian'};
166+
export const data = { name: 'Send email to Adrian' };
152167

153168
@Component({
154169
selector: 'app-root',
@@ -160,7 +175,7 @@ export const data = {name: 'Send email to Adrian'};
160175
[renderers]="renderers"
161176
(dataChange)="onDataChange($event)"
162177
></jsonforms>
163-
`
178+
`,
164179
})
165180
export class AppComponent {
166181
readonly renderers = angularMaterialRenderers;
@@ -201,15 +216,12 @@ All current Redux functionally can also be achieved with the standalone version.
201216
Previously the store was initialized like this:
202217

203218
```ts
204-
const store = createStore(
205-
combineReducers({ jsonforms: jsonformsReducer() }),
206-
{
207-
jsonforms: {
208-
cells: materialCells,
209-
renderers: materialRenderers
210-
}
211-
}
212-
);
219+
const store = createStore(combineReducers({ jsonforms: jsonformsReducer() }), {
220+
jsonforms: {
221+
cells: materialCells,
222+
renderers: materialRenderers,
223+
},
224+
});
213225
store.dispatch(Actions.init(data, schema, uischema));
214226
return (
215227
<Provider store={store}>
@@ -250,7 +262,7 @@ Within the standalone version, the renderer can just be provided to the `<JsonFo
250262
const renderers = [
251263
...materialRenderers,
252264
// register custom renderer
253-
{ tester: customControlTester, renderer: CustomControl }
265+
{ tester: customControlTester, renderer: CustomControl },
254266
];
255267

256268
const MyApp = () => (
@@ -259,7 +271,6 @@ const MyApp = () => (
259271
renderers={renderers}
260272
/>
261273
);
262-
263274
```
264275

265276
##### Example 3: Listen to data and validation changes
@@ -286,7 +297,10 @@ If you want to keep using the Redux variant of JSON Forms for now (which is not
286297
The new imports are available at `@jsonforms/react/lib/redux`, i.e.
287298

288299
```ts
289-
import { jsonformsReducer, JsonFormsReduxProvider } from '@jsonforms/react/lib/redux';
300+
import {
301+
jsonformsReducer,
302+
JsonFormsReduxProvider,
303+
} from '@jsonforms/react/lib/redux';
290304
```
291305

292306
## Migrating from JSON Forms 1.x (AngularJS 1.x)
@@ -298,8 +312,8 @@ The complexity of the migration of an existing JSON Forms 1.x application, which
298312
There are two big changes between JSON Forms 1 and JSON Forms 2 you need to understand when migrating your existing application.
299313

300314
1. JSON Forms 2.x does not rely on any specific UI framework [or library].
301-
The `2.0.0` initial release featured renderers based on [React](https://reactjs.org).
302-
An [Angular](https://angular.io) based renderer set was released with `2.1.0`.
315+
The `2.0.0` initial release featured renderers based on [React](https://reactjs.org).
316+
An [Angular](https://angular.io) based renderer set was released with `2.1.0`.
303317

304318
2. Since JSON Forms 2.x maintains its internal state via [redux](https://redux.js.org/), you will need to add it as a dependency to your application.
305319

@@ -314,20 +328,20 @@ Instead of:
314328

315329
```ts
316330
const uischema = {
317-
type: 'Control',
318-
scope: {
319-
$ref: '#/properties/name'
320-
}
321-
}
331+
type: 'Control',
332+
scope: {
333+
$ref: '#/properties/name',
334+
},
335+
};
322336
```
323337

324338
simply write:
325339

326340
```ts
327341
const uischema = {
328-
type: 'Control',
329-
scope: '#/properties/name'
330-
}
342+
type: 'Control',
343+
scope: '#/properties/name',
344+
};
331345
```
332346

333347
Otherwise the UI schema remains unchanged and works like in JSON Forms 1.x.

0 commit comments

Comments
 (0)