这是indexloc提供的服务,不要输入任何密码
Skip to content

chore(linting): implement ESLint flat config compatibility for `eslin… #8606

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

Closed
wants to merge 5 commits into from
Closed

chore(linting): implement ESLint flat config compatibility for `eslin… #8606

wants to merge 5 commits into from

Conversation

jeremy-code
Copy link
Contributor

Description

  • Add "flat/recommended" config to eslint-plugin-turbo
  • Add meta property to plugin
  • Update README.md accordingly with information on using flat config
  • Add tests for flat config in __tests__/cwdFlat.test.ts

Testing Instructions

Run the following command:

pnpm run test --filter=eslint-plugin-turbo

…t-plugin-turbo`

- Add "flat/recommended" config to `eslint-plugin-turbo`
- Add `meta` property to plugin
- Update README.md accordingly with information on using flat config
- Add tests for flat config in `__tests__/cwdFlat.test.ts`
@jeremy-code jeremy-code requested a review from a team as a code owner June 26, 2024 04:38
@turbo-orchestrator turbo-orchestrator bot added needs: triage New issues get this label. Remove it after triage owned-by: turborepo pkg: turbo-eslint eslint-config-turbo and eslint-plugin-turbo labels Jun 26, 2024
Copy link

vercel bot commented Jun 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Nov 12, 2024 6:08pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Nov 12, 2024 6:08pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Nov 12, 2024 6:08pm
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Nov 12, 2024 6:08pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Nov 12, 2024 6:08pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Nov 12, 2024 6:08pm

Copy link

vercel bot commented Jun 26, 2024

@jeremy-code is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@jeremy-code
Copy link
Contributor Author

Previous PR was #8054, @anthonyshew

@anthonyshew anthonyshew removed the needs: triage New issues get this label. Remove it after triage label Jul 8, 2024
@turbo-orchestrator turbo-orchestrator bot added the needs: triage New issues get this label. Remove it after triage label Jul 8, 2024
@anthonyshew
Copy link
Contributor

anthonyshew commented Jul 8, 2024

Really appreciate this! Do you have a repo I could test this out in? I haven't gotten to try out Flat Config yet.

@anthonyshew anthonyshew removed the needs: triage New issues get this label. Remove it after triage label Jul 8, 2024
@turbo-orchestrator turbo-orchestrator bot added the needs: triage New issues get this label. Remove it after triage label Jul 8, 2024
@codybrouwers codybrouwers removed their request for review September 24, 2024 00:08
@Zertsov Zertsov removed their request for review October 4, 2024 14:08
@anthonyshew
Copy link
Contributor

@jeremy-code We'd love to get this merged! Are you able to fix up the conflicts so we can try this out with a canary release?

@jeremy-code jeremy-code closed this Nov 8, 2024
@turbo-orchestrator turbo-orchestrator bot removed pkg: turbo-eslint eslint-config-turbo and eslint-plugin-turbo owned-by: turborepo labels Nov 8, 2024
@jeremy-code jeremy-code deleted the turbo-eslint-plugin-flat branch November 8, 2024 02:24
@jeremy-code jeremy-code restored the turbo-eslint-plugin-flat branch November 8, 2024 02:26
@jeremy-code jeremy-code reopened this Nov 8, 2024
@turbo-orchestrator turbo-orchestrator bot added owned-by: turborepo pkg: turbo-eslint eslint-config-turbo and eslint-plugin-turbo labels Nov 8, 2024
@jeremy-code
Copy link
Contributor Author

@anthonyshew Sorry, I didn't realize y'all were blocked on me. I have fixed any conflicts. Let me know if there's any issues. I ran the test suite again and saw no errors.

Copy link

socket-security bot commented Nov 8, 2024

Removed dependencies detected. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: npm/@types/eslint@8.4.6

View full report↗︎

@anthonyshew
Copy link
Contributor

@jeremy-code No worries. I went on parental leave so I wasn't able to come back and review sooner - and I neglected to let anyone know to come review this one. Totally my fault!

I'm trying this out now in a create-next-app and it doesn't appear to be picking up issues.
CleanShot 2024-11-10 at 09 18 15@2x

However, I'm not sure that I'm configuring things right. I haven't had a chance to work with the new ESLint configuration format, so it might be silently failing. Do you have an example repo where I can hand test this?

@jeremy-code
Copy link
Contributor Author

jeremy-code commented Nov 10, 2024

image

Oh so that's what you meant by example repo -- I thought you just meant the ESLint config file.

The above is a quick and (very) dirty proof of concept to show it works with the the environmental variable rule. The corresponding repo is here: jeremy-code/turborepo-test.

If you're wondering why it's not underlining in VSCode, you have to enable "eslint.useFlatConfig" to true or have the ENV variable "ESLINT_USE_FLAT_CONFIG" for the ESLint extension.

EDIT:

I made some changes to try to make it a bit cleaner than it was previously. The corresponding repo is here: jeremy-code/turborepo-test. Here's a more thorough testing of it:

image

The ENV variables error or don't error correctly with the exception of process.env.TEST_ENV_IN_DOT_ENV (I think this is a recent change so not sure whether this is expected?). Also, apps/docs uses the flat config and doesn't error.

@anthonyshew
Copy link
Contributor

I'm getting Error: Cannot find package '/Users/anthonyshew/projects/debugs/turborepo-test/packages/eslint-config/node_modules/eslint-plugin-turbo/package.json' imported from /Users/anthonyshew/projects/debugs/turborepo-test/packages/eslint-config/index.mjs in that repo. Do you know why that is?

@jeremy-code
Copy link
Contributor Author

jeremy-code commented Nov 12, 2024 via email

@anthonyshew
Copy link
Contributor

Oops, I thought I had done that but apparently not. This looks great!

@turbo-orchestrator turbo-orchestrator bot added the area: examples Improvements or additions to examples label Nov 12, 2024
@anthonyshew
Copy link
Contributor

anthonyshew commented Nov 12, 2024

Sorry about my commits above. I messed up history and am getting back on track.

@jeremy-code
Copy link
Contributor Author

Nono I am pretty certain it's my fault I thought (hoped?) I fixed these merge issues since the original commit was a bit of time ago. Let me see if I can make a new PR with a different branch

anthonyshew added a commit that referenced this pull request Nov 14, 2024
…t-plugin-turbo` (#9426)

### Description

- Add "flat/recommended" config to `eslint-plugin-turbo`
- Add `meta` property to plugin
- Update README.md accordingly with information on using flat config
- Add tests for flat config in `__tests__/cwdFlat.test.ts`

### Testing Instructions

Run the following command:

```shell
pnpm run test --filter=eslint-plugin-turbo
```

See #8606

Co-authored-by: Anthony Shew <anthony.shew@vercel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: triage New issues get this label. Remove it after triage pkg: turbo-eslint eslint-config-turbo and eslint-plugin-turbo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants