vercel / turborepo

Build system optimized for JavaScript and TypeScript, written in Rust
https://turbo.build/repo/docs
MIT License
26.39k stars 1.84k forks source link

Linting plugin stopped working in 2.0.0-canary.0 #8252

Closed weyert closed 5 months ago

weyert commented 5 months ago

Verify canary release

Link to code that reproduces this issue

n/a

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

pnpm

What operating system are you using?

Mac

Which canary version will you have in your reproduction?

2.0.0-canary.0

Describe the Bug

Upgrading eslint-plugin-turbo breaks/ stops the turbo lifting for functioning:

TypeError: Failed to load plugin 'turbo' declared in '--config » /Users/weyert/Development/Projects/company/company-monorepo/configs/eslint-config/turbo.js': Cannot convert undefined or null to object
    at Function.entries (<anonymous>)
    at Ii.generateKey (/Users/weyert/Development/Projects/company/company-monorepo/node_modules/.pnpm/eslint-plugin-turbo@2.0.0-canary.0_eslint@8.57.0/node_modules/eslint-plugin-turbo/dist/index.js:74:6559)
    at new Ii (/Users/weyert/Development/Projects/company/company-monorepo/node_modules/.pnpm/eslint-plugin-turbo@2.0.0-canary.0_eslint@8.57.0/node_modules/eslint-plugin-turbo/dist/index.js:74:6200)
    at Object.<anonymous> (/Users/weyert/Development/Projects/company/company-monorepo/node_modules/.pnpm/eslint-plugin-turbo@2.0.0-canary.0_eslint@8.57.0/node_modules/eslint-plugin-turbo/dist/index.js:74:10209)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:179:18)

Expected Behavior

Able to use the turbo listing rules

To Reproduce

Upgrade to Turbo v2 canary build and try to run the linting rules

Additional context

Appears that code is still referring to pipeline instead of tasks when reading the turbo config file

anthonyshew commented 5 months ago

Looks like @chris-olszewski is ahead of it in #8253

weyert commented 5 months ago

Appears to fixed in the latest canary build

andrevenancio commented 5 months ago

I'm not sure what's happening with eslint-config-turbo yesterday I reported an issue, yet today I also have an issue.

I have a monorepo with turborepo@2.0.3. I have my root package with this npm script "lint": "eslint --fix packages apps". Nothing else on my app has a lint script (no apps and no packages) so running npm run lint on the root just runs this.

I have this .eslintrc.js on the root and I've copied the packages/eslint-config from the latest turbo starter project npx create-turbo@latest.

Running this exact script I've described on a new repo works fine and I get the ✔ No ESLint warnings or errors

Running it on my monorepo, returns this

TypeError: Failed to load plugin 'turbo' declared in '.eslintrc.js » @intangible/eslint-config/library.js » eslint-config-turbo': Cannot convert undefined or null to object

Same exact code on packages/eslint-config, package.json and .eslintrc.js on both packages. Is this related to turbo cache? I reinstalled my monorepo, and for the life of me I can't get it to work. I just realised that this issue seems to indicate I'm not the only one, but installing the canary version does nothing for me.

anthonyshew commented 5 months ago

That sounds similar to the error message I fixed in this PR: https://github.com/vercel/turbo/pull/8405

To be specific, renaming eslint-config-turbo to turbo in the ESLint configuration resolves that error.

Grsz commented 3 months ago

Still present, same error message

EDIT:

May help someone in the future, but it was related to a turbo.json file with missing tasks. The cannot convert undefined or null to object was referring to:

function Au(e,t){"pipeline"in e?Object.entries(e.pipeline).forEach(t):Object.entries(e.tasks).forEach(t)}

Where if e.tasks is not defined in the turbo.json file, it crashes ESLint.