From 3d64494122253de1ae07ed83c5aa0ef4588a1f84 Mon Sep 17 00:00:00 2001 From: Cloyd Lau <31238760+cloydlau@users.noreply.github.com> Date: Wed, 18 Dec 2024 21:30:26 +0800 Subject: [PATCH 1/2] docs: describe how to configure via Flat Config --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index adb0e22..30535aa 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,29 @@ Configure it in `.eslintrc`: } ``` +### Flat Config (ESLint v9 default) + +```js +// eslint.config.js + +import { FlatCompat } from "@eslint/eslintrc" +import path from "path" +import { fileURLToPath } from "url" + +// mimic CommonJS variables -- not needed if using CommonJS +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(__filename) + +const compat = new FlatCompat({ + baseDirectory: __dirname +}) + +export default [ + // mimic ESLintRC-style extends + ...compat.extends('plugin:financial/recommended'), +] +``` + ## Contributing 1. Fork it! From 03afa323aa224aefe819ac08758b33bfbf8f640e Mon Sep 17 00:00:00 2001 From: Cloyd Lau <31238760+cloydlau@users.noreply.github.com> Date: Wed, 18 Dec 2024 21:33:20 +0800 Subject: [PATCH 2/2] docs: describe how to configure via Flat Config --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 30535aa..753211b 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Configure it in `.eslintrc`: } ``` -### Flat Config (ESLint v9 default) +### Flat Config (ESLint ≥v9 default) ```js // eslint.config.js @@ -76,7 +76,7 @@ const __filename = fileURLToPath(import.meta.url) const __dirname = path.dirname(__filename) const compat = new FlatCompat({ - baseDirectory: __dirname + baseDirectory: __dirname }) export default [