Skip to content

Conversation

jhoover4
Copy link

@jhoover4 jhoover4 commented Jun 11, 2023

Adding prettier and eslint for repo linting.

Prettier

Prettier is a code formatter used by the javascript community to automatically enforce one code style so there is no arguing about "spaces/tabs" or single quotes or double quotes, etc. It leaves what we call "bike shedding" (arguing about dumb pointless things) at the door. See https://prettier.io/ for more details.

Eslint

Eslint is used to check code for common errors and automatically correct them. This keeps it easy for reviewers to focus on more complex issues and helps you quickly fix issues. See https://eslint.org/ for more details. We're using the React extension here, which is a common extension for react apps.

Usage

To use these tools run npm run lint for eslint or npm run format for prettier or their "check" versions which doesn't apply fixes, but only throws warnings or errors.

Copy link
Member

@ProsperousHeart ProsperousHeart left a comment

Choose a reason for hiding this comment

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

A couple changes & a few clarifications requested

.eslintrc.js Outdated
},
env: {
browser: true,
es2021: true,
Copy link
Member

Choose a reason for hiding this comment

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

If we are using latest ECMA in line 14, why are we not also including it here? Saw this. Do we need to constantly be updating this environment variable as ECMA progresses?

Copy link
Author

Choose a reason for hiding this comment

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

I don't believe so, but this was actually generated by eslint itself so I'm hesitant about changing it. I'm reading up on it in https://eslint.org/docs/latest/use/configure/language-options

Copy link
Member

Choose a reason for hiding this comment

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

For documentation purposes - this was addressed here

@ProsperousHeart
Copy link
Member

Issue #58 is the documentation outlining these changes for newbies. Taken care of under PR #60

@ProsperousHeart ProsperousHeart linked an issue Jun 12, 2023 that may be closed by this pull request
@ProsperousHeart ProsperousHeart added enhancement Not a requirement - enhances or improves project requirements labels Jun 12, 2023
@jhoover4
Copy link
Author

FYI any changes I made to /src came as a response to eslint error or prettier formatting. Looks like there a few rules we can disable, but just wanted to give you a heads up that that is where the changes came from.

@jhoover4
Copy link
Author

OK. So I realized I messed up the eslint config a bit cause I wasn't letting it play nice with create react app. I fixed that per the docs here: https://create-react-app.dev/docs/setting-up-your-editor/#extending-or-replacing-the-default-eslint-config. Might want to include that in your notes as it also has setups for IDE/code editors (mine is already working with WebStorm).

@ProsperousHeart
Copy link
Member

OK. So I realized I messed up the eslint config a bit cause I wasn't letting it play nice with create react app. I fixed that per the docs here: https://create-react-app.dev/docs/setting-up-your-editor/#extending-or-replacing-the-default-eslint-config. Might want to include that in your notes as it also has setups for IDE/code editors (mine is already working with WebStorm).

Added here

ProsperousHeart added a commit to ProsperousHeart/codefordallas.github.io that referenced this pull request Jun 12, 2023
Copy link
Member

@ProsperousHeart ProsperousHeart left a comment

Choose a reason for hiding this comment

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

Updated documentation with latest changes in #60 PR

A few inquiries and changes requested

module.exports = {
extends: ["react-app", "plugin:jsx-a11y/recommended", "prettier"],
plugins: ["jsx-a11y"],
};
Copy link
Member

Choose a reason for hiding this comment

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

I saw the env section was removed (from here) - were these no longer needed?

Copy link
Author

@jhoover4 jhoover4 Jul 8, 2023

Choose a reason for hiding this comment

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

No that would be defining it twice. If we want to define that now we could do it here.

Copy link
Member

Choose a reason for hiding this comment

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

if you think it's better to do it the other way (as is now in the code) then I'm good with keeping it like this

jhoover4 and others added 2 commits July 8, 2023 12:54
Co-authored-by: Kassandra Keeton <ProsperousHeart@users.noreply.github.com>
Spelling change.

Co-authored-by: Kassandra Keeton <ProsperousHeart@users.noreply.github.com>
Copy link
Member

@ProsperousHeart ProsperousHeart left a comment

Choose a reason for hiding this comment

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

All items have been addressed, code reviewed, and successfully run locally. Approved! Thank you for your time and patience. Documentation for this has been updated under #60 - to be reviewed and integrated into branch v1-mvp

module.exports = {
extends: ["react-app", "plugin:jsx-a11y/recommended", "prettier"],
plugins: ["jsx-a11y"],
};
Copy link
Member

Choose a reason for hiding this comment

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

if you think it's better to do it the other way (as is now in the code) then I'm good with keeping it like this

.eslintrc.js Outdated
},
env: {
browser: true,
es2021: true,
Copy link
Member

Choose a reason for hiding this comment

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

For documentation purposes - this was addressed here

@ProsperousHeart ProsperousHeart merged commit 3d332e5 into codefordallas:v1-mvp Jul 21, 2023
@ProsperousHeart ProsperousHeart mentioned this pull request Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Not a requirement - enhances or improves project requirements
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

add automated linting & prettier formatting
2 participants