Skip to content
This repository was archived by the owner on Feb 11, 2025. It is now read-only.

feat(eslint)!: add flat configs #114

Closed
wants to merge 21 commits into from
Closed

Conversation

appano1
Copy link

@appano1 appano1 commented Nov 6, 2024

⚠️ Breaking Changes

Requires ESLint ^8.57.0, or ^9.0.0 because of eslint-plugin-testing-library.
See also: eslint-plugin-testing-library v7 migration guide

Descriptions

Resolves #73
Resolves #108
Resolves #115

Related to #113

The goal of this PR is to minimize breaking changes.
Developers can apply the flat config as follows.

import vercel from '@vercel/style-guide/eslint/flat'
export default [
  ...vercel.configs.recommended,
  ...vercel.configs.typescript,
  ...vercel.configs.react,
  ...vercel.configs.next,
]

Due to certain characteristics of the flat config, it is not fully identical to the legacy config. @vercel/style-guide/eslint/browser and @vercel/style-guide/eslint/node might not be needed since developers can register them through the globals package. Instead, developers can continue to use the existing _base.js by applying configs.recommended.

import vercel from '@vercel/style-guide/eslint/flat'
export default [
  ...vercel.configs.recommended,
  {
    languageOptions: {
      globals: {
        ...globals.browser,
        ...globals.node,
      },
    },
  },
]

For @vercel/style-guide/eslint/jest, I’ve added jest-typescript.js to increase flexibility, as users may need to configure it within the flat config using options.files.

import vercel from '@vercel/style-guide/eslint/flat'
export default [
  { files: [/*path*/], ...vercel.configs.jest },
  vercel.configs['jest-typescript'],
]

Copy link

socket-security bot commented Nov 6, 2024

New, updated, and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@babel/[email protected] 🔁 npm/@babel/[email protected] None +7 399 kB nicolo-ribaudo
npm/@eslint/[email protected] 🔁 npm/@eslint/[email protected] None 0 14.9 kB eslintbot, openjsfoundation
npm/@types/[email protected] 🔁 npm/@types/[email protected] None +1 2.37 MB types
npm/@typescript-eslint/[email protected] 🔁 npm/@typescript-eslint/[email protected] Transitive: environment, filesystem +39 7.94 MB bradzacher, jameshenry
npm/@typescript-eslint/[email protected] 🔁 npm/@typescript-eslint/[email protected] Transitive: environment, filesystem +30 2.93 MB bradzacher, jameshenry
npm/[email protected] 🔁 npm/[email protected] environment Transitive: eval +123 11.2 MB ljharb
npm/[email protected] 🔁 npm/[email protected] Transitive: environment +32 3.9 MB aaronabramov, jeysal, jsonp, ...6 more
npm/[email protected] 🔁 npm/[email protected] Transitive: eval +115 14.8 MB ljharb
npm/[email protected] 🔁 npm/[email protected] None +2 307 kB mxschmitt
npm/[email protected] 🔁 npm/[email protected] None 0 169 kB react-bot
npm/[email protected] 🔁 npm/[email protected] Transitive: environment, eval +125 11.1 MB ljharb, yannickcr
npm/[email protected] 🔁 npm/[email protected] Transitive: environment +33 3.59 MB testing-library-bot
npm/[email protected] 🔁 npm/[email protected] Transitive: environment, eval, filesystem, unsafe +15 4.74 MB odspnpm
npm/[email protected] 🔁 npm/[email protected] Transitive: environment, filesystem, shell, unsafe +67 6.82 MB sindresorhus
npm/[email protected] 🔁 npm/[email protected] Transitive: eval, shell, unsafe +83 10.7 MB eslintbot, openjsfoundation
npm/[email protected] None 0 177 kB sindresorhus
npm/[email protected] 🔁 npm/[email protected] Transitive: environment, filesystem +14 577 kB matzkoh
npm/[email protected] 🔁 npm/[email protected] None 0 7.7 MB prettier-bot

🚮 Removed packages: npm/[email protected], npm/[email protected]

View full report↗︎

@@ -12,12 +12,12 @@ module.exports = {
'plugin:import/recommended',
'prettier',
require.resolve('./rules/best-practice'),
require.resolve('./rules/comments'),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comments config and a unicorn config to ensure that only pure rules, excluding plugins, are in the rules directory.

@@ -1,6 +1,6 @@
module.exports = {
extends: [
'plugin:eslint-comments/recommended',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced eslint-comment to @eslint-community/eslint-comments cause eslint-comment is not maintained for a while

* Fix no-unused-vars
* Add a rule for `*.config.mjs` files.
* Install `@types/node` for `process.*`
@appano1 appano1 changed the title feat(eslint): add flat configs feat(eslint)!: add flat configs Dec 13, 2024
@RobinGiel
Copy link

Will this be merged anytime soon?

@leerob
Copy link
Member

leerob commented Feb 11, 2025

Hey y'all. This repository has been archived and sunset. The existing configurations will remain public for reference.

Thank you 🙏

@leerob leerob closed this Feb 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants