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

React / Next.js 向けの設定を個別に利用可能にする #154

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

susisu
Copy link
Member

@susisu susisu commented Dec 22, 2024

これまでは React / Next.js 向けの設定は全体で有効にする必要がありましたが, monorepo で一つの eslint.config.js を使う場合など, ディレクトリごとに細かく有効 / 無効を制御したい場合には不向きでした.

import config from "@hatena/eslint-config-hatena/flat";

export default config({ react: true });
// または
export default config({ next: "strict" });

そこで新たに config.react(), config.next() を追加し, 同様の設定をディレクトリごとに行えるようにします.
(上記の方法も引き続きサポートされます.)

import config from "@hatena/eslint-config-hatena/flat";

export default config({}, [
  // foo 以下では React 向けの設定を有効化する
  {
    files: ["foo/**/*.{ts,tsx}"],
    extends: config.react(),
  },
  // bar 以下では Next.js 向けの設定を有効化する (React 向けの設定も内包)
  {
    files: ["bar/**/*.{ts,tsx}"],
    extends: config.next({ strict: true }),
  },
]);

@susisu susisu self-assigned this Dec 22, 2024
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