Skip to content

Commit

Permalink
chore(style): modify eslint rules (casdoor#1011)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
qianxi0410 and hsluoyz authored Aug 12, 2022
1 parent 6676cc8 commit a741c51
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
14 changes: 7 additions & 7 deletions web/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
}
}
1 change: 0 additions & 1 deletion web/src/CropperDiv.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export const CropperDiv = (props) => {
};

const handleCancel = () => {
console.log("Clicked cancel button");
setVisible(false);
};

Expand Down
1 change: 1 addition & 0 deletions web/src/auth/ForgetPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion web/src/basic/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: "",
});
Expand Down
6 changes: 6 additions & 0 deletions web/src/serviceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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."
Expand All @@ -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
Expand All @@ -108,6 +111,7 @@ function registerValidSW(swUrl, config) {
};
})
.catch(error => {
// eslint-disable-next-line no-console
console.error("Error during service worker registration:", error);
});
}
Expand Down Expand Up @@ -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."
);
Expand All @@ -149,6 +154,7 @@ export function unregister() {
registration.unregister();
})
.catch(error => {
// eslint-disable-next-line no-console
console.error(error.message);
});
}
Expand Down

0 comments on commit a741c51

Please sign in to comment.