{"name":"@eslint/config-helpers","version":"0.4.0","keywords":["eslint"],"license":"Apache-2.0","_id":"@eslint/config-helpers@0.4.0","maintainers":[{"name":"openjsfoundation","email":"npm@openjsf.org"},{"name":"eslintbot","email":"contact@eslint.org"}],"homepage":"https://github.com/eslint/rewrite/tree/main/packages/config-helpers#readme","bugs":{"url":"https://github.com/eslint/rewrite/issues"},"dist":{"shasum":"e9f94ba3b5b875e32205cb83fece18e64486e9e6","tarball":"http://registry-npm.ywwl.com/@eslint/config-helpers/download/@eslint/config-helpers-0.4.0.tgz","fileCount":10,"integrity":"sha512-WUFvV4WoIwW8Bv0KeKCIIEgdSiFOsulyN0xrMu+7z43q/hkOLXjvb5u7UC9jDxvRzcrbEmuZBX5yJZz1741jog==","signatures":[{"sig":"MEUCIQD8oli95t6xd9lH0VuM0292gJWKNn4g7izIXcjtmOSRewIgXNodyL6d4NYuV0wUE/iYKR+B0L8scS1w54/9RWsllTQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@eslint%2fconfig-helpers@0.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":56668,"size":11191,"noattachment":false,"key":"/@eslint/config-helpers/-/@eslint/config-helpers-0.4.0.tgz"},"main":"dist/esm/index.js","type":"module","types":"dist/esm/index.d.ts","engines":{"node":"^18.18.0 || ^20.9.0 || >=21.1.0"},"exports":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"}},"gitHead":"7f592e3b60dd0a3b38d891a80aeeb92cf78d8e86","scripts":{"test":"mocha \"tests/**/*.test.js\"","build":"rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts","test:jsr":"npx jsr@latest publish --dry-run","build:cts":"node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts","test:types":"tsc -p tests/types/tsconfig.json","test:coverage":"c8 npm test","build:dedupe-types":"node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js"},"_npmUser":{"name":"eslintbot","email":"contact@eslint.org"},"repository":{"url":"git+https://github.com/eslint/rewrite.git","type":"git","directory":"packages/config-helpers"},"_npmVersion":"10.9.3","description":"Helper utilities for creating ESLint configuration","directories":{"test":"tests"},"_nodeVersion":"22.19.0","dependencies":{"@eslint/core":"^0.16.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.27.0","rollup-plugin-copy":"^3.5.0"},"_npmOperationalInternal":{"tmp":"tmp/config-helpers_0.4.0_1758563577750_0.830651931077441","host":"s3://npm-registry-packages-npm-production"},"readme":"# @eslint/config-helpers\n\n## Description\n\nHelper utilities for creating ESLint configuration.\n\n## Installation\n\nFor Node.js and compatible runtimes:\n\n```shell\nnpm install @eslint/config-helpers\n# or\nyarn add @eslint/config-helpers\n# or\npnpm install @eslint/config-helpers\n# or\nbun add @eslint/config-helpers\n```\n\nFor Deno:\n\n```shell\ndeno add @eslint/config-helpers\n```\n\n## Usage\n\n### `defineConfig()`\n\nThe `defineConfig()` function allows you to specify an ESLint configuration with full type checking and additional capabilities, such as `extends`. Here's an example:\n\n```js\n// eslint.config.js\nimport { defineConfig } from \"@eslint/config-helpers\";\nimport js from \"@eslint/js\";\n\nexport default defineConfig([\n\t{\n\t\tfiles: [\"src/**/*.js\"],\n\t\tplugins: { js },\n\t\textends: [\"js/recommended\"],\n\t\trules: {\n\t\t\t\"no-var\": \"error\",\n\t\t\t\"prefer-const\": \"error\",\n\t\t},\n\t},\n\t{\n\t\tfiles: [\"test/**/*.js\"],\n\t\trules: {\n\t\t\t\"no-console\": \"off\",\n\t\t},\n\t},\n]);\n```\n\n### `globalIgnores()`\n\nThe `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:\n\n```js\n// eslint.config.js\nimport { defineConfig, globalIgnores } from \"@eslint/config-helpers\";\n\nexport default defineConfig([\n\t{\n\t\tfiles: [\"src/**/*.js\"],\n\t\trules: {\n\t\t\t\"no-var\": \"error\",\n\t\t\t\"prefer-const\": \"error\",\n\t\t},\n\t},\n\tglobalIgnores([\"node_modules/\", \"dist/\", \"coverage/\"]),\n]);\n```\n\n### `includeIgnoreFile()`\n\nThe `includeIgnoreFile()` function reads a file with gitignore-style patterns (such as a `.gitignore`) and returns a config object with the patterns converted to a global ignores object. Pass the absolute path to the ignore file as the first argument:\n\n```js\n// eslint.config.js\n\nimport { defineConfig, includeIgnoreFile } from \"@eslint/config-helpers\";\nimport path from \"node:path\";\n\nconst ignorePath = path.join(import.meta.dirname, \".gitignore\");\n\nexport default defineConfig([\n\tincludeIgnoreFile(ignorePath, {\n\t\tgitignoreResolution: true,\n\t}),\n\t// ...\n]);\n```\n\n#### Options\n\nThe second argument is an optional options object:\n\n- **`gitignoreResolution`** (`boolean`): Controls how ignore patterns are interpreted.\n    - `false` (default) — patterns are resolved relative to the location of the configuration file.\n    - `true` — patterns are resolved relative to the location of the ignore file, matching the behavior of `.gitignore` files.\n- **`name`** (`string`): A custom name for the resulting config object.\n\nFor backwards compatibility with `includeIgnoreFile()` from `@eslint/compat`, passing a string instead of an object as the second argument is treated as equivalent to providing a value for `name`.\n\n#### Multiple files\n\nYou can also pass an array of absolute paths to include multiple ignore files at once. In this case an array of config objects is returned:\n\n```js\n// eslint.config.js\n\nimport { defineConfig, includeIgnoreFile } from \"@eslint/config-helpers\";\nimport path from \"node:path\";\n\nexport default defineConfig([\n\tincludeIgnoreFile(\n\t\t[\n\t\t\tpath.join(import.meta.dirname, \".gitignore\"),\n\t\t\tpath.join(import.meta.dirname, \"packages/lib/.gitignore\"),\n\t\t],\n\t\t{ gitignoreResolution: true },\n\t),\n\t// ...\n]);\n```\n\n## License\n\nApache 2.0\n\n<!-- NOTE: This section is autogenerated. Do not manually edit.-->\n<!--sponsorsstart-->\n\n## Sponsors\n\nThe following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)\nto get your logo on our READMEs and [website](https://eslint.org/sponsors).\n\n<h3>Platinum Sponsors</h3>\n<p><a href=\"https://automattic.com\"><img src=\"https://images.opencollective.com/automattic/d0ef3e1/logo.png\" alt=\"Automattic\" height=\"128\"></a></p><h3>Gold Sponsors</h3>\n<p><a href=\"https://qlty.sh/\"><img src=\"https://images.opencollective.com/qltysh/33d157d/logo.png\" alt=\"Qlty Software\" height=\"96\"></a> <a href=\"https://shopify.engineering/\"><img src=\"https://avatars.githubusercontent.com/u/8085\" alt=\"Shopify\" height=\"96\"></a> <a href=\"https://www.coderabbit.ai/?utm_source=cr_org&utm_medium=github\"><img src=\"https://avatars.githubusercontent.com/u/132028505\" alt=\"CodeRabbit\" height=\"96\"></a></p><h3>Silver Sponsors</h3>\n<p><a href=\"https://vite.dev/\"><img src=\"https://images.opencollective.com/vite/d472863/logo.png\" alt=\"Vite\" height=\"64\"></a> <a href=\"https://liftoff.io/\"><img src=\"https://images.opencollective.com/liftoff/2d6c3b6/logo.png\" alt=\"Liftoff\" height=\"64\"></a> <a href=\"https://stackblitz.com\"><img src=\"https://avatars.githubusercontent.com/u/28635252\" alt=\"StackBlitz\" height=\"64\"></a></p><h3>Bronze Sponsors</h3>\n<p><a href=\"https://cybozu.co.jp/\"><img src=\"https://images.opencollective.com/cybozu/933e46d/logo.png\" alt=\"Cybozu\" height=\"32\"></a> <a href=\"https://opensource.sap.com\"><img src=\"https://avatars.githubusercontent.com/u/2531208\" alt=\"SAP\" height=\"32\"></a> <a href=\"https://syntax.fm\"><img src=\"https://github.com/syntaxfm.png\" alt=\"Syntax\" height=\"32\"></a> <a href=\"https://icons8.com/\"><img src=\"https://images.opencollective.com/icons8/7fa1641/logo.png\" alt=\"Icons8\" height=\"32\"></a> <a href=\"https://discord.com\"><img src=\"https://images.opencollective.com/discordapp/f9645d9/logo.png\" alt=\"Discord\" height=\"32\"></a> <a href=\"https://www.gitbook.com\"><img src=\"https://avatars.githubusercontent.com/u/7111340\" alt=\"GitBook\" height=\"32\"></a> <a href=\"https://citadel-ai.com\"><img src=\"https://avatars.githubusercontent.com/u/75781367\" alt=\"Citadel AI\" height=\"32\"></a></p>\n<h3>Technology Sponsors</h3>\nTechnology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.\n<p><a href=\"https://netlify.com\"><img src=\"https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg\" alt=\"Netlify\" height=\"32\"></a> <a href=\"https://algolia.com\"><img src=\"https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg\" alt=\"Algolia\" height=\"32\"></a> <a href=\"https://1password.com\"><img src=\"https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg\" alt=\"1Password\" height=\"32\"></a></p>\n<!--sponsorsend-->\n","publish_time":1758563577949,"_cnpm_publish_time":1758563577949,"dist-tags":{"latest":"0.7.0"}}