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

feat: improve monorepo support for eslint #2239

Merged
merged 1 commit into from
Jul 9, 2022

Conversation

belgattitude
Copy link
Owner

@belgattitude belgattitude commented Jul 9, 2022

Expose @rushstack/eslint-patch through @your-org/eslint-config-bases/patch/modern-module-resolution.

Purpose

By default workspaces consuming the eslint-config-bases example should declare plugins as devDependencies. See eslint limitation.

A workaround is to use the @rushstack/eslint-patch.

PS: Note the example wasn't impacted because it relies on
eslint-config-react-app which already comes with the rushstack patch

Tasks

  • Add explicit dependency to @rushstack/eslint-patch
  • Expose `@your-org/eslint-config-bases/patch/modern-module-resolution');

Recommended usage

Simply require('@your-org/eslint-config-bases/patch/modern-module-resolution'); on top of workspace eslintrc.(js|cjs)

/**
 * Specific eslint rules for this app/package, extends the base rules
 * @see https://github.com/belgattitude/nextjs-monorepo-example/blob/main/docs/about-linters.md
 */

// Workaround for https://github.com/eslint/eslint/issues/3458 (re-export of @rushstack/eslint-patch)
require('@your-org/eslint-config-bases/patch/modern-module-resolution');

const {
  getDefaultIgnorePatterns,
} = require('@your-org/eslint-config-bases/helpers');

module.exports = {
  root: true,
  parserOptions: {
    tsconfigRootDir: __dirname,
    project: 'tsconfig.json',
  },
  ignorePatterns: [...getDefaultIgnorePatterns(), '/storybook-static'],
  extends: [
    '@your-org/eslint-config-bases/typescript',
    '@your-org/eslint-config-bases/regexp',
    '@your-org/eslint-config-bases/sonar',
    '@your-org/eslint-config-bases/jest',
    '@your-org/eslint-config-bases/rtl',
    '@your-org/eslint-config-bases/storybook',
    '@your-org/eslint-config-bases/react',
    // Apply prettier and disable incompatible rules
    '@your-org/eslint-config-bases/prettier',
  ],
  rules: {
    // optional overrides per project
  },
  overrides: [
    // optional overrides per project file match
  ],
};

Credits

Thx to eslint/eslint#3458 (comment)

@changeset-bot
Copy link

changeset-bot bot commented Jul 9, 2022

🦋 Changeset detected

Latest commit: 98ca6d6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@your-org/eslint-config-bases Minor
remix-app Patch
vite-app Patch
@your-org/ui-lib Patch
nextjs-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jul 9, 2022

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

Name Status Preview Updated
monorepo-nextjs-app ✅ Ready (Inspect) Visit Preview Jul 9, 2022 at 11:06AM (UTC)
monorepo-vite-app ✅ Ready (Inspect) Visit Preview Jul 9, 2022 at 11:06AM (UTC)

@codeclimate
Copy link

codeclimate bot commented Jul 9, 2022

Code Climate has analyzed commit 98ca6d6 and detected 0 issues on this pull request.

View more on Code Climate.

@ghost
Copy link

ghost commented Jul 9, 2022

👇 Click on the image for a new way to code review
  • Make big changes easier — review code in small groups of related files

  • Know where to start — see the whole change at a glance

  • Take a code tour — explore the change with an interactive tour

  • Make comments and review — all fully sync’ed with github

    Try it now!

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

@belgattitude belgattitude merged commit 8a50c5e into main Jul 9, 2022
@belgattitude belgattitude deleted the eslint-config-monorepo-improvement branch July 9, 2022 11:11
@github-actions github-actions bot mentioned this pull request Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant