Commit 3a08a00f authored by afc163's avatar afc163

Add eslint-plugin-compat

parent 3def673b
const path = require('path');
module.exports = {
plugins: [
[
'module-resolver',
{
alias: {
components: path.join(__dirname, './src/components'),
},
},
],
[
'import',
{
libraryName: 'antd',
style: true, // or 'css'
},
],
],
};
module.exports = { module.exports = {
parser: 'babel-eslint', parser: 'babel-eslint',
extends: ['airbnb', 'prettier'], extends: ['airbnb', 'prettier', 'plugin:compat/recommended'],
env: { env: {
browser: true, browser: true,
node: true, node: true,
...@@ -13,7 +13,6 @@ module.exports = { ...@@ -13,7 +13,6 @@ module.exports = {
'react/jsx-filename-extension': [1, { extensions: ['.js'] }], 'react/jsx-filename-extension': [1, { extensions: ['.js'] }],
'react/jsx-wrap-multilines': 0, 'react/jsx-wrap-multilines': 0,
'react/prop-types': 0, 'react/prop-types': 0,
'react/prefer-stateless-function': 0,
'react/forbid-prop-types': 0, 'react/forbid-prop-types': 0,
'react/jsx-one-expression-per-line': 0, 'react/jsx-one-expression-per-line': 0,
'import/no-unresolved': 0, 'import/no-unresolved': 0,
...@@ -24,6 +23,6 @@ module.exports = { ...@@ -24,6 +23,6 @@ module.exports = {
'jsx-a11y/anchor-is-valid': 0, 'jsx-a11y/anchor-is-valid': 0,
}, },
settings: { settings: {
polyfills: ['fetch', 'promises'], polyfills: ['fetch', 'promises', 'url'],
}, },
}; };
import React from 'react';
import CheckPermissions from './CheckPermissions'; import CheckPermissions from './CheckPermissions';
class Authorized extends React.Component { const Authorized = ({ children, authority, noMatch = null }) => {
render() { const childrenRender = typeof children === 'undefined' ? null : children;
const { children, authority, noMatch = null } = this.props; return CheckPermissions(authority, childrenRender, noMatch);
const childrenRender = typeof children === 'undefined' ? null : children; };
return CheckPermissions(authority, childrenRender, noMatch);
}
}
export default Authorized; export default Authorized;
import React, { Component } from 'react'; import React from 'react';
import { formatMessage } from 'umi/locale'; import { formatMessage } from 'umi/locale';
import Link from 'umi/link'; import Link from 'umi/link';
import Exception from '@/components/Exception'; import Exception from '@/components/Exception';
class Exception403 extends Component { const Exception403 = () => (
render() { <Exception
return ( type="403"
<Exception desc={formatMessage({ id: 'app.exception.description.403' }, {})}
type="403" style={{ minHeight: 500, height: '80%' }}
desc={formatMessage({ id: 'app.exception.description.403' }, {})} linkElement={Link}
style={{ minHeight: 500, height: '80%' }} backText={formatMessage({ id: 'app.exception.back' })}
linkElement={Link} />
backText={formatMessage({ id: 'app.exception.back' })} );
/>
);
}
}
export default Exception403; export default Exception403;
import React, { Component } from 'react'; import React from 'react';
import { formatMessage } from 'umi/locale'; import { formatMessage } from 'umi/locale';
import Link from 'umi/link'; import Link from 'umi/link';
import Exception from '@/components/Exception'; import Exception from '@/components/Exception';
class Exception404 extends Component { const Exception404 = () => (
render() { <Exception
return ( type="404"
<Exception desc={formatMessage({ id: 'app.exception.description.404' }, {})}
type="404" style={{ minHeight: 500, height: '80%' }}
desc={formatMessage({ id: 'app.exception.description.404' }, {})} linkElement={Link}
style={{ minHeight: 500, height: '80%' }} backText={formatMessage({ id: 'app.exception.back' })}
linkElement={Link} />
backText={formatMessage({ id: 'app.exception.back' })} );
/>
);
}
}
export default Exception404; export default Exception404;
import React, { Component } from 'react'; import React from 'react';
import { formatMessage } from 'umi/locale'; import { formatMessage } from 'umi/locale';
import Link from 'umi/link'; import Link from 'umi/link';
import Exception from '@/components/Exception'; import Exception from '@/components/Exception';
class Exception500 extends Component { const Exception500 = () => (
render() { <Exception
return ( type="500"
<Exception desc={formatMessage({ id: 'app.exception.description.500' }, {})}
type="500" style={{ minHeight: 500, height: '80%' }}
desc={formatMessage({ id: 'app.exception.description.500' }, {})} linkElement={Link}
style={{ minHeight: 500, height: '80%' }} backText={formatMessage({ id: 'app.exception.back' })}
linkElement={Link} />
backText={formatMessage({ id: 'app.exception.back' })} );
/>
);
}
}
export default Exception500; export default Exception500;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment