reviewdog/action-eslint

Failed to load plugin 'import' declared | failed to unmarshal rdjson (DiagnosticResult)

nrl240 opened this issue · 3 comments

Versions

  • GitHub Action environment
    • actions/setup-node@v2 --> node-version: '14.6.0'
    • Runs npm install --only=dev
    • reviewdog/action-eslint@v1.16.1
      • Outputs eslint version:v8.23.0 in logs
  • Relevant in package.json modules
    • "eslint": "^8.23.0"
    • "eslint-config-airbnb-base": "^15.0.0"
    • "eslint-config-prettier": "^8.5.0"
    • "eslint-plugin-import": "^2.26.0"

ESLint config

.eslintrc.json
{
    "env": {
        "node": true,
        "commonjs": true,
        "es2020": true,
        "mocha": true
    },
    "globals": {
        "expect": "readonly"
    },
    "parserOptions": { "ecmaVersion": 2020 },
    "extends": ["airbnb-base", "prettier"],
    "rules": {
        "no-unused-vars": [
            "error",
            {
                "argsIgnorePattern": "next",
                "destructuredArrayIgnorePattern": "."
            }
        ],
        "consistent-return": "off",
        "nonblock-statement-body-position": ["off"],
        "camelcase": "off",
        "no-use-before-define": ["warn", { "functions": false }],
        "no-param-reassign": [
            "warn",
            {
                "props": true,
                "ignorePropertyModificationsForRegex": ["^acc"]
            }
        ],
        "no-restricted-syntax": ["error", "FunctionExpression"],
        "spaced-comment": [
            "error",
            "always",
            { "block": { "exceptions": ["*"] } }
        ],
        "no-unused-expressions": ["error", { "allowTernary": true }],
        "no-shadow": "off",
        "import/no-unresolved": "off"
    },
    "overrides": [
        {
            "files": ["*.spec.js"],
            "rules": {
                "no-unused-expressions": "off"
            }
        }
    ]
}

Issue

After installing cookie-session, the reviewdog step fails with the following:

Oops! Something went wrong! :(
  
  ESLint: 8.23.0
  
  Error: Failed to load plugin 'import' declared in '../.eslintrc.json » eslint-config-airbnb-base » 
/home/runner/work/.../server/node_modules/eslint-config-airbnb-base/rules/imports.js':
Cannot find module 'debug'
  Require stack:
  - /home/runner/work/.../server/node_modules/eslint-module-utils/ModuleCache.js
  - /home/runner/work/.../server/node_modules/eslint-module-utils/resolve.js
  - /home/runner/work/.../server/node_modules/eslint-plugin-import/lib/rules/no-unresolved.js
  - /home/runner/work/.../server/node_modules/eslint-plugin-import/lib/index.js
  - /home/runner/work/.../server/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1065:15)
      at Function.Module._load (internal/modules/cjs/loader.js:911:27)
      at Module.require (internal/modules/cjs/loader.js:1125:19)
      at require (internal/modules/cjs/helpers.js:75:18)
      at Object.<anonymous> (/home/runner/work/.../server/node_modules/eslint-module-utils/ModuleCache.js:4:13)
      at Module._compile (internal/modules/cjs/loader.js:12[36](https://github.com/.../runs/8156170784?check_suite_focus=true#step:5:39):30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1257:10)
      at Module.load (internal/modules/cjs/loader.js:1085:32)
      at Function.Module._load (internal/modules/cjs/loader.js:950:14)
      at Module.require (internal/modules/cjs/loader.js:1125:19)
  reviewdog: failed to unmarshal rdjson (DiagnosticResult): proto: syntax error (line 1:1): unexpected token 
Error: Process completed with exit code 1.

I have not been able to find anything relevant/helpful related to the error log.

This error only occurs when I install a new dependency. Adding a random comment within the code does not lead to this error.

Note

Running eslint (npx eslint src/ and ./node_modules/.bin/eslint src/) inside of the appropriate directory locally works without a problem.

Please let me know if I'm missing anything...

@nrl240 were you able to figure this one out? We just started getting this on every PR.

@dustinblanchard Just was sifting through the related PR's commits, and, unfortunately, I can't see the logs anymore ("The logs for this run have expired and are no longer available") for the actions that failed so I'm guessing a bit. I did see that things started working again after I converted arrow function class methods into regular function syntax (e.g. someClassFunction = async (someParameter) => { ... } --> async someClassFunction(someParameter) { ... }). It looks like I tried a ton to get a parser installed and working, but couldn't figure it out so opted for the path of least resistance (a little syntax refactor).

Edit: I'm realizing now that since after installing cookie-session, I had to touch a super "dusty" file and so even though the code worked, the ESLint parser (via reviewdog) didn't like it, hence, the function syntax refactor.