update dependencies + eslint react and prop types
This commit is contained in:
parent
bf2dde25e6
commit
1082f8f244
34
.eslintrc
34
.eslintrc
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"plugins": ["react"],
|
||||
"rules": {
|
||||
"no-array-constructor": 2,
|
||||
"no-catch-shadow": 2,
|
||||
|
@ -130,7 +131,22 @@
|
|||
"comma-spacing": 1,
|
||||
"space-unary-ops": [1, { "words": true, "nonwords": false }],
|
||||
"indent": [2, 4],
|
||||
"space-before-function-paren": [1, {"anonymous": "always", "named": "never"}]
|
||||
"space-before-function-paren": [1, {"anonymous": "always", "named": "never"}],
|
||||
|
||||
"react/display-name": 2,
|
||||
"react/jsx-quotes": 1,
|
||||
"react/jsx-no-undef": 1,
|
||||
"react/jsx-sort-props": 1,
|
||||
"react/jsx-uses-react": 1,
|
||||
"react/jsx-uses-vars": 1,
|
||||
"react/no-did-mount-set-state": 1,
|
||||
"react/no-did-update-set-state": 1,
|
||||
"react/no-multi-comp": 0,
|
||||
"react/no-unknown-property": 1,
|
||||
"react/prop-types": 1,
|
||||
"react/react-in-jsx-scope": 1,
|
||||
"react/self-closing-comp": 1,
|
||||
"react/wrap-multilines": 1
|
||||
},
|
||||
"env": {
|
||||
"browser": false,
|
||||
|
@ -138,20 +154,6 @@
|
|||
"amd": true
|
||||
},
|
||||
"globals": {
|
||||
"requirejs": true,
|
||||
"xdescribe": false,
|
||||
"describe": false,
|
||||
"it": false,
|
||||
"xit": false,
|
||||
"beforeEach": false,
|
||||
"afterEach": false,
|
||||
"jasmine": false,
|
||||
"expect": false,
|
||||
"waitsFor": false,
|
||||
"waits": false,
|
||||
"runs": false,
|
||||
"any": false,
|
||||
"spyOn": false,
|
||||
"createSpy": false
|
||||
"requirejs": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
"brace": "^0.5.0",
|
||||
"brfs": "^1.4.0",
|
||||
"coveralls": "^2.11.2",
|
||||
"eslint-plugin-react": "^2.0.1",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-browserify": "^3.6.0",
|
||||
"grunt-contrib-requirejs": "^0.4.4",
|
||||
|
|
|
@ -73,7 +73,10 @@ define(['react', 'lodash', 'jquery', './libs/codemirror-4.8/lib/codemirror',
|
|||
id: React.PropTypes.string,
|
||||
readOnly: React.PropTypes.bool,
|
||||
runMode: React.PropTypes.bool,
|
||||
mode: React.PropTypes.string
|
||||
mode: React.PropTypes.string,
|
||||
value: React.PropTypes.string,
|
||||
valueLink: React.PropTypes.string,
|
||||
onChange: React.PropTypes.func
|
||||
},
|
||||
getDefaultProps: function () {
|
||||
return {
|
||||
|
|
|
@ -8,7 +8,9 @@ define(['react', 'lodash', 'jquery', './libs/codemirror-4.8/lib/codemirror',
|
|||
displayName: 'CodeMirrorViewer',
|
||||
propTypes: {
|
||||
id: React.PropTypes.string,
|
||||
mode: React.PropTypes.string
|
||||
mode: React.PropTypes.string,
|
||||
value: React.PropTypes.string,
|
||||
valueLink: React.PropTypes.string
|
||||
},
|
||||
getDefaultProps: function () {
|
||||
return {
|
||||
|
|
|
@ -7,6 +7,14 @@ define(['react', 'lodash'/*, 'ace'*/], function (React, _/*, ace*/) {
|
|||
|
||||
var editor = React.createClass({
|
||||
displayName: 'BraceEditor',
|
||||
propTypes: {
|
||||
id: React.PropTypes.string,
|
||||
mode: React.PropTypes.string,
|
||||
readOnly: React.PropTypes.bool,
|
||||
value: React.PropTypes.string,
|
||||
valueLink: React.PropTypes.string,
|
||||
onChange: React.PropTypes.function
|
||||
},
|
||||
getInitialState: function () {
|
||||
return {
|
||||
editorId: _.uniqueId()
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -6,36 +6,36 @@ define([
|
|||
], function (React, _, playground, viewer) {
|
||||
'use strict';
|
||||
return function () {
|
||||
return React.createElement('div', { 'id': 'examples' }, React.createElement('div', { 'className': 'example' }, React.createElement('h3', {}, 'Hello world in React Templates'), React.createElement('p', {}, '\n Simple "Hello world" HTML transformed into React JavaScript code.\n '), React.createElement(playground, _.merge({}, {
|
||||
return React.createElement('div', { 'id': 'examples' }, React.createElement('div', { 'className': 'example' }, React.createElement('h3', {}, 'Hello world in React Templates'), React.createElement('p', {}, '\n Simple "Hello world" HTML transformed into React JavaScript code.\n '), React.createElement(playground, _.assign({}, {
|
||||
'id': 'helloExample',
|
||||
'direction': 'horizontal'
|
||||
}, this.state.samples.hello))), React.createElement('div', { 'className': 'example' }, React.createElement('h3', {}, 'rt-if'), React.createElement('p', {}, '\n This shows the use of rt-if.\n '), React.createElement(playground, _.merge({}, {
|
||||
}, this.state.samples.hello))), React.createElement('div', { 'className': 'example' }, React.createElement('h3', {}, 'rt-if'), React.createElement('p', {}, '\n This shows the use of rt-if.\n '), React.createElement(playground, _.assign({}, {
|
||||
'id': 'ifExample',
|
||||
'direction': 'horizontal'
|
||||
}, this.state.samples.rtIf))), React.createElement('div', { 'className': 'example' }, React.createElement('h3', {}, 'rt-repeat'), React.createElement('p', {}, '\n This uses rt-repeat to show multiple items and rt-scope to create a reusable name for multiple calculations.\n '), React.createElement(playground, _.merge({}, {
|
||||
}, this.state.samples.rtIf))), React.createElement('div', { 'className': 'example' }, React.createElement('h3', {}, 'rt-repeat'), React.createElement('p', {}, '\n This uses rt-repeat to show multiple items and rt-scope to create a reusable name for multiple calculations.\n '), React.createElement(playground, _.assign({}, {
|
||||
'id': 'repeatExample',
|
||||
'direction': 'horizontal'
|
||||
}, this.state.samples.repeat))), React.createElement('div', { 'className': 'example' }, React.createElement('h3', {}, 'rt-props'), React.createElement('p', {}, '\n rt-props is used to pass all the original properties set on this component (except the ones used for the component logic: onClick and eventId) to the element that will actually represent this component.\n '), React.createElement(playground, _.merge({}, {
|
||||
}, this.state.samples.repeat))), React.createElement('div', { 'className': 'example' }, React.createElement('h3', {}, 'rt-props'), React.createElement('p', {}, '\n rt-props is used to pass all the original properties set on this component (except the ones used for the component logic: onClick and eventId) to the element that will actually represent this component.\n '), React.createElement(playground, _.assign({}, {
|
||||
'id': 'propsExample',
|
||||
'direction': 'horizontal'
|
||||
}, this.state.samples.props))), React.createElement('div', { 'className': 'example' }, React.createElement('h3', {}, 'Improved todo list'), React.createElement('p', {}, '\n Every project needs a todo list example, so here is ours.\n '), React.createElement(playground, _.merge({}, {
|
||||
}, this.state.samples.props))), React.createElement('div', { 'className': 'example' }, React.createElement('h3', {}, 'Improved todo list'), React.createElement('p', {}, '\n Every project needs a todo list example, so here is ours.\n '), React.createElement(playground, _.assign({}, {
|
||||
'id': 'todoExample',
|
||||
'direction': 'horizontal'
|
||||
}, this.state.samples.todo))), React.createElement('div', { 'className': 'example' }, React.createElement('h3', {}, 'Weather'), React.createElement('p', {}, '\n This example shows working with async events, the usage of regular event handler function pointers instead of lambda expression, and working with two-way binding.\n '), React.createElement(playground, _.merge({}, {
|
||||
}, this.state.samples.todo))), React.createElement('div', { 'className': 'example' }, React.createElement('h3', {}, 'Weather'), React.createElement('p', {}, '\n This example shows working with async events, the usage of regular event handler function pointers instead of lambda expression, and working with two-way binding.\n '), React.createElement(playground, _.assign({}, {
|
||||
'id': 'weatherExample',
|
||||
'direction': 'horizontal'
|
||||
}, this.state.samples.weather))), React.createElement('div', {
|
||||
'id': 'rt-require',
|
||||
'className': 'example'
|
||||
}, React.createElement('h3', {}, 'rt-require'), React.createElement('p', {}, '\n This example shows how to load other React components and libraries into a React template and then use them within the template.\n '), React.createElement(viewer, _.merge({}, { 'mode': 'javascript' }, this.state.rtRequire))), React.createElement('div', {
|
||||
}, React.createElement('h3', {}, 'rt-require'), React.createElement('p', {}, '\n This example shows how to load other React components and libraries into a React template and then use them within the template.\n '), React.createElement(viewer, _.assign({}, { 'mode': 'javascript' }, this.state.rtRequire))), React.createElement('div', {
|
||||
'id': 'amd',
|
||||
'className': 'example'
|
||||
}, React.createElement('h3', {}, 'AMD'), React.createElement('p', {}, '\n This example shows the rt-require sample output with AMD support.\n '), React.createElement(viewer, _.merge({}, { 'mode': 'javascript' }, this.state.amd))), React.createElement('div', {
|
||||
}, React.createElement('h3', {}, 'AMD'), React.createElement('p', {}, '\n This example shows the rt-require sample output with AMD support.\n '), React.createElement(viewer, _.assign({}, { 'mode': 'javascript' }, this.state.amd))), React.createElement('div', {
|
||||
'id': 'commonjs',
|
||||
'className': 'example'
|
||||
}, React.createElement('h3', {}, 'CommonJS'), React.createElement('p', {}, '\n This example shows the rt-require sample output with CommonJS support.\n '), React.createElement(viewer, _.merge({}, { 'mode': 'javascript' }, this.state.cjs))), React.createElement('div', {
|
||||
}, React.createElement('h3', {}, 'CommonJS'), React.createElement('p', {}, '\n This example shows the rt-require sample output with CommonJS support.\n '), React.createElement(viewer, _.assign({}, { 'mode': 'javascript' }, this.state.cjs))), React.createElement('div', {
|
||||
'id': 'es6',
|
||||
'className': 'example'
|
||||
}, React.createElement('h3', {}, 'ES6'), React.createElement('p', {}, '\n This example shows the rt-require sample output with ES6 support.\n '), React.createElement(viewer, _.merge({}, { 'mode': 'javascript' }, this.state.es6))));
|
||||
}, React.createElement('h3', {}, 'ES6'), React.createElement('p', {}, '\n This example shows the rt-require sample output with ES6 support.\n '), React.createElement(viewer, _.assign({}, { 'mode': 'javascript' }, this.state.es6))));
|
||||
};
|
||||
});
|
|
@ -92,7 +92,10 @@ define(['react', 'jquery', 'lodash', './playground-fiddle.rt', './playground.rt'
|
|||
propTypes: {
|
||||
direction: React.PropTypes.oneOf(['horizontal', 'vertical']),
|
||||
codeVisible: React.PropTypes.bool,
|
||||
fiddle: React.PropTypes.bool
|
||||
fiddle: React.PropTypes.bool,
|
||||
templateHTML: React.PropTypes.string,
|
||||
templateProps: React.PropTypes.string,
|
||||
name: React.PropTypes.string
|
||||
},
|
||||
templateSource: '',
|
||||
validHTML: true,
|
||||
|
|
|
@ -28,14 +28,14 @@ define([
|
|||
return React.createElement('div', { 'className': 'playground' }, React.createElement('div', {
|
||||
'id': this.props.id + '-myTab',
|
||||
'className': 'code-area ' + this.getLayoutClass()
|
||||
} /* Nav tabs */, React.createElement.apply(this, _.flatten([
|
||||
} /* Nav tabs */, React.createElement.apply(this, [
|
||||
'ul',
|
||||
{
|
||||
'className': 'nav nav-tabs',
|
||||
'role': 'tablist'
|
||||
},
|
||||
_.map(this.getTabs(), repeatTab2.bind(this))
|
||||
])) /* Tab panes */, React.createElement('div', {}, this.state.currentTab === 'templateHTML' ? React.createElement('div', { 'className': 'tab-pane active' }, React.createElement(CodeEditor, {
|
||||
]) /* Tab panes */, React.createElement('div', {}, this.state.currentTab === 'templateHTML' ? React.createElement('div', { 'className': 'tab-pane active' }, React.createElement(CodeEditor, {
|
||||
'ref': 'editorRT',
|
||||
'className': 'large-text-area',
|
||||
'style': { border: this.validHTML ? '' : '2px solid red' },
|
||||
|
|
|
@ -180,8 +180,7 @@ test('html tests', function (t) {
|
|||
return content.apply(this, requirements);
|
||||
};
|
||||
var comp = React.createFactory(React.createClass({
|
||||
/* eslint no-eval:0 */
|
||||
render: eval(code)
|
||||
render: eval(code) //eslint-disable-line no-eval
|
||||
}));
|
||||
var actual = React.renderToStaticMarkup(comp());
|
||||
actual = normalizeHtml(actual);
|
||||
|
|
Loading…
Reference in New Issue