codeclimate / codeclimate-eslint

Code Climate Engine for ESLint
MIT License
95 stars 93 forks source link

Add support for plugins for eslint-7 channel #567

Open mileslane opened 2 years ago

mileslane commented 2 years ago

Actual Behavior

It would be helpful to be able to get our GitHub Codeclimate checks to pass. Currently, we are getting errors like this:

Parsing error: Cannot find module 'babel-plugin-macros' Require stack: - /code/babel.config.js

Expected Behavior

Our babel.config.js file uses the following plugins that are not present in the list of Dependencies in the eslint-7 package.json file:

NOTES

Running codeclimate analyze -e eslint:eslint-7 locally does not trigger these complaints about these plugins.


mileslane commented 2 years ago

Here is my proposed patch (I don't have write access):

diff --git a/package.json b/package.json
index 39296eac..2e871ec3 100644
--- a/package.json
+++ b/package.json
@@ -15,11 +15,20 @@
     "@babel/plugin-transform-runtime": "^7.13.10",
     "@babel/preset-env": "^7.14.7",
     "@babel/preset-react": "^7.14.5",
+    "@babel/preset-typescript": "^7.16.7",
+    "@babel/plugin-proposal-object-rest-spread": "^7.16.7",
+    "@babel/plugin-proposal-optional-chaining": "^7.16.7",
+    "@babel/plugin-proposal-private-methods": "^7.16.11",
+    "@babel/plugin-proposal-private-property-in-object": "^7.16.7",
+    "@babel/plugin-syntax-dynamic-import": "^7.8.3",
+    "@babel/plugin-transform-destructuring": "^7.16.7",
+    "@babel/plugin-transform-regenerator": "^7.16.7",
     "@babel/runtime": "^7.14.8",
     "@hapi/eslint-plugin": "^5.0.0",
     "@typescript-eslint/eslint-plugin": "^4.33.0",
     "@typescript-eslint/parser": "^4.33.0",
     "babel-eslint": "^10.0.1",
+    "babel-plugin-macros": "^3.1.0",
     "babel-plugin-react-generate-property": "^1.0.5",
     "eslint": "7.8.1",
     "eslint-config-airbnb": "^17.1.0",
mileslane commented 2 years ago

If you like, I could put up a separate PR for each of these plugins for your consideration.

mileslane commented 2 years ago

Ah. I see the problem. Our lead developer is requiring individual plugins from @babel/preset-env in the process of specifying the babel configuration. This appears to be the issues he is trying to resolve: Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-property-in-object since the "loose" mode option was set to "true" for @babel/plugin-proposal-private-methods. Is it possible to make Codeclimate not choke when individual plugins are required that are included in @babel/preset-env?

mileslane commented 2 years ago

So, it appears that there are two plugins that are definitely missing in your package.json file:

chrisjimenez commented 2 years ago

We're also seeing similar errors, but for the babel-plugin-module-resolver plugin.

camillof commented 2 years ago

@mileslane @chrisjimenez Would you mind testing your projects again please? Some updates were done on the engine that may fix your issue: #578 #579