Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 2525: Fix lint errors #2532

Merged
merged 7 commits into from
Nov 28, 2021
Merged

Conversation

DukeManh
Copy link
Contributor

Issue This PR Addresses

Fixes #2525

This fixes some linting errors that were left out due to Eslint not being provided with a target files pattern.

These are some common errors in the code.

  1. Using <a target=“_blank”> without rel=“referrer” is a security risk
  2. Empty components are self-closing
  3. Prevent invalid characters from appearing in markup
  4. No useless escape
  5. Disallow continue statements
  6. Avoid for..of loop in favor of array iterator
  7. Consistent return, either always or never
  8. No restricted globals
  9. No use before define
  10. No multiple chained assignment
  11. No unused variables
  12. React Hooks must not be called conditionally

Type of Change

  • Bugfix: Change which fixes an issue
  • New Feature: Change which adds functionality
  • Documentation Update: Change which improves documentation
  • UI: Change which improves UI

Description

Checklist

  • Quality: This PR builds and passes our npm test and works locally
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not (if applicable)
  • Documentation: This PR includes updated/added documentation to user exposed functionality or configuration variables are added/changed or an explanation of why it does not(if applicable)

@gitpod-io
Copy link

gitpod-io bot commented Nov 28, 2021

Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, a couple things.

.eslintrc.js Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
package.json Show resolved Hide resolved
src/api/users/test/e2e/users.test.js Show resolved Hide resolved
Copy link
Contributor

@Andrewnt219 Andrewnt219 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, that's a lot of work done, One question: is it an eslint rule to have a return In all functions?

src/api/status/public/js/build-log/check-for-build.js Outdated Show resolved Hide resolved
src/api/status/public/js/github-stats.js Show resolved Hide resolved
src/api/status/public/js/pages/build.js Outdated Show resolved Hide resolved
src/web/src/components/NavBar/index.tsx Show resolved Hide resolved
tools/autodeployment/builds.js Show resolved Hide resolved
@DukeManh
Copy link
Contributor Author

@Andrewnt219

One question: is it an eslint rule to have a return In all functions?

It's this rule: https://eslint.org/docs/rules/consistent-return#require-return-statements-to-either-always-or-never-specify-values-consistent-return

So basically, we're required to either have no return or return something in every branch of the function.

@Andrewnt219
Copy link
Contributor

So basically, we're required to either have no return or return something in every branch of the function.

I see. Because the PR changes functions that return void to return a value anyway. It isn't a problem though, maybe it's better to be explicit like this.

Copy link
Contributor

@Andrewnt219 Andrewnt219 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Epic. Thank you for a) noticing this; b) fixing it.

@DukeManh DukeManh merged commit d8a7f33 into Seneca-CDOT:master Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linter was not running the whole time
3 participants