Skip to content

Commit dd386aa

Browse files
authored
Update dependencies (rjsf-team#722)
* Bump eslint and related packages These aren't the most up-to-date versions of these dependencies as of this writing (babel-eslint released v8.0.1 and jsx-a11y has a 6.0 release), but these are the peer dependencies required by eslint-config-react-app. The new version of eslint appears to have slightly different configuration than the old version. * Fix new eslint-flagged errors * Fix formatting * Update to react-codemirror2 This appears to be better-maintained. See also Kinto/kinto-admin#448.
1 parent 132a6cc commit dd386aa

File tree

4 files changed

+18
-31
lines changed

4 files changed

+18
-31
lines changed

.eslintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"react/jsx-uses-react": 2,
55
"react/jsx-uses-vars": 2,
66
"react/react-in-jsx-scope": 2,
7-
"react/jsx-space-before-closing": [1, "always"],
7+
"react/jsx-tag-spacing": [1, {
8+
"beforeSelfClosing": "always"
9+
}],
810
"curly": [2],
911
"linebreak-style": [2, "unix"],
1012
"semi": [2, "always"],
@@ -30,6 +32,7 @@
3032
"experimentalObjectRestSpread": true
3133
},
3234
"plugins": [
35+
"jsx-a11y",
3336
"react"
3437
]
3538
}

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"atob": "^2.0.3",
5050
"babel-cli": "^6.18.0",
5151
"babel-core": "^6.18.2",
52-
"babel-eslint": "^6.1.2",
52+
"babel-eslint": "^7.2.3",
5353
"babel-loader": "^6.2.7",
5454
"babel-plugin-react-transform": "^2.0.2",
5555
"babel-plugin-transform-class-properties": "^6.18.0",
@@ -58,13 +58,15 @@
5858
"babel-preset-react": "^6.16.0",
5959
"babel-register": "^6.18.0",
6060
"chai": "^3.3.0",
61-
"codemirror": "^5.20.2",
61+
"codemirror": "^5.30.0",
6262
"cross-env": "^2.0.1",
6363
"css-loader": "^0.23.1",
64-
"eslint": "^3.15.0",
64+
"eslint": "^4.9.0",
6565
"eslint-config-react-app": "^2.0.1",
66+
"eslint-plugin-flowtype": "^2.39.1",
6667
"eslint-plugin-import": "^2.7.0",
67-
"eslint-plugin-react": "^4.2.3",
68+
"eslint-plugin-jsx-a11y": "^5.1.1",
69+
"eslint-plugin-react": "^7.4.0",
6870
"estraverse": "^4.2.0",
6971
"estraverse-fb": "^1.3.1",
7072
"express": "^4.14.0",
@@ -79,7 +81,7 @@
7981
"prettier": "^1.7.2",
8082
"react": "^15.5.0",
8183
"react-addons-test-utils": "^15.3.2",
82-
"react-codemirror": "^0.2.3",
84+
"react-codemirror2": "^2.0.2",
8385
"react-dom": "^15.3.2",
8486
"react-transform-catch-errors": "^1.0.0",
8587
"react-transform-hmr": "^1.0.1",

playground/app.js

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from "react";
22
import { render } from "react-dom";
3-
import Codemirror from "react-codemirror";
3+
import CodeMirror from "react-codemirror2";
44
import "codemirror/mode/javascript/javascript";
55

66
import { shouldRender } from "../src/utils";
@@ -18,25 +18,6 @@ import "codemirror/theme/solarized.css";
1818
import "codemirror/theme/monokai.css";
1919
import "codemirror/theme/eclipse.css";
2020

21-
// Patching CodeMirror#componentWillReceiveProps so it's executed synchronously
22-
// Ref https://github.com/mozilla-services/react-jsonschema-form/issues/174
23-
Codemirror.prototype.componentWillReceiveProps = function(nextProps) {
24-
if (
25-
this.codeMirror &&
26-
nextProps.value !== undefined &&
27-
this.codeMirror.getValue() != nextProps.value
28-
) {
29-
this.codeMirror.setValue(nextProps.value);
30-
}
31-
if (typeof nextProps.options === "object") {
32-
for (var optionName in nextProps.options) {
33-
if (nextProps.options.hasOwnProperty(optionName)) {
34-
this.codeMirror.setOption(optionName, nextProps.options[optionName]);
35-
}
36-
}
37-
}
38-
};
39-
4021
const log = type => console.log.bind(console, type);
4122
const fromJson = json => JSON.parse(json);
4223
const toJson = val => JSON.stringify(val, null, 2);
@@ -208,7 +189,7 @@ class Editor extends Component {
208189
return shouldRender(this, nextProps, nextState);
209190
}
210191

211-
onCodeChange = code => {
192+
onCodeChange = (editor, metadata, code) => {
212193
this.setState({ valid: true, code });
213194
setImmediate(() => {
214195
try {
@@ -229,7 +210,7 @@ class Editor extends Component {
229210
<span className={`${cls} glyphicon glyphicon-${icon}`} />
230211
{" " + title}
231212
</div>
232-
<Codemirror
213+
<CodeMirror
233214
value={this.state.code}
234215
onChange={this.onCodeChange}
235216
options={Object.assign({}, cmOptions, { theme })}

test/uiSchema_test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,11 @@ describe("uiSchema", () => {
354354
};
355355

356356
const CustomWidget = props => {
357-
const { value, options } = props;
357+
const { options } = props;
358358
const { enumOptions, className } = options;
359359
return (
360360
<select className={className}>
361-
{enumOptions.map(({ label, value }, i) => (
361+
{enumOptions.map(({ value }, i) => (
362362
<option key={i}>{value}</option>
363363
))}
364364
</select>
@@ -379,7 +379,8 @@ describe("uiSchema", () => {
379379
expect(node.querySelectorAll(".custom option")).to.have.length.of(2);
380380
});
381381
});
382-
describe("enum fields disbaled options", () => {
382+
383+
describe("enum fields disabled options", () => {
383384
const schema = {
384385
type: "object",
385386
properties: {

0 commit comments

Comments
 (0)