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

chore(linting): implement ESLint flat config for eslint-plugin-turbo #8054

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jeremy-code
Copy link

@jeremy-code jeremy-code commented Apr 29, 2024

Description

Testing Instructions

The rules or any actual functionality isn't changed, just the exports. The current tests all pass and I have tested the equivalent functionality on a separate project:

const eslint = require("@eslint/js");
const turbo = require("eslint-plugin-turbo");


module.exports = [
  eslint.configs.recommended,
  {
    plugins: { turbo },
    rules: {
      ...turbo.configs.recommended.rules,
    },
    settings: {
      ...turbo.configs.recommended.settings,
    },
  },
];

- Add "flat/recommended" config to eslint-plugin-turbo
- Add meta property to plugin
- Update README.md accordingly with information on using flat config
@jeremy-code jeremy-code requested a review from a team as a code owner April 29, 2024 03:01
@turbo-orchestrator turbo-orchestrator bot added owned-by: turborepo pkg: turbo-eslint eslint-config-turbo and eslint-plugin-turbo labels Apr 29, 2024
Copy link

vercel bot commented Apr 29, 2024

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

Name Status Preview Comments Updated (UTC)
examples-basic-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Apr 29, 2024 3:02am
examples-designsystem-docs 🔄 Building (Inspect) Visit Preview 💬 Add feedback Apr 29, 2024 3:02am
examples-tailwind-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Apr 29, 2024 3:02am
4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Apr 29, 2024 3:02am
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Apr 29, 2024 3:02am
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Apr 29, 2024 3:02am
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Apr 29, 2024 3:02am

Copy link

vercel bot commented Apr 29, 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
Author

jeremy-code commented Apr 29, 2024

The new config is its own folder flat, which seems to be the current standard for maintaining backwards compatability (see eslint-plugin-vue).

I haven't updated eslint-config-turbo, because it is just a default export that extends the config.

I inlined the rules for now since the main export index.ts in eslint-plugin-turbo is where the rules are located, leading to a circular dependency. This may want to be changed in the future. Note that this will cause concerns with caching for those using the config since the metadata property is no longer there -- not certain whether to also inline that or ask whether the code should be rearranged.

Should have no issues in regards to backwards compatability.

@anthonyshew
Copy link
Contributor

anthonyshew commented Jun 15, 2024

This is awesome! 🤩

I hate to ask you for an additional burden, but do you have a monorepo with ESLint v9 in it that I could try to use this against? I still haven't gotten to figure out how ESLint v9 configuration works and I'd like to manually verify this since we don't have any tests.

Alternatively, do you believe there are any tests that we could add to harden the support of the differing versions? (Apologies if this is a naive question.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
owned-by: turborepo pkg: turbo-eslint eslint-config-turbo and eslint-plugin-turbo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: eslint v9
2 participants