chore(style): modify eslint rules (#1011)

* chore(style): use strict rules

* chore: modify position

* chore(style): warn about `console.log` and `==`

* fix: fix `console.log` error

* Update CropperDiv.js

* Update HomePage.js

Co-authored-by: Yang Luo <hsluoyz@qq.com>
This commit is contained in:
q1anx1 2022-08-13 00:04:18 +08:00 committed by GitHub
parent 6676cc8ff3
commit a741c5179a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 9 deletions

View File

@ -20,7 +20,6 @@
"plugins": ["unused-imports"],
"extends": ["eslint:recommended", "plugin:react/recommended"],
"rules": {
// "eqeqeq": "error",
"semi": ["error", "always"],
"indent": ["error", 2],
// follow antd's style guide
@ -87,15 +86,16 @@
"argsIgnorePattern": "^_"
}
],
"no-unused-vars": "off",
"react/no-deprecated": "error",
"react/jsx-key": "error",
// TODO(qianxi): should be error
"no-console": "error",
"eqeqeq": "warn",
"react/prop-types": "off",
"react/display-name": "off",
"react/react-in-jsx-scope": "off",
// don't use strict mod now, otherwise there are a lot of errors in the codebase
"no-unused-vars": "off",
"react/no-deprecated": "warn",
"no-case-declarations": "off",
"react/jsx-key": "warn"
"no-case-declarations": "off"
}
}

View File

@ -81,7 +81,6 @@ export const CropperDiv = (props) => {
};
const handleCancel = () => {
console.log("Clicked cancel button");
setVisible(false);
};

View File

@ -207,6 +207,7 @@ class ForgetPage extends React.Component {
hidden={this.state.current !== 0}
ref={this.form}
name="step1"
// eslint-disable-next-line no-console
onFinishFailed={(errorInfo) => console.log(errorInfo)}
initialValues={{
application: application.name,

View File

@ -61,7 +61,6 @@ class HomePage extends React.Component {
}
} else {
this.state.applications.forEach(application => {
console.log(application);
items.push({
link: application.homepageUrl, name: application.displayName, organizer: application.description, logo: application.logo, createdTime: "",
});

View File

@ -55,6 +55,7 @@ export function register(config) {
// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
// eslint-disable-next-line no-console
console.log(
"This web app is being served cache-first by a service " +
"worker. To learn more, visit https://bit.ly/CRA-PWA"
@ -83,6 +84,7 @@ function registerValidSW(swUrl, config) {
// At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older
// content until all client tabs are closed.
// eslint-disable-next-line no-console
console.log(
"New content is available and will be used when all " +
"tabs for this page are closed. See https://bit.ly/CRA-PWA."
@ -96,6 +98,7 @@ function registerValidSW(swUrl, config) {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
// eslint-disable-next-line no-console
console.log("Content is cached for offline use.");
// Execute callback
@ -108,6 +111,7 @@ function registerValidSW(swUrl, config) {
};
})
.catch(error => {
// eslint-disable-next-line no-console
console.error("Error during service worker registration:", error);
});
}
@ -136,6 +140,7 @@ function checkValidServiceWorker(swUrl, config) {
}
})
.catch(() => {
// eslint-disable-next-line no-console
console.log(
"No internet connection found. App is running in offline mode."
);
@ -149,6 +154,7 @@ export function unregister() {
registration.unregister();
})
.catch(error => {
// eslint-disable-next-line no-console
console.error(error.message);
});
}