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

Update LPLs eslint config to 3.0.1 #26

Merged
merged 14 commits into from
Apr 11, 2023
Merged

Update LPLs eslint config to 3.0.1 #26

merged 14 commits into from
Apr 11, 2023

Conversation

oroth8
Copy link
Collaborator

@oroth8 oroth8 commented Apr 10, 2023

Changes

This PR updates our eslint config to uses LPL's latest eslint-config.

  • implements the updated dep above in fe
  • creates a separate eslintrc file in be for separate configuration
  • adds a be lint-staged script
  • prettier write and eslint fixs

Lots of changed files but most of them are due to the linting changes that are implemented.

Files to review in this PR are:

  • be/.eslintrc.cjs
  • fe/.eslintrc.js

@oroth8 oroth8 self-assigned this Apr 10, 2023
be/package.json Outdated
@@ -1,13 +1,13 @@
{
"name": "@veritext-replacement-template/be",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this being addressed in #21 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@vanderhoop correct, I implemented it here so I could continue working on a separate branch. Whatever branch gets merged first I will make sure it is updated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

merged #21 into main so this is no longer an issue. Updated PR body

@@ -5,9 +5,10 @@
{
"env": {
"useBuiltIns": "usage",
"corejs": "3.19"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is technically a downgrade. Any particular reason we'd downgrade?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@vanderhoop thanks, fixed this

@oroth8 oroth8 requested a review from vanderhoop April 10, 2023 18:07
be/.gitignore Outdated
Comment on lines 3 to 4
test.json
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we'll want to remove this from the diff.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done thx

be/.eslintrc.cjs Outdated
Comment on lines 1 to 10
module.exports = {
root: true,
env: {
node: true,
browser: true,
es6: true,
},
extends: [
"prettier",
"eslint:recommended",
Copy link
Collaborator

Choose a reason for hiding this comment

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

@oroth8 Small thing, but I think your editor's default settings might be setting you up with 4 spaces per tab. The source files are mostly 2-spaces, so we might want to that.

Normally, I wouldn't comment on lint stuff, but early in the project, it makes sense to get our editor configs' aligned so that future PR diffss don't end up with a bunch of whitespace noise.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@vanderhoop LPL uses a 2-tab width across all projects:

Screenshot 2023-04-10 at 1 41 20 PM

this is what the .prettierrc file at the root of our project uses

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think tabWidth: 2 means 2 spaces per tab? See the be/src/controllers/users.controller.js file and other source files below for cases where the indentation is 2 spaces.

I suspect the reason this particular file isn't taking on the prettier defaults is that the path pattern isn't included in launchpad's prettier config. (Will check)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I suspect the reason this particular file isn't taking on the prettier defaults is that the path pattern isn't included in launchpad's prettier config. (Will check)

I checked, and it's not the .prettierrc or .prettierignore file that's causing this file to go unformatted.

I think it's this line in the package.json, which doesn't include *.cjs files:

"be/**/*.{js,json}": [
      "prettier --write",
      "eslint --fix --max-warnings=0"
    ]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think my vscode plugin workspace settings were overriding the .prettierrc file at the root. Anyways I added cjs to the lint-staged script and also reran prettier using their --config flag so I knew for a fact it was using .prettierrc

@@ -10,7 +10,7 @@ notifications:
addons:
apt:
packages:
- libgconf-2-4
- libgconf-2-4
Copy link
Collaborator

Choose a reason for hiding this comment

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

Inner monologue: Any chance we want to add linting to travis CI? It could avoid the manual Nit: * comments in PRs, and let CI do the job for us. Just a thought

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@vanderhoop I was thinking of creating a github action and add linting there in a separate PR. Reason being, Im not sure if we will be able to use travisCI with veritext so it might be better to use github's

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, now that I'm thinking about it, we should hold off until fully in Veritext's GitHub and they've given us a Jenkins file we can add scripts to.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, now that I'm thinking about it, we should hold off until fully in Veritext's GitHub and they've given us a Jenkins file we can add scripts to.

Reason being the work would be redundant, and we're gonna have to switch to their repo relatively soon

@oroth8 oroth8 requested a review from vanderhoop April 10, 2023 19:18
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file is a woopsy in the diff, as nothing in node_modules either at the root or in lower directories should be in version control. I think deleting this file from version control and adding the following two lines to the .gitignore file would address this:

# (rest of .gitignore)
be/node_modules/
fe/node_modules/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

also ran git rm -r on:

node_modules
be/node_modules
fe/node_modules

package.json Outdated
@@ -44,7 +44,8 @@
],
"fe/src/**/*.{json,scss}": "prettier --write",
"be/**/*.{js,json}": [
Copy link
Collaborator

Choose a reason for hiding this comment

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

See comment above about adding cjs files

Suggested change
"be/**/*.{js,json}": [
"be/**/*.{js,json,cjs}": [

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added

@oroth8 oroth8 requested a review from vanderhoop April 10, 2023 20:53
@oroth8 oroth8 linked an issue Apr 10, 2023 that may be closed by this pull request
Copy link
Collaborator

@vanderhoop vanderhoop left a comment

Choose a reason for hiding this comment

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

🔥 🎸 🚀

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.

add eslint to 'be' and include prisma eslint plugin
2 participants