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

Repo: improved management of extension rules #6456

Open
bradzacher opened this issue Feb 12, 2023 · 0 comments
Open

Repo: improved management of extension rules #6456

bradzacher opened this issue Feb 12, 2023 · 0 comments
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request repo maintenance things to do with maintenance of the repo, and not with code/docs

Comments

@bradzacher
Copy link
Member

Suggestion

Forks

Cons:

  • They require us to manually watch the base rule implementation so that we can upstream the changes into our fork to maintain parity.

Pros:

  • The user gets a consistent experience with the rule regardless of the underlying ESLint version they use
  • They don't require us to maintain backwards-compatability hacks to ensure that we support older ESLint versions

Overrides

Cons:

  • Implementation can be somewhat convoluted as we hack around and abuse existing selectors in the base rule
  • We have to maintain support for older ESLint versions
  • We have to pay attention to the base rule implementation in case it changes substantially (eg different selectors, reworked internal logic).

Pros:

  • There's less code for us to maintain overall - which is pretty big for some of the formatting extension rules

Originally we tried to do an override wherever possible to save maintenance burden. However we've found over time that we're tightly relying on ESLint's implementations - which can be pretty brittle and can require some hacks to maintain. Some rules required forking because our changes needed access to internal rule logic.

This means that currently our extension rules are a mixed bag - some of them are complete forks, others are slightly hacky overrides. As shown above; neither option is fantastic, but having both also is an even worse state to be in I think.

I propose that we standardise our approach on full forks. Whilst there is more code in our repo - it does mean that we can better manage our code and do fewer hacks.

This ofc does bring in the problem of us needing to watch ESLint releases very closely - however I think we can probably automate this with an action that does the following:

  1. checkout the ESLint repo's latest release tag.
  2. get all the changed files since the previous release.
  3. if any of the changed files are files we are watching, then file an issue to alert us of the changes that we need to merge in.

There'd still be the manual effort of actioning this issue - but at least we won't miss anything like we have in the past (eg #4910)

@bradzacher bradzacher added triage Waiting for maintainers to take a look repo maintenance things to do with maintenance of the repo, and not with code/docs labels Feb 12, 2023
@bradzacher bradzacher added enhancement New feature or request accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look labels Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request repo maintenance things to do with maintenance of the repo, and not with code/docs
Projects
None yet
Development

No branches or pull requests

1 participant