Helper utilities for creating ESLint configuration
npm install @eslint/config-helpersHelper utilities for creating ESLint configuration.
For Node.js and compatible runtimes:
``shell`
npm install @eslint/config-helpersor
yarn add @eslint/config-helpersor
pnpm install @eslint/config-helpersor
bun add @eslint/config-helpers
For Deno:
`shell`
deno add @eslint/config-helpers
The defineConfig() function allows you to specify an ESLint configuration with full type checking and additional capabilities, such as extends. Here's an example:
`js
// eslint.config.js
import { defineConfig } from "@eslint/config-helpers";
import js from "@eslint/js";
export default defineConfig([
{
files: ["src/*/.js"],
plugins: { js },
extends: ["js/recommended"],
rules: {
"no-var": "error",
"prefer-const": "error",
},
},
{
files: ["test/*/.js"],
rules: {
"no-console": "off",
},
},
]);
`
The globalIgnores() function allows you to specify patterns for files and directories that should be globally ignored by ESLint. This is useful for excluding files that you don't want to lint, such as build directories or third-party libraries. Here's an example:
`js
// eslint.config.js
import { defineConfig, globalIgnores } from "@eslint/config-helpers";
export default defineConfig([
{
files: ["src/*/.js"],
rules: {
"no-var": "error",
"prefer-const": "error",
},
},
globalIgnores(["node_modules/", "dist/", "coverage/"]),
]);
``
Apache 2.0
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. Become a Sponsor
to get your logo on our READMEs and website.