Skip to content

Commit

Permalink
Upgrade React version to 0.14.9
Browse files Browse the repository at this point in the history
  • Loading branch information
superman66 committed Aug 11, 2017
1 parent 6d5035f commit 187de78
Show file tree
Hide file tree
Showing 10 changed files with 328 additions and 226 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ root = true
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

Expand Down
29 changes: 0 additions & 29 deletions .eslintrc

This file was deleted.

71 changes: 71 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
'use strict';

const OFF = 0;
const WARNING = 1;
const ERROR = 2;

module.exports = {
'extends': 'airbnb',
'env': {
'browser': true,
'node': true,
'es6': true,
'mocha': true
},
globals: {
assert: true
},
'parser': 'babel-eslint',
'plugins': [
'react',
'babel'
],
'parserOptions': {
'ecmaVersion': 6,
'sourceType': 'module',
'ecmaFeatures': {
'jsx': true,
'experimentalObjectRestSpread': true
}
},
'rules': {
'indent': [ERROR, 2, { 'SwitchCase': 1 }], //规定代码的缩进方式:2个空格
'camelcase': ERROR, //强制驼峰法命名
'curly': ERROR, //必须使用 if(){} 中的{}
'eqeqeq': ERROR, //必须使用全等
'brace-style': [ERROR, '1tbs'], //大括号风格
'quotes': [ERROR, 'single'], //引号类型
'semi': [ERROR, 'always'], //语句强制分号结尾
'space-infix-ops': ERROR, //中缀操作符周围要不要有空格
'no-param-reassign': OFF, //不允许对函数的形参进行赋值
'prefer-spread': ERROR, //首选展开运算
'comma-dangle': OFF, //不允许或强制在对象字面量或者数组属性的结尾使用逗号
'padded-blocks': OFF, //规定代码块前后是否要加空行
'prefer-const': OFF,
'no-multi-spaces': ERROR,
'no-var': OFF,
'one-var': OFF,
'class-methods-use-this': WARNING,
'no-unused-expressions': [ERROR, { allowShortCircuit: true }],
/**
* https://github.com/airbnb/javascript/tree/master/react
*/
'react/prefer-es6-class': [WARNING, 'always'], //使用 class extends React.Component
'react/jsx-pascal-case': ERROR, //骆驼式命名
'react/jsx-closing-bracket-location': ERROR, //JSX语法缩进/格式
'react/jsx-curly-spacing': ERROR, //JSX {} 引用括号里两边加空格
'react/jsx-boolean-value': [OFF, 'always'], //如果属性值为 true, 可以直接省略
'jsx-quotes': [ERROR, 'prefer-double'], //JSX属性值总是使用双引号(")
'react/no-string-refs': ERROR, //Refs里使用回调函数
'react/jsx-wrap-multilines': ERROR, //多行的JSX标签写在 ()里
'react/self-closing-comp': ERROR, //没有子元素的标签来说总是自己关闭标签
'react/jsx-no-bind': ERROR, //当在 render() 里使用事件处理方法时,提前在构造函数里把 this 绑定上去
'react/no-is-mounted': ERROR, //不要再使用 isMounted
'react/prop-types': [ERROR, { ignore: ['children', 'className', 'style'] }],
'jsx-a11y/href-no-hash': OFF,
'jsx-a11y/label-has-for': OFF,
'react/jsx-filename-extension': OFF,
'react/prefer-stateless-function': OFF,
'react/require-default-props':OFF
}
};
6 changes: 6 additions & 0 deletions docs/gh-pages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var ghpages = require('gh-pages');
var path = require('path');

ghpages.publish(path.join(__dirname, '../assets'), function(err) {
console.log(err);
});
66 changes: 33 additions & 33 deletions docs/index.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@

import React from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import ECharts, {dispatchAction} from '../src';
import { Markdown } from 'markdownloader';

import ECharts from '../src';
import './style.less';
import './highlight.less';


import baseBarOptions from './data/bar-base';
import mapOptions from './data/map.js';
import mapOptions from './data/map';
import chinaJson from './data/china.json';


const events = {
click:function(params){
console.log(params);
}
click(params) {
console.log(params);
}
};

ECharts.registerMap('china',chinaJson);
ECharts.registerMap('china', chinaJson);

const App = React.createClass({
class App extends Component {

render() {
let styles = Object.assign({
width: '100%',
height: '400px'
}, this.props.style);
render() {
let styles = Object.assign({
width: '100%',
height: '400px'
}, this.props.style);

return (
<div className="doc-page">
<div className="doc-container">
return (
<div className="doc-page">
<div className="doc-container">

<div style={styles}>
<h1>RSuite ECharts</h1>
<p>ECharts for React</p>
<ECharts option={baseBarOptions} onEvents={events} />
<div style={styles}>
<h1>RSuite ECharts</h1>
<p>ECharts for React</p>
<ECharts option={baseBarOptions} onEvents={events} />


<h4>Map</h4>
<ECharts option={mapOptions} onEvents={events} />
<h4>Map</h4>
<ECharts option={mapOptions} onEvents={events} />

<Markdown>
{require('./README.md') }
</Markdown>
</div>
</div>
</div>
);
}
});
<Markdown>
{require('./README.md')}
</Markdown>
</div>
</div>
</div>
);
}
}


const rootElement = document.getElementById('app');

ReactDOM.render(<App />,
rootElement
rootElement
);
35 changes: 21 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,58 @@
"description": "ECharts for React",
"main": "lib/index.js",
"scripts": {
"build": "rm -rf lib && babel src --out-dir lib",
"dev": "NODE_ENV=development webpack-dev-server --hot --inline --progress --colors --port 3100",
"docs": "NODE_ENV=production webpack --progress -colors ",
"cp:docs": "cp -rf ./assets/* ../rsuite.github.io/rsuite-echarts/"
"dev": "NODE_ENV=development webpack-dev-server --inline --progress --colors --port 3000 --host 0.0.0.0 --devtool source-map ",
"docs": "rm -rf assets && NODE_ENV=production webpack ",
"build": "rm -rf lib && babel src --out-dir lib && cp -R src/less lib",
"publish-docs": "node docs/gh-pages.js"
},
"dependencies": {
"echarts": "^3.1.10",
"element-resize-event": "^2.0.5"
},
"peerDependencies": {
"react": ">=0.14.0"
"react": "^0.14.9 || >=15.3.0",
"react-dom": ">=0.14.0"
},
"author": "[email protected]",
"license": "MIT",
"repository": {
"type": "git",
"url": "[email protected]:rsuite/rsuite-echarts.git"
},
"homepage": "https://github.com/rsuite/rsuite-echarts",
"devDependencies": {
"react": "^0.14.2",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"prop-types": "^15.5.10",
"babel-core": "^6.7.6",
"babel-loader": "^6.2.4",
"babel-eslint": "^6.1.2",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.5.0",
"babel-standalone": "^6.7.7",
"css-loader": "^0.23.1",
"es5-shim": "^4.1.14",
"eslint": "^2.8.0",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.0.1",
"eslint-plugin-babel": "^3.2.0",
"eslint-plugin-react": "^5.0.1",
"extract-text-webpack-plugin": "^1.0.1",
"eslint-plugin-jsx-a11y": "^5.0.1",
"eslint-plugin-import": "^2.6.1",
"eslint-plugin-react": "^7.0.1",
"extract-text-webpack-plugin": "^2.0.0",
"highlight.js": "^9.5.0",
"html-loader": "^0.4.3",
"html-webpack-plugin": "^2.22.0",
"json-loader": "^0.5.4",
"less": "^2.7.1",
"less-loader": "^2.2.3",
"markdown-loader": "^0.1.7",
"markdown-loader": "^2.0.0",
"markdownloader": "^1.0.5",
"marked": "^0.3.5",
"react-dom": "^0.14.2",
"react-hot-loader": "^1.3.0",
"style-loader": "^0.13.1",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1",
"markdownloader": "1.0.5"
"webpack": "^3.0.0",
"webpack-dev-server": "^2.2.0"
}
}
Loading

0 comments on commit 187de78

Please sign in to comment.