Created
May 27, 2025 16:08
-
-
Save nzakas/a7531d0c175f1b15c40f27cf8826d48e to your computer and use it in GitHub Desktop.
Using eslint-config-airbnb with ESLint v9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To install `eslint-config-airbnb`, run: | |
* npm install -D eslint-config-airbnb --force | |
* | |
* The --force flag is necessary because `eslint-config-airbnb` has a | |
* peer dependency on `eslint@^8.0.0`, which may conflict with other | |
* packages in your project. | |
* | |
* After installing, you'll need to use `npm install --force` when | |
* installing other packages to avoid conflicts with the peer dependencies. | |
*/ | |
import js from "@eslint/js"; | |
import { defineConfig } from "eslint/config"; | |
import { FlatCompat } from "@eslint/eslintrc"; | |
import { fileURLToPath } from "node:url"; | |
import path from "node:path"; | |
// 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, | |
recommendedConfig: js.configs.recommended, | |
}); | |
export default defineConfig([ | |
{ | |
files: ["**/*.{js,mjs,cjs}"], | |
extends: [compat.extends("airbnb")] | |
}, | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment