turbo icon indicating copy to clipboard operation
turbo copied to clipboard

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

Open jeremy-code opened this issue 1 year ago • 3 comments

Description

  • Closes #7909
  • Add "flat/recommended" config to eslint-plugin-turbo
  • Add meta property to plugin (required for caching, see Adding Plugin Meta Information)
  • Update eslint-plugin-turbo/README.md accordingly with information on using flat config

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,
    },
  },
];

jeremy-code avatar Apr 29 '24 03:04 jeremy-code

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

vercel[bot] avatar Apr 29 '24 03:04 vercel[bot]

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

A member of the Team first needs to authorize it.

vercel[bot] avatar Apr 29 '24 03:04 vercel[bot]

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.

jeremy-code avatar Apr 29 '24 03:04 jeremy-code

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.)

anthonyshew avatar Jun 15 '24 23:06 anthonyshew

Will be working on this, will open a new PR when done

jeremy-code avatar Jun 26 '24 03:06 jeremy-code