Browse Source

Add eslint-plugin-compat

pull/2079/head
afc163 8 years ago
parent
commit
3a08a00f29
  1. 21
      .babelrc.js
  2. 5
      .eslintrc.js
  3. 3
      package.json
  4. 12
      src/components/Authorized/Authorized.js
  5. 25
      src/pages/Exception/403.js
  6. 25
      src/pages/Exception/404.js
  7. 25
      src/pages/Exception/500.js

21
.babelrc.js

@ -1,21 +0,0 @@
const path = require('path');
module.exports = {
plugins: [
[
'module-resolver',
{
alias: {
components: path.join(__dirname, './src/components'),
},
},
],
[
'import',
{
libraryName: 'antd',
style: true, // or 'css'
},
],
],
};

5
.eslintrc.js

@ -1,6 +1,6 @@
module.exports = {
parser: 'babel-eslint',
extends: ['airbnb', 'prettier'],
extends: ['airbnb', 'prettier', 'plugin:compat/recommended'],
env: {
browser: true,
node: true,
@ -13,7 +13,6 @@ module.exports = {
'react/jsx-filename-extension': [1, { extensions: ['.js'] }],
'react/jsx-wrap-multilines': 0,
'react/prop-types': 0,
'react/prefer-stateless-function': 0,
'react/forbid-prop-types': 0,
'react/jsx-one-expression-per-line': 0,
'import/no-unresolved': 0,
@ -24,6 +23,6 @@ module.exports = {
'jsx-a11y/anchor-is-valid': 0,
},
settings: {
polyfills: ['fetch', 'promises'],
polyfills: ['fetch', 'promises', 'url'],
},
};

3
package.json

@ -50,7 +50,7 @@
"@types/react-dom": "^16.0.6",
"antd-pro-merge-less": "^0.0.9",
"antd-pro-theme-webpack-plugin": "^1.1.8",
"babel-eslint": "^9.0.0",
"babel-eslint": "^8.2.6",
"cross-env": "^5.1.1",
"cross-port-killer": "^1.0.1",
"enzyme": "^3.4.4",
@ -59,7 +59,6 @@
"eslint-config-prettier": "^3.0.1",
"eslint-plugin-babel": "^5.1.0",
"eslint-plugin-compat": "^2.5.1",
"eslint-plugin-flowtype": "2.50.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-markdown": "^1.0.0-beta.6",

12
src/components/Authorized/Authorized.js

@ -1,12 +1,8 @@
import React from 'react';
import CheckPermissions from './CheckPermissions';
class Authorized extends React.Component {
render() {
const { children, authority, noMatch = null } = this.props;
const childrenRender = typeof children === 'undefined' ? null : children;
return CheckPermissions(authority, childrenRender, noMatch);
}
}
const Authorized = ({ children, authority, noMatch = null }) => {
const childrenRender = typeof children === 'undefined' ? null : children;
return CheckPermissions(authority, childrenRender, noMatch);
};
export default Authorized;

25
src/pages/Exception/403.js

@ -1,19 +1,16 @@
import React, { Component } from 'react';
import React from 'react';
import { formatMessage } from 'umi/locale';
import Link from 'umi/link';
import Exception from '@/components/Exception';
class Exception403 extends Component {
render() {
return (
<Exception
type="403"
desc={formatMessage({ id: 'app.exception.description.403' }, {})}
style={{ minHeight: 500, height: '80%' }}
linkElement={Link}
backText={formatMessage({ id: 'app.exception.back' })}
/>
);
}
}
const Exception403 = () => (
<Exception
type="403"
desc={formatMessage({ id: 'app.exception.description.403' }, {})}
style={{ minHeight: 500, height: '80%' }}
linkElement={Link}
backText={formatMessage({ id: 'app.exception.back' })}
/>
);
export default Exception403;

25
src/pages/Exception/404.js

@ -1,19 +1,16 @@
import React, { Component } from 'react';
import React from 'react';
import { formatMessage } from 'umi/locale';
import Link from 'umi/link';
import Exception from '@/components/Exception';
class Exception404 extends Component {
render() {
return (
<Exception
type="404"
desc={formatMessage({ id: 'app.exception.description.404' }, {})}
style={{ minHeight: 500, height: '80%' }}
linkElement={Link}
backText={formatMessage({ id: 'app.exception.back' })}
/>
);
}
}
const Exception404 = () => (
<Exception
type="404"
desc={formatMessage({ id: 'app.exception.description.404' }, {})}
style={{ minHeight: 500, height: '80%' }}
linkElement={Link}
backText={formatMessage({ id: 'app.exception.back' })}
/>
);
export default Exception404;

25
src/pages/Exception/500.js

@ -1,19 +1,16 @@
import React, { Component } from 'react';
import React from 'react';
import { formatMessage } from 'umi/locale';
import Link from 'umi/link';
import Exception from '@/components/Exception';
class Exception500 extends Component {
render() {
return (
<Exception
type="500"
desc={formatMessage({ id: 'app.exception.description.500' }, {})}
style={{ minHeight: 500, height: '80%' }}
linkElement={Link}
backText={formatMessage({ id: 'app.exception.back' })}
/>
);
}
}
const Exception500 = () => (
<Exception
type="500"
desc={formatMessage({ id: 'app.exception.description.500' }, {})}
style={{ minHeight: 500, height: '80%' }}
linkElement={Link}
backText={formatMessage({ id: 'app.exception.back' })}
/>
);
export default Exception500;

Loading…
Cancel
Save