cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.84k stars 3.17k forks source link

Eliminate the need for an internal & public ESLint package #24251

Open jaffrepaul opened 2 years ago

jaffrepaul commented 2 years ago

What would you like?

  1. Move Cypess ESLint Dev rules into the Cypress root and eliminate the need to maintain an internal & public package.
  2. Add scripts to repo root and lint rules to individual packages
  3. Update dependencies and stale issues

Why is this needed?

There are a few things that can be addressed:

  1. There is an internal ESLint plugin with rules shared across different entities. However it's published on npm (3,783 weekly DLs 🤔) in addition to the public version (2,378,591 weekly DLs).
  2. The internal version is a dependency and its rules are extended in the public version with additional custom rules.
  3. Some lint rules seem to be run at the root level across the Cypress repo, where adding scripts at the root to run lint rules in each lib could be more optimal.
  4. We could move the rules from the internal dev plugin into the rules at the repo root, remove the dev package and move the public version into the monorepo's npm packages to not be maintaining two and minimize confusion about which to use.

Also...

  1. Users have begun forking the public version to update & make improvements because the current package has gone stale.
  2. ESLint and supporting tooling is very outdated in the dev version, making authoring new rules with modern .js incompatible in the public version.
  3. There are dependencies in the public version that aren't being used and could use general cleanup and maintenance by way of Dependebot or Renovate so the outdated dependency issue is automated away.

Other

No response

flotwig commented 1 year ago

@jordanpowell88 @jaffrepaul Can this also entail removing lib/scripts from eslint-plugin-dev entirely? As of #25308, I don't see where any of these scripts are used in any repo in the cypress-io org. Also, they appear to be broken, I cannot get them to run, even though the tests are passing.

jaffrepaul commented 1 year ago

Makes sense to me!

MikeMcC399 commented 6 months ago

@jennifer-shehane

Regarding your comment in https://github.com/cypress-io/eslint-plugin-cypress/issues/114#issuecomment-2051912881

Yes, we don't intend to move this repo to the cypress repo. We'd prefer to keep it here.

npm/eslint-plugin-dev is not compatible with ESLint 8 due to a deprecation in this version (see The /lib entrypoint has been removed).

Beginning in v8.0.0, ESLint is strictly defining its public API. Previously, you could reach into individual files such as require("eslint/lib/rules/semi") and this is no longer allowed. There are a limited number of existing APIs that are now available through the /use-at-your-own-risk entrypoint for backwards compatibility, but these APIs are not formally supported and may break or disappear at any point in time.

So it's questionable whether this architecture should be carried forward or whether the eslint-plugin-dev should be withdrawn from use. The ESLint 8 release was announced in Oct 2021 and the latest announcement was for the ESLint 9 release on Apr 5, 2024.