diff --git a/.eslintignore b/.eslintignore index 69f9854da0954e4141af919207e78abe3e3d00b7..87467c1fdf12a0ebeb9b731996a8de7718167831 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 9c1cf5f7fba297725d766633790417f120a9280d..1a1c24b6db3593abde172f1ebd009d9d086bd827 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 c4a07b73d41ed2d4cdf17be83bcfa53f0ff0146a..9aee5e4dccb0b5ac0fbdbf153e0c5020157a9aac 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 8aaad1ce5b01a913aa38e1954d8fd149c23bd406..5bc225e345119e75cb299b04ea888202e2c70131 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 1e66cb9edac708ba803cf3a916e54ca36e54b329..3988d85a18fcfe7412bb72f672ffdf7c2501d8c2 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 91eabf87f8debff26808ad2bb07588356dea03a1..22ac664d002844304b316e8c4f1acc79ede572d8 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 16177edece45ef253789db30d32895344857d5de..5c5daa68cce8605d356a77b1d9c2f5449e7631f6 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 d9289eaa24bc9ae6b3f78c8a3cec438ec42cf6e2..093587d43c30233b8d8c5e63d8ff1c452124eb78 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