diff --git a/frontend/.eslintrc.json b/frontend/.eslintrc.json
index fc5072ef7c..31e4a1db66 100644
--- a/frontend/.eslintrc.json
+++ b/frontend/.eslintrc.json
@@ -6,59 +6,52 @@
"eslint:recommended"
],
"rules": {
- "indent": [
- "warn",
- 2,
- { "SwitchCase": 1 }
- ],
- "default-case": "off",
- "linebreak-style": [
- "warn",
- "unix"
- ],
- "quotes": [
- "warn",
- "single"
- ],
- "semi": [
- "warn",
- "always"
- ],
-
+ "jsx-a11y/anchor-is-valid": "off",
+ "react-hooks/exhaustive-deps": "off",
+ "no-loop-func": "off",
"eqeqeq": "off",
+ "default-case": "off",
+ "jsx-a11y/anchor-has-content": "off",
+ "no-mixed-operators": "off",
+ "no-useless-concat": "off",
"no-useless-constructor": "off",
- "no-restricted-globals": "off",
"no-unused-expressions": "off",
- "no-case-declarations": "warn",
- "no-cond-assign": "warn",
- "no-redeclare": "warn",
+ "no-prototype-builtins": "off",
+ "no-restricted-globals": "off",
+ "brace-style": "off",
+ "no-console": "off",
+ "no-cond-assign": "off",
+ "no-var": "off",
+ "no-case-declarations": "off",
+ "no-redeclare": "off",
+ "indent": ["warn", 2, {
+ "SwitchCase": 1,
+ "ignoreComments": false
+ }],
+ "linebreak-style": ["warn", "unix"],
+ "quotes": ["warn", "single"],
+ "semi": ["warn", "always"],
"no-unreachable": "warn",
"no-class-assign": "warn",
"no-unused-vars": "warn",
+ "no-useless-escape": "off",
"no-irregular-whitespace": "warn",
- "no-console": "warn",
- "no-self-assign": ["error", {"props": false}],
- "no-useless-escape": "warn",
"no-trailing-spaces": "warn",
-
"react/jsx-indent": ["warn", 2],
- "react/prop-types": "warn",
- "react/display-name": "warn",
- "no-mixed-operators": "off",
- "no-useless-concat": "off",
- "jsx-a11y/anchor-has-content": "off",
- "jsx-a11y/href-no-hash": "off",
- "jsx-a11y/anchor-is-valid": "off",
- "space-before-blocks": ["warn", "always"],
- "space-in-parens": ["warn", "never"],
- "keyword-spacing": ["warn", {
- "before": true,
- "after": true,
- "overrides": {
- "if" : {
- "after": true
- }
- }
- }]
+ "eol-last": "error",
+ "space-before-function-paren": ["warn", {"named": "never"}],
+ "array-bracket-spacing": ["warn", "never"],
+ "object-curly-spacing": ["warn", "always"],
+ "spaced-comment": "warn",
+ "keyword-spacing": ["warn", {"before": true}],
+ "space-infix-ops": "error",
+ "key-spacing": ["error", { "beforeColon": false }],
+ "arrow-spacing": ["error", { "before": true, "after": true }],
+ "comma-spacing": ["error", { "before": false, "after": true }],
+ "no-duplicate-imports": "error",
+ "one-var": ["error", "never"],
+ "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1 }],
+ "no-multi-spaces": "error",
+ "react/jsx-closing-tag-location": "error"
}
}
diff --git a/frontend/src/app.js b/frontend/src/app.js
index 33cf841504..afad459feb 100644
--- a/frontend/src/app.js
+++ b/frontend/src/app.js
@@ -68,7 +68,7 @@ class App extends Component {
onpopstate = (event) => {
if (event.state && event.state.currentTab && event.state.pathPrefix) {
let { currentTab, pathPrefix } = event.state;
- this.setState({currentTab, pathPrefix});
+ this.setState({ currentTab, pathPrefix });
}
};
@@ -80,12 +80,12 @@ class App extends Component {
}
}
- navigateClientUrlToLib = () =>{
+ navigateClientUrlToLib = () => {
if (window.location.hash && window.location.hash.indexOf('common/lib') != -1) {
let splitUrlArray = window.location.hash.split('/');
let repoID = splitUrlArray[splitUrlArray.length - 2];
let url = siteRoot + 'library/' + repoID + '/';
- navigate(url, {repalce: true});
+ navigate(url, { repalce: true });
}
};
@@ -102,7 +102,7 @@ class App extends Component {
let href = window.location.href.split('/');
currentTab = href[href.length - 2];
}
- this.setState({currentTab: currentTab});
+ this.setState({ currentTab: currentTab });
}
onCloseSidePanel = () => {
@@ -119,9 +119,9 @@ class App extends Component {
onSearchedClick = (selectedItem) => {
if (selectedItem.is_dir === true) {
- this.setState({currentTab: '', pathPrefix: []});
+ this.setState({ currentTab: '', pathPrefix: [] });
let url = siteRoot + 'library/' + selectedItem.repo_id + '/' + selectedItem.repo_name + selectedItem.path;
- navigate(url, {repalce: true});
+ navigate(url, { repalce: true });
} else {
let url = siteRoot + 'lib/' + selectedItem.repo_id + '/file' + Utils.encodePath(selectedItem.path);
let isWeChat = Utils.isWeChat();
@@ -135,7 +135,7 @@ class App extends Component {
};
onGroupChanged = (groupID) => {
- setTimeout(function() {
+ setTimeout(function () {
let url;
if (groupID) {
url = siteRoot + 'group/' + groupID + '/';
@@ -157,7 +157,7 @@ class App extends Component {
pathPrefix: pathPrefix
}, () => {
let { currentTab, pathPrefix } = this.state;
- window.history.replaceState({currentTab: currentTab, pathPrefix: pathPrefix}, null);
+ window.history.replaceState({ currentTab: currentTab, pathPrefix: pathPrefix }, null);
});
if (!Utils.isDesktop() && !this.state.isSidePanelClosed) {
this.setState({ isSidePanelClosed: true });
diff --git a/frontend/src/components/btn-qr-code.js b/frontend/src/components/btn-qr-code.js
index 9ea10ee93e..1c0c4d402e 100644
--- a/frontend/src/components/btn-qr-code.js
+++ b/frontend/src/components/btn-qr-code.js
@@ -17,7 +17,7 @@ class ButtonQR extends React.Component {
isPopoverOpen: false
};
- this.btnID = 'btn-' + Math.random().toString().substr(2,5);
+ this.btnID = 'btn-' + Math.random().toString().substr(2, 5);
}
togglePopover = () => {
@@ -35,7 +35,7 @@ class ButtonQR extends React.Component {
{gettext('Scan the QR code to view the shared content directly')} {gettext('Scan the QR code to view the shared content directly')}
{gettext('Used:')}{' '}{this.state.quotaUsage} / {this.state.quotaTotal}
-{moment(noticeItem.time).fromNow()}