ESLint not reporting errors/warnings for TypeScript project

I tried setting up Codacy with our open source repository: https://app.codacy.com/gh/pixiebrix/pixiebrix-extension/

ESlint is toggled “on” on the Code patterns page and set to “Configuration file”. Our project is Typescript using the @typescript-eslint/parser parser set up in our .eslintrc.

I’m not seeing any ESLint warning/errors from our project. Additionally, I’m not seeing any errors from Codacy indicating that it couldn’t find the eslint config, or was unable to run the linter

Could you please advise on how to set up our repository with Codacy? Do we need to somehow specify which file extensions to pass through to ESLint?

Hello @tschiller, and welcome to the Codacy Community! :wave:

As a first step to troubleshoot the issue, could you please confirm if you have already configured your repository to use a configuration file for ESLint? You must open the Code patterns page, select ESLint, and make sure that the option Configuration file is enabled:

https://docs.codacy.com/repositories-configure/code-patterns/#using-your-own-tool-configuration-files

When running the tools Codacy automatically detects the files in your repository based on the configured file extensions, so this shouldn’t be an issue.

Please report back your findings so we can further help you troubleshoot.

1 Like

Thanks, Paolo! Yes, it’s enabled. With Madalena’s help from the support team, we’ve tracked it down to an error where ESLint is erroring out, but that wasn’t being reflected anywhere on the dashboard.

Looking at the logs for a single commit, there’s an error that eslint can’t find the module for a plugin we use even though it’s defined in our package.json and package-lock.json

I’m not sure where the /src/.eslintrc path is coming from, as the .eslintrc is in the root of our repository

TypeScript :

KubernetesDockerRunner: Container for codacy/codacy-eslint:6.13.0 exited with non-zero code 1
Error: Failed to load plugin 'react-redux' declared in '.eslintrc': Cannot find module 'eslint-plugin-react-redux'
Require stack:
- /__placeholder__.js
Referenced from: /src/.eslintrc
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
    at Function.resolve (node:internal/modules/cjs/helpers:98:19)
    at Object.resolve (/node_modules/eslint/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js:28:50)
    at ConfigArrayFactory._loadPlugin (/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js:1017:39)
    at ConfigArrayFactory._loadExtendedPluginConfig (/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js:837:29)
    at ConfigArrayFactory._loadExtends (/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js:779:29)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js:720:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js:665:20)
    at _normalizeObjectConfigData.next (<anonymous>) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/__placeholder__.js' ],
  messageTemplate: 'plugin-missing',
  messageData: {
    pluginName: 'eslint-plugin-react-redux',
    resolvePluginsRelativeTo: '/',
    importerName: '.eslintrc'
  }
}

The solution was to remove eslint-plugin-react-redux from our eslintrc from the time being and create an issue in Codacy’s eslint repository: [CY-4539] Add eslint-plugin-react-redux plugin · Issue #1544 · codacy/codacy-eslint · GitHub

2 Likes