sarbbottam / eslint-find-rules

Find built-in ESLint rules you don't have in your custom config
http://npm.im/eslint-find-rules
MIT License
201 stars 33 forks source link

fix: ESLint 7.8.0 removes normalization function #332

Closed soda0289 closed 3 years ago

soda0289 commented 3 years ago

Issue #331

ESLint 7.8.0 removed the normalization functions this package used for package/plugin naming. The naming functions have now been moved into @eslint/eslintrc package. This change includes eslintrc as a dependency and removes the old logic of finding the function in the eslint source code.

soda0289 commented 3 years ago

I can change it so eslintrc is the final fallback, instead of throwing error. Would it be better to release this as a breaking change with major version. I can go back and see if the logic changes in older version of eslint but I feel like it should be good from eslint v6 or v5.

ljharb commented 3 years ago

Breaking changes are never better :-)

Having it as a fallback is fine, as long as we keep the current logic for eslint < v7.8.

soda0289 commented 3 years ago

@ljharb I added back the old logic and created a new case for version 7. I felt like new case would work best since it wouldn't have to fail each case before falling back to use eslintrc naming functions. Since we can't use the require('eslint/....') to detect eslint version I just imported the new ESLint class that has the version number as a static property.

soda0289 commented 3 years ago

Push another fix to remove object deconstruction to support nodejs v4.

soda0289 commented 3 years ago

Got the change passing now!. Had to make @eslint/eslintrc be conditionally required since it is not compatible with nodejs v4.

ljharb commented 2 years ago

Turns out this was a breaking change, because the eslintrc dep has an engines requirement of node 10 or 12+, and this package does not declare an engines requirement (but we tested on node 4+).

Not sure how to address it.

ljharb commented 2 years ago

Looks like this will work fine if we just remove the explicit dep. I'll do this in #338.