From 17454602518a05f0601f9ccb573f32267b0bb297 Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Wed, 14 Feb 2024 13:00:20 +0100 Subject: [PATCH] chore: export `base` config from `eslint-config-eslint` --- packages/eslint-config-eslint/README.md | 22 ++++++++++++++++++++++ packages/eslint-config-eslint/package.json | 1 + 2 files changed, 23 insertions(+) diff --git a/packages/eslint-config-eslint/README.md b/packages/eslint-config-eslint/README.md index 645a1938260..f3125565c6f 100644 --- a/packages/eslint-config-eslint/README.md +++ b/packages/eslint-config-eslint/README.md @@ -51,6 +51,28 @@ module.exports = [ ]; ``` +### Base config + +Note that the above configurations are intended for files that will run in Node.js. For files that will not run in Node.js, you should use the `base` config. + +Here's an example of an `eslint.config.js` file for a website project with scripts that run in browser and CommonJS configuration files and tools that run in Node.js: + +```js +const eslintConfigESLintBase = require("eslint-config-eslint/base"); +const eslintConfigESLintCJS = require("eslint-config-eslint/cjs"); + +module.exports = [ + ...eslintConfigESLintBase.map(config => ({ + ...config, + files: ["scripts/*.js"] + })), + ...eslintConfigESLintCJS.map(config => ({ + ...config, + files: ["eslint.config.js", ".eleventy.js", "tools/*.js"] + })) +]; +``` + ### Where to ask for help? Open a [discussion](https://github.com/eslint/eslint/discussions) or stop by our [Discord server](https://eslint.org/chat) instead of filing an issue. diff --git a/packages/eslint-config-eslint/package.json b/packages/eslint-config-eslint/package.json index 64872df6be1..f3632fad9f3 100644 --- a/packages/eslint-config-eslint/package.json +++ b/packages/eslint-config-eslint/package.json @@ -6,6 +6,7 @@ "exports": { "./package.json": "./package.json", ".": "./index.js", + "./base": "./base.js", "./cjs": "./cjs.js", "./eslintrc": "./eslintrc.js" },