Repository: freeCodeCamp/freeCodeCamp
File: client/src/templates/Challenges/classic/editor.tsx (TypeScript)

Code before:

  const { theme } = props;

  const preferDarkScheme = window.matchMedia(
    '(prefers-color-scheme: dark)'
  ).matches;
  const editorSystemTheme = preferDarkScheme ? 'vs-dark-custom' : 'vs-custom';
  const editorTheme =
    theme === Themes.Night
      ? 'vs-dark-custom'
      : theme === Themes.Default
        ? 'vs-custom'
        : editorSystemTheme;

  const firstFailedTest = props.tests.find(test => !!test.err);

  const handleSubmitAndGoButtonBoolean = () => {
    const canShowModal = sessionStorage.getItem('canOpenModal');

    if (canShowModal === 'false' && process.env.NODE_ENV === 'development') {
      return false;
    } else {
      challengeIsComplete();
    }

    return challengeIsComplete();
  };

  return (
    <Suspense fallback={<Loader loaderDelay={600} />}>
      <span className='notranslate'>
        <MonacoEditor
          editorDidMount={editorDidMount}
          editorWillMount={editorWillMount}
          onChange={onChange}
          options={{ ...options, folding: !hasEditableRegion() }}
          theme={editorTheme}
        />
      </span>
      {lowerJawContainer !== null &&
        createPortal(
          <LowerJaw
            openHelpModal={props.openHelpModal}
            openResetModal={props.openResetModal}
            tryToExecuteChallenge={tryToExecuteChallenge}
            hint={firstFailedTest?.message}
            testsLength={props.tests.length}
            attempts={attemptsRef.current}
            challengeIsCompleted={handleSubmitAndGoButtonBoolean()}
            tryToSubmitChallenge={tryToSubmitChallenge}
            isSignedIn={props.isSignedIn}

Review comment (suggestion):
```suggestion
    if (canShowModal === 'false' && process.env.NODE_ENV === 'development') {
      return false;
    }
    return challengeIsComplete();
```

We don't need an else statement when we're using an early return.

Code after:
    });
  }

  const { theme } = props;

  const preferDarkScheme = window.matchMedia(
    '(prefers-color-scheme: dark)'
  ).matches;
  const editorSystemTheme = preferDarkScheme ? 'vs-dark-custom' : 'vs-custom';
  const editorTheme =
    theme === LocalStorageThemes.Dark
      ? 'vs-dark-custom'
      : theme === LocalStorageThemes.Light
        ? 'vs-custom'
        : editorSystemTheme;

  const firstFailedTest = props.tests.find(test => !!test.err);

  const handleSubmitAndGoButtonBoolean = () => {
    const canShowModal = sessionStorage.getItem('canOpenModal');

    if (canShowModal === 'false' && envConfig.environment === 'development') {
      return false;
    }
    return challengeIsComplete();
  };

  return (
    <Suspense fallback={<Loader loaderDelay={600} />}>
      <span className='notranslate'>
        <MonacoEditor
          editorDidMount={editorDidMount}
          editorWillMount={editorWillMount}
          onChange={onChange}
          options={{ ...options, folding: !hasEditableRegion() }}
          theme={editorTheme}
        />
      </span>
      {lowerJawContainer !== null &&
        createPortal(
          <LowerJaw
            openHelpModal={props.openHelpModal}
            openResetModal={props.openResetModal}
            tryToExecuteChallenge={tryToExecuteChallenge}
            hint={firstFailedTest?.message}
            testsLength={props.tests.length}
            attempts={attemptsRef.current}
            challengeIsCompleted={handleSubmitAndGoButtonBoolean()}
            tryToSubmitChallenge={tryToSubmitChallenge}
            isSignedIn={props.isSignedIn}
            updateContainer={() =>