Skip to content

Commit

Permalink
chore(style): use eqeqeq (casdoor#1013)
Browse files Browse the repository at this point in the history
  • Loading branch information
qianxi0410 authored Aug 13, 2022
1 parent 108fdc1 commit ca13247
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions web/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@
"no-unused-vars": "off",
"react/no-deprecated": "error",
"react/jsx-key": "error",
// TODO(qianxi): should be error
"no-console": "error",
"eqeqeq": "warn",
"eqeqeq": "error",

"react/prop-types": "off",
"react/display-name": "off",
Expand Down
6 changes: 3 additions & 3 deletions web/src/auth/LoginPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class LoginPage extends React.Component {
} else {
// OAuth
const oAuthParams = Util.getOAuthGetParameters();
if (oAuthParams !== null && oAuthParams.responseType != null && oAuthParams.responseType !== "") {
if (oAuthParams !== null && oAuthParams.responseType !== null && oAuthParams.responseType !== "") {
values["type"] = oAuthParams.responseType;
} else {
values["type"] = this.state.type;
Expand All @@ -175,11 +175,11 @@ class LoginPage extends React.Component {
values["samlRequest"] = oAuthParams.samlRequest;
}

if (values["samlRequest"] != null && values["samlRequest"] !== "") {
if (values["samlRequest"] !== null && values["samlRequest"] !== "" && values["samlRequest"] !== undefined) {
values["type"] = "saml";
}

if (this.state.owner != null) {
if (this.state.owner !== null) {
values["organization"] = this.state.owner;
}

Expand Down
2 changes: 1 addition & 1 deletion web/src/auth/SignupPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ class SignupPage extends React.Component {
  {i18next.t("signup:Have account?")} 
<a onClick={() => {
const linkInStorage = sessionStorage.getItem("signinUrl");
if(linkInStorage != null) {
if(linkInStorage !== null && linkInStorage !== "") {
Setting.goToLink(linkInStorage);
}else{
Setting.goToLogin(this, application);
Expand Down
2 changes: 1 addition & 1 deletion web/src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const resources = {

function initLanguage() {
let language = localStorage.getItem("language");
if (language === undefined || language == null) {
if (language === undefined || language === null || language === "") {
if (Conf.ForceLanguage !== "") {
language = Conf.ForceLanguage;
} else {
Expand Down
4 changes: 2 additions & 2 deletions web/src/serviceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function registerValidSW(swUrl, config) {
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker == null) {
if (installingWorker === null) {
return;
}
installingWorker.onstatechange = () => {
Expand Down Expand Up @@ -126,7 +126,7 @@ function checkValidServiceWorker(swUrl, config) {
const contentType = response.headers.get("content-type");
if (
response.status === 404 ||
(contentType != null && contentType.indexOf("javascript") === -1)
(contentType !== null && contentType.indexOf("javascript") === -1)
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
Expand Down

0 comments on commit ca13247

Please sign in to comment.