diff --git a/.eslintignore b/.eslintignore index 69f9854d..87467c1f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1 @@ -/functions/mock \ No newline at end of file +/functions/mock diff --git a/.eslintrc.js b/.eslintrc.js index 9c1cf5f7..1a1c24b6 100755 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,6 @@ module.exports = { - extends: ['eslint-config-umi', 'prettier'], + parser: 'babel-eslint', + extends: ['airbnb', 'prettier'], env: { browser: true, node: true, @@ -9,8 +10,20 @@ module.exports = { jasmine: true, }, rules: { - 'jsx-a11y/href-no-hash': [0], - 'react/sort-comp': 1, + 'react/jsx-filename-extension': [1, { extensions: ['.js'] }], + 'import/no-unresolved': 0, + 'jsx-a11y/anchor-is-valid': 0, + 'react/jsx-wrap-multilines': 0, + 'import/no-extraneous-dependencies': 0, + 'consistent-return': 0, + 'import/no-extraneous-dependencies': 0, + 'react/prop-types': 0, + 'jsx-a11y/click-events-have-key-events': 0, + 'jsx-a11y/no-static-element-interactions': 0, + 'react/prefer-stateless-function': 0, + 'jsx-a11y/no-noninteractive-element-interactions': 0, + 'react/forbid-prop-types': 0, + 'react/jsx-one-expression-per-line': 0, }, settings: { polyfills: ['fetch', 'promises'], diff --git a/package.json b/package.json index c4a07b73..9aee5e4d 100755 --- a/package.json +++ b/package.json @@ -60,7 +60,6 @@ "eslint": "^5.4.0", "eslint-config-airbnb": "^17.0.0", "eslint-config-prettier": "^3.0.1", - "eslint-config-umi": "^0.1.4", "eslint-plugin-babel": "^5.1.0", "eslint-plugin-compat": "^2.5.1", "eslint-plugin-flowtype": "2.50.0", diff --git a/src/components/Authorized/CheckPermissions.js b/src/components/Authorized/CheckPermissions.js index 8aaad1ce..5bc225e3 100644 --- a/src/components/Authorized/CheckPermissions.js +++ b/src/components/Authorized/CheckPermissions.js @@ -82,8 +82,7 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => { export { checkPermissions }; -const check = (authority, target, Exception) => { - return checkPermissions(authority, CURRENT, target, Exception); -}; +const check = (authority, target, Exception) => + checkPermissions(authority, CURRENT, target, Exception); export default check; diff --git a/src/components/Authorized/CheckPermissions.test.js b/src/components/Authorized/CheckPermissions.test.js index 1e66cb9e..3988d85a 100644 --- a/src/components/Authorized/CheckPermissions.test.js +++ b/src/components/Authorized/CheckPermissions.test.js @@ -1,4 +1,4 @@ -import { checkPermissions } from './CheckPermissions.js'; +import { checkPermissions } from './CheckPermissions'; const target = 'ok'; const error = 'error'; diff --git a/src/components/Authorized/index.js b/src/components/Authorized/index.js index 91eabf87..22ac664d 100644 --- a/src/components/Authorized/index.js +++ b/src/components/Authorized/index.js @@ -1,7 +1,7 @@ import Authorized from './Authorized'; import AuthorizedRoute from './AuthorizedRoute'; import Secured from './Secured'; -import check from './CheckPermissions.js'; +import check from './CheckPermissions'; import renderAuthorize from './renderAuthorize'; Authorized.Secured = Secured; diff --git a/src/components/Authorized/renderAuthorize.js b/src/components/Authorized/renderAuthorize.js index 16177ede..5c5daa68 100644 --- a/src/components/Authorized/renderAuthorize.js +++ b/src/components/Authorized/renderAuthorize.js @@ -4,23 +4,21 @@ let CURRENT = 'NULL'; * use authority or getAuthority * @param {string|()=>String} currentAuthority */ -const renderAuthorize = Authorized => { - return currentAuthority => { - if (currentAuthority) { - if (currentAuthority.constructor.name === 'Function') { - CURRENT = currentAuthority(); - } - if ( - currentAuthority.constructor.name === 'String' || - currentAuthority.constructor.name === 'Array' - ) { - CURRENT = currentAuthority; - } - } else { - CURRENT = 'NULL'; +const renderAuthorize = Authorized => currentAuthority => { + if (currentAuthority) { + if (currentAuthority.constructor.name === 'Function') { + CURRENT = currentAuthority(); } - return Authorized; - }; + if ( + currentAuthority.constructor.name === 'String' || + currentAuthority.constructor.name === 'Array' + ) { + CURRENT = currentAuthority; + } + } else { + CURRENT = 'NULL'; + } + return Authorized; }; export { CURRENT }; diff --git a/src/components/Charts/Gauge/index.js b/src/components/Charts/Gauge/index.js index d9289eaa..093587d4 100644 --- a/src/components/Charts/Gauge/index.js +++ b/src/components/Charts/Gauge/index.js @@ -142,15 +142,13 @@ export default class Gauge extends React.Component { /> { - return ` + html={() => `
${title}
${data[0].value * 10}%
-团队内排名
- 8 - / 24 + 8 / 24