Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eslint-config-turbo] 0.0.9 throws Ga(...).map is not a function error #4085

Closed
mikecousins opened this issue Mar 6, 2023 · 7 comments
Closed
Assignees
Labels
kind: bug Something isn't working

Comments

@mikecousins
Copy link

What version of Turborepo are you using?

0.0.9

What package manager are you using / does the bug impact?

Yarn v2/v3 (node_modules linker only)

What operating system are you using?

Mac

Describe the Bug

Updating from 0.0.8 to 0.0.9 throws the following error:

TypeError: Failed to load plugin 'turbo' declared in '../../.eslintrc.js » eslint-config-pm » eslint-config-turbo': Ga(...).map is not a function

We're using Typescript, we have a shared package for our eslint config.

Package config:

module.exports = {
  env: {
    browser: true,
    node: true,
  },
  parser: '@typescript-eslint/parser',
  plugins: ['@typescript-eslint'],
  settings: {
    react: {
      version: 'detect',
    },
  },
  extends: [
    'eslint:recommended',
    'plugin:react/recommended',
    'plugin:react-hooks/recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:prettier/recommended',
    'plugin:cypress/recommended',
    'plugin:jsx-a11y/recommended',
    'turbo',
  ],
  rules: {
    'react/button-has-type': 'error',
    'react/react-in-jsx-scope': 'off', // need this for vite support
    'jsx-a11y/label-has-associated-control': [
      1,
      {
        controlComponents: ['ReadonlyText', 'Field'],
      },
    ],
    // Automatically flag env vars missing from turbo.json when process.env is used
    'turbo/no-undeclared-env-vars': 'error',
    '@typescript-eslint/no-unused-vars': [
      'error',
      {
        argsIgnorePattern: '^_',
        destructuredArrayIgnorePattern: '^_',
        ignoreRestSiblings: true,
      },
    ],
  },
};

Root config:

module.exports = {
  // This tells ESLint to load the config from the workspace `eslint-config-pm`
  extends: ['pm'],
  root: true,
};

While debugging this I've tried removing all other plugins, all the rule overrides, the env node, and the settings node without success.

Expected Behavior

Should run lint successfully.

To Reproduce

Update to 0.0.9 of eslint-config-turbo and attempt to run lint.

Reproduction Repo

No response

@mikecousins mikecousins added area: turborepo kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage labels Mar 6, 2023
@tknickman
Copy link
Member

tknickman commented Mar 6, 2023

Will take a look, thanks for the report, can you try running with debug logging enabled:
DEBUG=eslint:cli-engine yarn lint

and share any more output?

One minor thing, you shouldn't need to redeclare the rule in your config since you're extending from the config, and not the plugin. So 'turbo/no-undeclared-env-vars': 'error', can be removed from your rules object with your current configuration.

@tknickman tknickman self-assigned this Mar 6, 2023
@tknickman tknickman removed the needs: triage New issues get this label. Remove it after triage label Mar 6, 2023
@mikecousins
Copy link
Author

mikecousins commented Mar 8, 2023

mikecousins@MikeMBP14 front-end % DEBUG=eslint:cli-engine yarn lint --force
• Packages in scope: @pm/core, @pm/freddie, @pm/frida, @pm/graphql, @pm/tailwind, eslint-config-pm, freddie, frida, purposemed, storybook, tsconfig
• Running lint in 11 packages
• Remote caching enabled
purposemed:lint: cache bypass, force executing 9e02c0260897326a
@pm/core:lint: cache bypass, force executing 58bb490f2256b4cb
frida:lint: cache bypass, force executing 769e87025e26bc7a
storybook:lint: cache bypass, force executing 369e85e9e8bb4115
freddie:lint: cache bypass, force executing 06d562f55711c414
storybook:lint: no lint
frida:lint: 
frida:lint: Oops! Something went wrong! :(
frida:lint: 
frida:lint: ESLint: 8.35.0
frida:lint: 
frida:lint: TypeError: Failed to load plugin 'turbo' declared in '../../.eslintrc.js » eslint-config-pm » eslint-config-turbo': Ga(...).map is not a function
frida:lint: Referenced from: /Users/mikecousins/dev/core/front-end/node_modules/eslint-config-turbo/index.js
frida:lint:     at Ua (/Users/mikecousins/dev/core/front-end/node_modules/eslint-plugin-turbo/dist/index.js:52:1085)
frida:lint:     at Cc (/Users/mikecousins/dev/core/front-end/node_modules/eslint-plugin-turbo/dist/index.js:56:11794)
frida:lint:     at Object.<anonymous> (/Users/mikecousins/dev/core/front-end/node_modules/eslint-plugin-turbo/dist/index.js:56:14226)
frida:lint:     at Module._compile (node:internal/modules/cjs/loader:1246:14)
frida:lint:     at Module._extensions..js (node:internal/modules/cjs/loader:1300:10)
frida:lint:     at Module.load (node:internal/modules/cjs/loader:1103:32)
frida:lint:     at Module._load (node:internal/modules/cjs/loader:942:12)
frida:lint:     at Module.require (node:internal/modules/cjs/loader:1127:19)
frida:lint:     at require (node:internal/modules/helpers:112:18)
frida:lint:     at ConfigArrayFactory._loadPlugin (/Users/mikecousins/dev/core/front-end/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3411:42)
purposemed:lint: 
purposemed:lint: Oops! Something went wrong! :(
purposemed:lint: 
purposemed:lint: ESLint: 8.35.0
purposemed:lint: 
purposemed:lint: TypeError: Failed to load plugin 'turbo' declared in '../../.eslintrc.js » eslint-config-pm » eslint-config-turbo': Ga(...).map is not a function
purposemed:lint: Referenced from: /Users/mikecousins/dev/core/front-end/node_modules/eslint-config-turbo/index.js
purposemed:lint:     at Ua (/Users/mikecousins/dev/core/front-end/node_modules/eslint-plugin-turbo/dist/index.js:52:1085)
purposemed:lint:     at Cc (/Users/mikecousins/dev/core/front-end/node_modules/eslint-plugin-turbo/dist/index.js:56:11794)

Thanks for the tip on that rule as well!

@johnwils
Copy link

I had a similar issue Ga(...).map is not a function when updating to eslint-plugin-turbo: 0.0.9.

Everything works fine for me using eslint-plugin-turbo: 0.0.8. So might be related to a change made between the 2 version.

@mikecousins
Copy link
Author

Still broken in 0.0.10

@tknickman
Copy link
Member

Thanks for the reports, I haven't been able to reproduce this one on my end, if you could provide a small example project I can take a deeper look!

@tknickman
Copy link
Member

Have a fix for this here: #4682

tknickman added a commit that referenced this issue Apr 24, 2023
### Description

Support old workspace format (workspaces.packages) in our find config
util used by codemod and the eslint plugin

Fixes #4469 and
#4085
@tknickman
Copy link
Member

Will release a new canary shortly that you can use to validate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants