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 { children, authority, noMatch = null } = this.props;
const childrenRender = typeof children === 'undefined' ? null : children; const childrenRender = typeof children === 'undefined' ? null : children;
return CheckPermissions(authority, childrenRender, noMatch); 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() {
return (
<Exception <Exception
type="403" type="403"
desc={formatMessage({ id: 'app.exception.description.403' }, {})} desc={formatMessage({ id: 'app.exception.description.403' }, {})}
...@@ -13,7 +11,6 @@ class Exception403 extends Component { ...@@ -13,7 +11,6 @@ class Exception403 extends Component {
linkElement={Link} linkElement={Link}
backText={formatMessage({ id: 'app.exception.back' })} 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() {
return (
<Exception <Exception
type="404" type="404"
desc={formatMessage({ id: 'app.exception.description.404' }, {})} desc={formatMessage({ id: 'app.exception.description.404' }, {})}
...@@ -13,7 +11,6 @@ class Exception404 extends Component { ...@@ -13,7 +11,6 @@ class Exception404 extends Component {
linkElement={Link} linkElement={Link}
backText={formatMessage({ id: 'app.exception.back' })} 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() {
return (
<Exception <Exception
type="500" type="500"
desc={formatMessage({ id: 'app.exception.description.500' }, {})} desc={formatMessage({ id: 'app.exception.description.500' }, {})}
...@@ -13,7 +11,6 @@ class Exception500 extends Component { ...@@ -13,7 +11,6 @@ class Exception500 extends Component {
linkElement={Link} linkElement={Link}
backText={formatMessage({ id: 'app.exception.back' })} 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