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

Add eslint and code format configuration #277

Merged
merged 6 commits into from
Dec 5, 2021

Conversation

danielkhan
Copy link
Contributor

Added eslint and copied all config files for code style over from fastify to make contributing easier.

Checklist

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@danielkhan danielkhan mentioned this pull request Nov 28, 2021
4 tasks
Copy link
Member

@climba03003 climba03003 left a comment

Choose a reason for hiding this comment

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

If we install this packages, I think we should at least use it in command instead of IDE only.

The command for linting.
https://github.com/fastify/fastify/blob/main/package.json#L13-L16

@danielkhan
Copy link
Contributor Author

If we install this packages, I think we should at least use it in command instead of IDE only.

I tried but looking closer, it seems as if the eslint command is only used to validate typescript while eslint by configuration extends standard. By running standard on npm test the same rules the IDE uses through eslint are applied.

package.json Outdated Show resolved Hide resolved
@danielkhan
Copy link
Contributor Author

@climba03003 are we good to go? Don't want to gloss over your objection.

Copy link
Member

@climba03003 climba03003 left a comment

Choose a reason for hiding this comment

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

My stand is the same as before, but I am not blocking it to be merged.

From my experience, the first thing after cloning the project always be disable IDE auto linting. Because I can't get it works even once, fastify is the same in my environment.

So, I only use the command before merging but not rely on the auto linting feature of IDE. And that is the reason why I think if you add it, you need to use it. As it do nothing in my environment, just increase the installation time.

@danielkhan
Copy link
Contributor Author

So, I only use the command before merging but not rely on the auto linting feature of IDE. And that is the reason why I think if you add it, you need to use it. As it do nothing in my environment, just increase the installation time.

Understood.
Technically it is used as most IDEs will look inside the current workspace when trying to find eslint.
But the fact that it does now work on my machine, is of course not too meaningful. Yet sticking to the same ruleset as fastify makes sense in my opinion.

Copy link
Member

@Eomm Eomm left a comment

Choose a reason for hiding this comment

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

I would like to ask you for one more test on your PC:
starting from master, could you add a simple .eslintrc like this: standard/vscode-standard#295 (comment)

cleaning your node_modules and without the additions?

I think you hit the same issue I'm having and the .eslintrc should be enough

For example, using this PR:

$ npm ls eslint-config-standard
point-of-view@4.15.3 /Users/mspigolon/workspace/point-of-view
├── eslint-config-standard@16.0.3
└─┬ standard@16.0.4
  └── eslint-config-standard@16.0.3 deduped

@danielkhan
Copy link
Contributor Author

danielkhan commented Dec 3, 2021

I would like to ask you for one more test on your PC: starting from master, could you add a simple .eslintrc like this:

I've done that, cleaned node_modules, reinstalled without these deps.
Turns out that Standard itself has the dependencies already, so I omitted them in my package.json now.

$ npm ls eslint
point-of-view@4.15.3 /Users/dkhan/CodeKitchen/point-of-view
└─┬ standard@16.0.4
  ├─┬ eslint-config-standard-jsx@10.0.0
  │ └── eslint@7.18.0 deduped
  ├─┬ eslint-config-standard@16.0.3
  │ └── eslint@7.18.0 deduped
  ├─┬ eslint-plugin-import@2.24.2
  │ └── eslint@7.18.0 deduped
  ├─┬ eslint-plugin-node@11.1.0
  │ ├─┬ eslint-plugin-es@3.0.1
  │ │ └── eslint@7.18.0 deduped
  │ └── eslint@7.18.0 deduped
  ├─┬ eslint-plugin-promise@5.1.1
  │ └── eslint@7.18.0 deduped
  ├─┬ eslint-plugin-react@7.25.3
  │ └── eslint@7.18.0 deduped
  └── eslint@7.18.0

Copy link
Member

@climba03003 climba03003 left a comment

Choose a reason for hiding this comment

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

LGTM.

.gitattributes Outdated Show resolved Hide resolved
@mcollina
Copy link
Member

mcollina commented Dec 4, 2021

I think I landed the other PR first :( Can you rebase this?

@danielkhan
Copy link
Contributor Author

I think I landed the other PR first :( Can you rebase this?

I was able to merge this.

@climba03003
Copy link
Member

I think I landed the other PR first :( Can you rebase this?

I was able to merge this.

Can you remove the eslint related plugin inside this PR. As they are added in another PR.

@danielkhan
Copy link
Contributor Author

Can you remove the eslint related plugin inside this PR. As they are added in another PR.

Correct. Done.

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.

5 participants