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

FR: Feathers ESLINT or some other Feathers conventions #2603

Closed
DaddyWarbucks opened this issue Apr 20, 2022 · 3 comments
Closed

FR: Feathers ESLINT or some other Feathers conventions #2603

DaddyWarbucks opened this issue Apr 20, 2022 · 3 comments

Comments

@DaddyWarbucks
Copy link
Member

I have been working on some docs and also recently saw this issue: feathersjs/docs#1567. So my mind has been on "developer experience" the past few days. Thus the reason for this issue and feathersjs/docs#1570

Problem - As a Feathers contributor, I often have to meticulously format code differently depending on which repo I am working on. Some repos do have a similar ESLINT/semistandard setup, but not all. And those setups are not shared from a common place. And as a Feathers maintainer, I often have to make comments such as "Please replace all of the commas that your formatter removed", etc.

Solution - An ESLINT plugin that boxes up some common Node and prettier eslint plugins into one plugin, like eslint-plugin-feathers. This plugin could then be used throughout the Feathers codebase and any other feathers repos like those in feathers-ecosystem.

I am not sure how the community will feel about Prettier. When I first introduced it to a team, we went back and forth about whether it was a good idea because we would no longer be "stewards" of the code as much. But, after landing on using Prettier I wouldn't go back. It has become a crutch for me. It's definitely opinionated and I don't always agree with the opinions, but thats the beauty of it as well. I am also not sure how we would handle the prettier config. Prettier can be configured via package.json or .prettierrc on a per prject basis, but I don't want the developer to have control over that...So I am unsure how we could handle that if we wrapped it in our own plugin.

Note this ESLINT plugin is really meant for Feathers core and supporting Feathers libraries, not necessarily Feathers apps. It would likely be too opinionated for Feathers apps, but the developer could certainly use it if they would like. It should just include some basic Node stuff (v12+) and Prettier.

Furthermore, some other ways of enforcing Feathers conventions and code styles in supporting repos would be:

  • A Feathers library template. A template made to be forked for someone wanting to make their own feathers hooks, library, etc.
  • A Feathers .vscode ? Note sure how that would work, but I have a .vscode setup that I copy/paste into repos that enforces code formatting via the installed ESLINT config instead of any VScode or plugin formatters. Should there be other editor configs too? Not sure this is even a good idea.
  • Use husky or something similar for pre-commits linting? I don't love this idea because its another dependency that we don't control.

I am willing to put this together and open (merge where I can) PR's that include this new plugin and add a lint script. But, I wanted to get some feedback first.

@daffl
Copy link
Member

daffl commented Apr 20, 2022

I've started using StandardJS in newer projects (like Pinion) and would like to unify that for everything else as well.

@daffl
Copy link
Member

daffl commented Jun 5, 2022

Alright, in #2647 @marshallswain and I updated Linting to use @typescript/eslint-recommended and Prettier (no semicolons). That's what I'd recommend to use and will be setting up for all my other projects as well but every maintainer is of course still free to choose their formatting tools of choice.

@daffl
Copy link
Member

daffl commented Jul 19, 2022

I think we can close this with the implementation of Standard + Prettier in the main repo which can be adapted to any other project.

@daffl daffl closed this as completed Jul 19, 2022
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

No branches or pull requests

2 participants