codeclimate / codeclimate-eslint

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

`MODULE_NOT_FOUND` error while using prettier plugins #613

Open khavinshankar opened 3 months ago

khavinshankar commented 3 months ago

Description

We've encountered an issue where Prettier plugins integrated with ESLint are not recognized during Code Climate's analysis process. While these plugins work seamlessly in our local development environments, they seem to be overlooked by Code Climate, leading to discrepancies between local linting results and those reported by Code Climate.

Actual Behavior

During Code Climate analysis, it appears that Prettier plugins, though properly configured in our project, are not detected or used by the ESLint engine. This results in a MODULE_NOT_FOUND error which ends up with the entire github workflow failing with the runtime error.

Expected Behavior

It would be better if the plugin is skipped similar to the unsupported plugins in the eslint instead of a runtime error, or it would be best if there is an option in the config to add these plugins (npm packages) at runtime.

Steps to Reproduce

Necessary config files

  1. .codeclimate.yml
    plugins:
    eslint:
    enabled: false
    channel: "eslint-7"
  2. .eslintrc.json
    {
    "env": {
    "browser": true,
    "node": true,
    "es2021": true
    },
    "extends": [
    "plugin:prettier/recommended"
    ],
    }
  3. .prettierrc.json
    {
    "tailwindFunctions": [
    "classNames"
    ],
    "plugins": [
    "prettier-plugin-tailwindcss"
    ]
    }
  4. package.json
    {
    "devDependencies": {
    "eslint": "^8.44.0",
    "eslint-config-prettier": "^8.8.0",
    "eslint-plugin-prettier": "^4.2.1",
    "prettier": "^2.8.8",
    "prettier-plugin-tailwindcss": "^0.4.0"
    }
    }

Relevant links

  1. We are facing the above-mentioned issue in one of our open-sourced projects https://github.com/coronasafe/care_fe
  2. Here is the issue filled for that in our repository https://github.com/coronasafe/care_fe/issues/7563
  3. Here is the failing action https://codeclimate.com/github/coronasafe/care_fe/builds/19007