question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Reference unexpected had more than one definition - please file a github issue

See original GitHub issue

I don’t quite understand what’s going on but since the latest update from ^26.1.5 -> ^26.2.1 I see the following error:

$ yarn workspaces foreach -pv run lint
[... a lot of workspaces exit with status code 0]
➤ YN0000: [@beteon/serverless-wrapper]:
➤ YN0000: [@beteon/serverless-wrapper]: Oops! Something went wrong! :(
➤ YN0000: [@beteon/serverless-wrapper]:
➤ YN0000: [@beteon/serverless-wrapper]: ESLint: 8.8.0
➤ YN0000: [@beteon/serverless-wrapper]:
➤ YN0000: [@beteon/serverless-wrapper]: Error: Reference unexpected had more than one definition - please file a github issue at https://github.com/jest-community/eslint-plugin-jest
➤ YN0000: [@beteon/serverless-wrapper]: Occurred while linting /home/robert/Development/auteon/beteon/cloudrun/serverless-wrapper/src/pubSubApp.ts:38
➤ YN0000: [@beteon/serverless-wrapper]: Rule: "jest/no-conditional-expect"
➤ YN0000: [@beteon/serverless-wrapper]:     at collectReferences (/home/robert/Development/auteon/beteon/.yarn/__virtual__/eslint-plugin-jest-virtual-b357a19ac6/0/cache/eslint-plugin-jest-npm-26.2.1-0c46a1ee3e-18e105a1a6.zip/node_modules/eslint-plugin-jest/lib/rules/utils.js:589:15)
➤ YN0000: [@beteon/serverless-wrapper]:     at resolveToJestFn (/home/robert/Development/auteon/beteon/.yarn/__virtual__/eslint-plugin-jest-virtual-b357a19ac6/0/cache/eslint-plugin-jest-npm-26.2.1-0c46a1ee3e-18e105a1a6.zip/node_modules/eslint-plugin-jest/lib/rules/utils.js:630:22)
➤ YN0000: [@beteon/serverless-wrapper]:     at isTestCaseCall (/home/robert/Development/auteon/beteon/.yarn/__virtual__/eslint-plugin-jest-virtual-b357a19ac6/0/cache/eslint-plugin-jest-npm-26.2.1-0c46a1ee3e-18e105a1a6.zip/node_modules/eslint-plugin-jest/lib/rules/utils.js:425:10)
➤ YN0000: [@beteon/serverless-wrapper]:     at /home/robert/Development/auteon/beteon/.yarn/__virtual__/eslint-plugin-jest-virtual-b357a19ac6/0/cache/eslint-plugin-jest-npm-26.2.1-0c46a1ee3e-18e105a1a6.zip/node_modules/eslint-plugin-jest/lib/rules/utils.js:405:107
➤ YN0000: [@beteon/serverless-wrapper]:     at Array.filter (<anonymous>)
➤ YN0000: [@beteon/serverless-wrapper]:     at /home/robert/Development/auteon/beteon/.yarn/__virtual__/eslint-plugin-jest-virtual-b357a19ac6/0/cache/eslint-plugin-jest-npm-26.2.1-0c46a1ee3e-18e105a1a6.zip/node_modules/eslint-plugin-jest/lib/rules/utils.js:405:28
➤ YN0000: [@beteon/serverless-wrapper]:     at Array.reduce (<anonymous>)
➤ YN0000: [@beteon/serverless-wrapper]:     at getTestCallExpressionsFromDeclaredVariables (/home/robert/Development/auteon/beteon/.yarn/__virtual__/eslint-plugin-jest-virtual-b357a19ac6/0/cache/eslint-plugin-jest-npm-26.2.1-0c46a1ee3e-18e105a1a6.zip/node_modules/eslint-plugin-jest/lib/rules/utils.js:401:28)
➤ YN0000: [@beteon/serverless-wrapper]:     at FunctionDeclaration (/home/robert/Development/auteon/beteon/.yarn/__virtual__/eslint-plugin-jest-virtual-b357a19ac6/0/cache/eslint-plugin-jest-npm-26.2.1-0c46a1ee3e-18e105a1a6.zip/node_modules/eslint-plugin-jest/lib/rules/no-conditional-expect.js:42:93)
➤ YN0000: [@beteon/serverless-wrapper]:     at ruleErrorHandler (/home/robert/Development/auteon/beteon/.yarn/cache/eslint-npm-8.8.0-4abd179cd9-41a7e85bf8.zip/node_modules/eslint/lib/linter/linter.js:1107:28)
➤ YN0000: [@beteon/serverless-wrapper]: Process exited (exit code 2), completed in 11s 912ms

We’re using typescript and method overloading on line 38 in the mentioned file:

export function pubSubApp(
  serverlessFunction: typeof eventSearchInit
): express.Application
export function pubSubApp(
  serverlessFunction: typeof eventProcessBotOffers
): express.Application
export function pubSubApp(
  serverlessFunction: typeof eventProcessValidationResults
): express.Application
export function pubSubApp(
  serverlessFunction: typeof eventAuthorize
): express.Application
export function pubSubApp(
  serverlessFunction: typeof eventSearch
): express.Application
export function pubSubApp(
  serverlessFunction: typeof eventOrder
): express.Application
export function pubSubApp(
  serverlessFunction: typeof eventValidateCart
): express.Application
export function pubSubApp(
  serverlessFunction: ServerlessFunction
): express.Application {

image

I see this was introduced in #1094 here https://github.com/jest-community/eslint-plugin-jest/pull/1094/files#diff-1c5ed711c5adf38f4dfb60de69d029f944e90550f85ea37e087482ccbc884e91R899

I just can’t get my head around this section. @G-Rath what do you mean with ref unexpected?

$> node --version
v16.15.0
$> yarn --version
3.2.1
$> yarn info eslint version
└─ eslint@npm:8.8.0
   ├─ Version: 8.8.0
Eslint configuration file
module.exports = {
  root: true,
  env: {
    es2021: true,
    node: true,
  },
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:prettier/recommended',
    'plugin:jest/recommended',
    'plugin:import/recommended',
    'plugin:import/typescript',
  ],
  ignorePatterns: ['dist/**'],
  parser: '@typescript-eslint/parser',
  parserOptions: {
    ecmaVersion: 12,
  },
  plugins: ['@typescript-eslint', 'jest', 'import', 'unused-imports'],
  rules: {
    '@typescript-eslint/consistent-type-assertions': [
      'error',
      {
        assertionStyle: 'never',
      },
    ],
    '@typescript-eslint/no-non-null-assertion': 'error',
    '@typescript-eslint/no-unused-vars': 'off',
    'unused-imports/no-unused-imports': 'error',
    'unused-imports/no-unused-vars': [
      'warn',
      {
        args: 'after-used',
        argsIgnorePattern: '^_',
        vars: 'all',
        varsIgnorePattern: '^_',
      },
    ],
    'import/no-cycle': [2],
    'no-console': 'error',
    curly: ['error', 'multi-line'],
    '@typescript-eslint/naming-convention': [
      'warn',
      {
        selector: 'parameter',
        format: ['camelCase', 'snake_case', 'UPPER_CASE', 'PascalCase'],
        leadingUnderscore: 'allow',
        trailingUnderscore: 'allow',
      },
      {
        selector: 'variable',
        format: ['camelCase', 'snake_case', 'UPPER_CASE', 'PascalCase'],
        leadingUnderscore: 'allow',
        trailingUnderscore: 'allow',
        modifiers: ['destructured'],
      },
      {
        selector: 'variable',
        format: ['camelCase', 'snake_case', 'UPPER_CASE'],
        leadingUnderscore: 'allow',
        trailingUnderscore: 'allow',
        modifiers: ['const'],
      },
      {
        selector: 'enum',
        format: ['PascalCase'],
      },
      {
        selector: 'enumMember',
        format: ['camelCase', 'UPPER_CASE'],
      },
      {
        selector: 'variableLike',
        format: ['camelCase', 'snake_case'],
        leadingUnderscore: 'allow',
        trailingUnderscore: 'allow',
      },
    ],
    '@typescript-eslint/consistent-type-imports': 'warn',
    'sort-imports': [
      'warn',
      {
        ignoreCase: true,
        ignoreDeclarationSort: true,
      },
    ],
    'import/no-default-export': 'warn',
    "no-restricted-imports": ["error", {
      "patterns": [{
        group: ["@beteon/**/src/*"]
      },{
        group: ["src/*"],
        message: "We have an issue with absolute paths and workspaces referenced in other workspaces. See PR #1144 on Github."
      }]
    }],
    'no-return-await': 'warn',
  },
  overrides: [
    {
      files: ['**/test/**/*.ts', '**/*.spec.ts'],
      rules: {
        '@typescript-eslint/consistent-type-assertions': [
          'warn',
          {
            assertionStyle: 'as',
            objectLiteralTypeAssertions: 'never',
          },
        ],
      },
    },
    {
      files: ['bots/**'],
      rules: {
        "no-restricted-imports": ["error", {
          "patterns": ["@beteon/**/src/*" ]
        }]
      },
    },
  ],
  settings: {
    'import/resolver': {
      typescript: {}, // this loads <rootdir>/tsconfig.json to eslint
    },
  },
}

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

2reactions
G-Rathcommented, May 14, 2022

thanks for that - @diegohaz that file has function overloading, so it looks like the same cause.

@kukhariev yours is slightly different as it’s declaration merging (interface + class) but has the same outcome as function overloading so that’s good.

I’ll merge #1109 in a few minutes once CI has passed, which’ll fix this 😃

1reaction
roschaefercommented, May 16, 2022

@G-Rath @kukhariev @diegohaz wow, that was super quick. We’re able to update to the latest release 🙌 🥳 Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running with an unexpected Error · Issue #48 - GitHub
I'm looking for a region where the reference itself has highly repetitive sequence and I'm not sure how many portion of the repeats...
Read more >
Provide explicit path on parse error from toml Version Catalog ...
Reason: At line 2, column 1: Unexpected '/', expected a newline or end-of-input. Possible solution: Fix the TOML file according to the syntax ......
Read more >
error TS2688: Cannot find type definition file for...random paths.
Basically anything that tries to do typescript gets a bunch of errors about not finding type definitions I never reference in any of...
Read more >
Private helm repo as dependency doesn't use creds #7858
The dependency is a chart from private repository; Using UI add credentials for ... I have updated to 3.29.1 and still have the...
Read more >
Bug: React 18 types broken since the type release a ... - GitHub
Please file an issue in those packages. I'm not sure I understand why a library would need to include React types in its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found