Add components

This commit is contained in:
2025-09-29 11:24:36 +02:00
parent 6d1050c6cb
commit 620d4144b5
3748 changed files with 902194 additions and 0 deletions

201
slider/node_modules/@eslint/config-helpers/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

97
slider/node_modules/@eslint/config-helpers/README.md generated vendored Normal file
View File

@@ -0,0 +1,97 @@
# @eslint/config-helpers
## Description
Helper utilities for creating ESLint configuration.
## Installation
For Node.js and compatible runtimes:
```shell
npm install @eslint/config-helpers
# or
yarn add @eslint/config-helpers
# or
pnpm install @eslint/config-helpers
# or
bun add @eslint/config-helpers
```
For Deno:
```shell
deno add @eslint/config-helpers
```
## Usage
### `defineConfig()`
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: {
semi: "error",
"prefer-const": "error",
},
},
{
files: ["test/**/*.js"],
rules: {
"no-console": "off",
},
},
]);
```
### `globalIgnores()`
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: {
semi: "error",
"prefer-const": "error",
},
},
globalIgnores(["node_modules/", "dist/", "coverage/"]),
]);
```
## License
Apache 2.0
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
<!--sponsorsstart-->
## Sponsors
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
<h3>Platinum Sponsors</h3>
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
<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://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" 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>
<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://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" 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://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
<h3>Technology Sponsors</h3>
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
<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>
<!--sponsorsend-->

View File

@@ -0,0 +1,581 @@
'use strict';
/**
* @fileoverview defineConfig helper
* @author Nicholas C. Zakas
*/
//-----------------------------------------------------------------------------
// Type Definitions
//-----------------------------------------------------------------------------
/** @typedef {import("eslint").Linter.Config} Config */
/** @typedef {import("eslint").Linter.LegacyConfig} LegacyConfig */
/** @typedef {import("eslint").ESLint.Plugin} Plugin */
/** @typedef {import("eslint").Linter.RuleEntry} RuleEntry */
/** @typedef {import("./types.ts").ExtendsElement} ExtendsElement */
/** @typedef {import("./types.ts").SimpleExtendsElement} SimpleExtendsElement */
/** @typedef {import("./types.ts").ConfigWithExtends} ConfigWithExtends */
/** @typedef {import("./types.ts").InfiniteArray<Config>} InfiniteConfigArray */
/** @typedef {import("./types.ts").ConfigWithExtendsArray} ConfigWithExtendsArray */
//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------
const eslintrcKeys = [
"env",
"extends",
"globals",
"ignorePatterns",
"noInlineConfig",
"overrides",
"parser",
"parserOptions",
"reportUnusedDisableDirectives",
"root",
];
const allowedGlobalIgnoreKeys = new Set(["basePath", "ignores", "name"]);
/**
* Gets the name of a config object.
* @param {Config} config The config object.
* @param {string} indexPath The index path of the config object.
* @return {string} The name of the config object.
*/
function getConfigName(config, indexPath) {
if (config.name) {
return config.name;
}
return `UserConfig${indexPath}`;
}
/**
* Gets the name of an extension.
* @param {SimpleExtendsElement} extension The extension.
* @param {string} indexPath The index of the extension.
* @return {string} The name of the extension.
*/
function getExtensionName(extension, indexPath) {
if (typeof extension === "string") {
return extension;
}
if (extension.name) {
return extension.name;
}
return `ExtendedConfig${indexPath}`;
}
/**
* Determines if a config object is a legacy config.
* @param {Config|LegacyConfig} config The config object to check.
* @return {config is LegacyConfig} `true` if the config object is a legacy config.
*/
function isLegacyConfig(config) {
for (const key of eslintrcKeys) {
if (key in config) {
return true;
}
}
return false;
}
/**
* Determines if a config object is a global ignores config.
* @param {Config} config The config object to check.
* @return {boolean} `true` if the config object is a global ignores config.
*/
function isGlobalIgnores(config) {
return Object.keys(config).every(key => allowedGlobalIgnoreKeys.has(key));
}
/**
* Parses a plugin member ID (rule, processor, etc.) and returns
* the namespace and member name.
* @param {string} id The ID to parse.
* @returns {{namespace:string, name:string}} The namespace and member name.
*/
function getPluginMember(id) {
const firstSlashIndex = id.indexOf("/");
if (firstSlashIndex === -1) {
return { namespace: "", name: id };
}
let namespace = id.slice(0, firstSlashIndex);
/*
* Special cases:
* 1. The namespace is `@`, that means it's referring to the
* core plugin so `@` is the full namespace.
* 2. The namespace starts with `@`, that means it's referring to
* an npm scoped package. That means the namespace is the scope
* and the package name (i.e., `@eslint/core`).
*/
if (namespace[0] === "@" && namespace !== "@") {
const secondSlashIndex = id.indexOf("/", firstSlashIndex + 1);
if (secondSlashIndex !== -1) {
namespace = id.slice(0, secondSlashIndex);
return { namespace, name: id.slice(secondSlashIndex + 1) };
}
}
const name = id.slice(firstSlashIndex + 1);
return { namespace, name };
}
/**
* Normalizes the plugin config by replacing the namespace with the plugin namespace.
* @param {string} userNamespace The namespace of the plugin.
* @param {Plugin} plugin The plugin config object.
* @param {Config} config The config object to normalize.
* @return {Config} The normalized config object.
*/
function normalizePluginConfig(userNamespace, plugin, config) {
const pluginNamespace = plugin.meta?.namespace;
// don't do anything if the plugin doesn't have a namespace or rules
if (
!pluginNamespace ||
pluginNamespace === userNamespace ||
(!config.rules && !config.processor && !config.language)
) {
return config;
}
const result = { ...config };
// update the rules
if (result.rules) {
const ruleIds = Object.keys(result.rules);
/** @type {Record<string,RuleEntry|undefined>} */
const newRules = {};
for (let i = 0; i < ruleIds.length; i++) {
const ruleId = ruleIds[i];
const { namespace: ruleNamespace, name: ruleName } =
getPluginMember(ruleId);
if (ruleNamespace === pluginNamespace) {
newRules[`${userNamespace}/${ruleName}`] = result.rules[ruleId];
} else {
newRules[ruleId] = result.rules[ruleId];
}
}
result.rules = newRules;
}
// update the processor
if (typeof result.processor === "string") {
const { namespace: processorNamespace, name: processorName } =
getPluginMember(result.processor);
if (processorNamespace) {
if (processorNamespace === pluginNamespace) {
result.processor = `${userNamespace}/${processorName}`;
}
}
}
// update the language
if (typeof result.language === "string") {
const { namespace: languageNamespace, name: languageName } =
getPluginMember(result.language);
if (languageNamespace === pluginNamespace) {
result.language = `${userNamespace}/${languageName}`;
}
}
return result;
}
/**
* Deeply normalizes a plugin config, traversing recursively into an arrays.
* @param {string} userPluginNamespace The namespace of the plugin.
* @param {Plugin} plugin The plugin object.
* @param {Config|LegacyConfig|(Config|LegacyConfig)[]} pluginConfig The plugin config to normalize.
* @param {string} pluginConfigName The name of the plugin config.
* @return {InfiniteConfigArray} The normalized plugin config.
* @throws {TypeError} If the plugin config is a legacy config.
*/
function deepNormalizePluginConfig(
userPluginNamespace,
plugin,
pluginConfig,
pluginConfigName,
) {
// if it's an array then it's definitely a new config
if (Array.isArray(pluginConfig)) {
return pluginConfig.map(pluginSubConfig =>
deepNormalizePluginConfig(
userPluginNamespace,
plugin,
pluginSubConfig,
pluginConfigName,
),
);
}
// if it's a legacy config, throw an error
if (isLegacyConfig(pluginConfig)) {
throw new TypeError(
`Plugin config "${pluginConfigName}" is an eslintrc config and cannot be used in this context.`,
);
}
return normalizePluginConfig(userPluginNamespace, plugin, pluginConfig);
}
/**
* Finds a plugin config by name in the given config.
* @param {Config} config The config object.
* @param {string} pluginConfigName The name of the plugin config.
* @return {InfiniteConfigArray} The plugin config.
* @throws {TypeError} If the plugin config is not found or is a legacy config.
*/
function findPluginConfig(config, pluginConfigName) {
const { namespace: userPluginNamespace, name: configName } =
getPluginMember(pluginConfigName);
const plugin = config.plugins?.[userPluginNamespace];
if (!plugin) {
throw new TypeError(`Plugin "${userPluginNamespace}" not found.`);
}
const directConfig = plugin.configs?.[configName];
if (directConfig) {
// Arrays are always flat configs, and non-legacy configs can be used directly
if (Array.isArray(directConfig) || !isLegacyConfig(directConfig)) {
return deepNormalizePluginConfig(
userPluginNamespace,
plugin,
directConfig,
pluginConfigName,
);
}
// If it's a legacy config, look for the flat version
const flatConfig = plugin.configs?.[`flat/${configName}`];
if (
flatConfig &&
(Array.isArray(flatConfig) || !isLegacyConfig(flatConfig))
) {
return deepNormalizePluginConfig(
userPluginNamespace,
plugin,
flatConfig,
pluginConfigName,
);
}
throw new TypeError(
`Plugin config "${configName}" in plugin "${userPluginNamespace}" is an eslintrc config and cannot be used in this context.`,
);
}
throw new TypeError(
`Plugin config "${configName}" not found in plugin "${userPluginNamespace}".`,
);
}
/**
* Flattens an array while keeping track of the index path.
* @param {any[]} configList The array to traverse.
* @param {string} indexPath The index path of the value in a multidimensional array.
* @return {IterableIterator<{indexPath:string, value:any}>} The flattened list of values.
*/
function* flatTraverse(configList, indexPath = "") {
for (let i = 0; i < configList.length; i++) {
const newIndexPath = indexPath ? `${indexPath}[${i}]` : `[${i}]`;
// if it's an array then traverse it as well
if (Array.isArray(configList[i])) {
yield* flatTraverse(configList[i], newIndexPath);
continue;
}
yield { indexPath: newIndexPath, value: configList[i] };
}
}
/**
* Extends a list of config files by creating every combination of base and extension files.
* @param {(string|string[])[]} [baseFiles] The base files.
* @param {(string|string[])[]} [extensionFiles] The extension files.
* @return {(string|string[])[]} The extended files.
*/
function extendConfigFiles(baseFiles = [], extensionFiles = []) {
if (!extensionFiles.length) {
return baseFiles.concat();
}
if (!baseFiles.length) {
return extensionFiles.concat();
}
/** @type {(string|string[])[]} */
const result = [];
for (const baseFile of baseFiles) {
for (const extensionFile of extensionFiles) {
/*
* Each entry can be a string or array of strings. The end result
* needs to be an array of strings, so we need to be sure to include
* all of the items when there's an array.
*/
const entry = [];
if (Array.isArray(baseFile)) {
entry.push(...baseFile);
} else {
entry.push(baseFile);
}
if (Array.isArray(extensionFile)) {
entry.push(...extensionFile);
} else {
entry.push(extensionFile);
}
result.push(entry);
}
}
return result;
}
/**
* Extends a config object with another config object.
* @param {Config} baseConfig The base config object.
* @param {string} baseConfigName The name of the base config object.
* @param {Config} extension The extension config object.
* @param {string} extensionName The index of the extension config object.
* @return {Config} The extended config object.
*/
function extendConfig(baseConfig, baseConfigName, extension, extensionName) {
const result = { ...extension };
// for global ignores there is no further work to be done, we just keep everything
if (!isGlobalIgnores(extension)) {
// for files we need to create every combination of base and extension files
if (baseConfig.files) {
result.files = extendConfigFiles(baseConfig.files, extension.files);
}
// for ignores we just concatenation the extension ignores onto the base ignores
if (baseConfig.ignores) {
result.ignores = baseConfig.ignores.concat(extension.ignores ?? []);
}
}
result.name = `${baseConfigName} > ${extensionName}`;
// @ts-ignore -- ESLint types aren't updated yet
if (baseConfig.basePath) {
// @ts-ignore -- ESLint types aren't updated yet
result.basePath = baseConfig.basePath;
}
return result;
}
/**
* Processes a list of extends elements.
* @param {ConfigWithExtends} config The config object.
* @param {WeakMap<Config, string>} configNames The map of config objects to their names.
* @return {Config[]} The flattened list of config objects.
* @throws {TypeError} If the `extends` property is not an array or if nested `extends` is found.
*/
function processExtends(config, configNames) {
if (!config.extends) {
return [config];
}
if (!Array.isArray(config.extends)) {
throw new TypeError("The `extends` property must be an array.");
}
const {
/** @type {Config[]} */
extends: extendsList,
/** @type {Config} */
...configObject
} = config;
const extensionNames = new WeakMap();
// replace strings with the actual configs
const objectExtends = extendsList.map(extendsElement => {
if (typeof extendsElement === "string") {
const pluginConfig = findPluginConfig(config, extendsElement);
// assign names
if (Array.isArray(pluginConfig)) {
pluginConfig.forEach((pluginConfigElement, index) => {
extensionNames.set(
pluginConfigElement,
`${extendsElement}[${index}]`,
);
});
} else {
extensionNames.set(pluginConfig, extendsElement);
}
return pluginConfig;
}
return /** @type {Config} */ (extendsElement);
});
const result = [];
for (const { indexPath, value: extendsElement } of flatTraverse(
objectExtends,
)) {
const extension = /** @type {Config} */ (extendsElement);
if ("basePath" in extension) {
throw new TypeError("'basePath' in `extends` is not allowed.");
}
if ("extends" in extension) {
throw new TypeError("Nested 'extends' is not allowed.");
}
const baseConfigName = /** @type {string} */ (configNames.get(config));
const extensionName =
extensionNames.get(extendsElement) ??
getExtensionName(extendsElement, indexPath);
result.push(
extendConfig(
configObject,
baseConfigName,
extension,
extensionName,
),
);
}
/*
* If the base config object has only `ignores` and `extends`, then
* removing `extends` turns it into a global ignores, which is not what
* we want. So we need to check if the base config object is a global ignores
* and if so, we don't add it to the array.
*
* (The other option would be to add a `files` entry, but that would result
* in a config that didn't actually do anything because there are no
* other keys in the config.)
*/
if (!isGlobalIgnores(configObject)) {
result.push(configObject);
}
return result.flat();
}
/**
* Processes a list of config objects and arrays.
* @param {ConfigWithExtends[]} configList The list of config objects and arrays.
* @param {WeakMap<Config, string>} configNames The map of config objects to their names.
* @return {Config[]} The flattened list of config objects.
*/
function processConfigList(configList, configNames) {
return configList.flatMap(config => processExtends(config, configNames));
}
//-----------------------------------------------------------------------------
// Exports
//-----------------------------------------------------------------------------
/**
* Helper function to define a config array.
* @param {ConfigWithExtendsArray} args The arguments to the function.
* @returns {Config[]} The config array.
* @throws {TypeError} If no arguments are provided or if an argument is not an object.
*/
function defineConfig(...args) {
const configNames = new WeakMap();
const configs = [];
if (args.length === 0) {
throw new TypeError("Expected one or more arguments.");
}
// first flatten the list of configs and get the names
for (const { indexPath, value } of flatTraverse(args)) {
if (typeof value !== "object" || value === null) {
throw new TypeError(
`Expected an object but received ${String(value)}.`,
);
}
const config = /** @type {ConfigWithExtends} */ (value);
// save config name for easy reference later
configNames.set(config, getConfigName(config, indexPath));
configs.push(config);
}
return processConfigList(configs, configNames);
}
/**
* @fileoverview Global ignores helper function.
* @author Nicholas C. Zakas
*/
//-----------------------------------------------------------------------------
// Type Definitions
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------
let globalIgnoreCount = 0;
//-----------------------------------------------------------------------------
// Exports
//-----------------------------------------------------------------------------
/**
* Creates a global ignores config with the given patterns.
* @param {string[]} ignorePatterns The ignore patterns.
* @param {string} [name] The name of the global ignores config.
* @returns {Config} The global ignores config.
* @throws {TypeError} If ignorePatterns is not an array or if it is empty.
*/
function globalIgnores(ignorePatterns, name) {
if (!Array.isArray(ignorePatterns)) {
throw new TypeError("ignorePatterns must be an array");
}
if (ignorePatterns.length === 0) {
throw new TypeError("ignorePatterns must contain at least one pattern");
}
const id = globalIgnoreCount++;
return {
name: name || `globalIgnores ${id}`,
ignores: ignorePatterns,
};
}
exports.defineConfig = defineConfig;
exports.globalIgnores = globalIgnores;

View File

@@ -0,0 +1,24 @@
export type Config = import("eslint").Linter.Config;
export type LegacyConfig = import("eslint").Linter.LegacyConfig;
export type Plugin = import("eslint").ESLint.Plugin;
export type RuleEntry = import("eslint").Linter.RuleEntry;
export type ExtendsElement = import("./types.cts").ExtendsElement;
export type SimpleExtendsElement = import("./types.cts").SimpleExtendsElement;
export type ConfigWithExtends = import("./types.cts").ConfigWithExtends;
export type InfiniteConfigArray = import("./types.cts").InfiniteArray<Config>;
export type ConfigWithExtendsArray = import("./types.cts").ConfigWithExtendsArray;
/**
* Helper function to define a config array.
* @param {ConfigWithExtendsArray} args The arguments to the function.
* @returns {Config[]} The config array.
* @throws {TypeError} If no arguments are provided or if an argument is not an object.
*/
export function defineConfig(...args: ConfigWithExtendsArray): Config[];
/**
* Creates a global ignores config with the given patterns.
* @param {string[]} ignorePatterns The ignore patterns.
* @param {string} [name] The name of the global ignores config.
* @returns {Config} The global ignores config.
* @throws {TypeError} If ignorePatterns is not an array or if it is empty.
*/
export function globalIgnores(ignorePatterns: string[], name?: string): Config;

View File

@@ -0,0 +1,31 @@
/**
* @fileoverview Types for this package.
*/
import type { Linter } from "eslint";
/**
* Infinite array type.
*/
export type InfiniteArray<T> = T | InfiniteArray<T>[];
/**
* The type of array element in the `extends` property after flattening.
*/
export type SimpleExtendsElement = string | Linter.Config;
/**
* The type of array element in the `extends` property before flattening.
*/
export type ExtendsElement =
| SimpleExtendsElement
| InfiniteArray<Linter.Config>;
/**
* Config with extends. Valid only inside of `defineConfig()`.
*/
export interface ConfigWithExtends extends Linter.Config {
extends?: ExtendsElement[];
}
export type ConfigWithExtendsArray = InfiniteArray<ConfigWithExtends>[];

View File

@@ -0,0 +1,24 @@
export type Config = import("eslint").Linter.Config;
export type LegacyConfig = import("eslint").Linter.LegacyConfig;
export type Plugin = import("eslint").ESLint.Plugin;
export type RuleEntry = import("eslint").Linter.RuleEntry;
export type ExtendsElement = import("./types.ts").ExtendsElement;
export type SimpleExtendsElement = import("./types.ts").SimpleExtendsElement;
export type ConfigWithExtends = import("./types.ts").ConfigWithExtends;
export type InfiniteConfigArray = import("./types.ts").InfiniteArray<Config>;
export type ConfigWithExtendsArray = import("./types.ts").ConfigWithExtendsArray;
/**
* Helper function to define a config array.
* @param {ConfigWithExtendsArray} args The arguments to the function.
* @returns {Config[]} The config array.
* @throws {TypeError} If no arguments are provided or if an argument is not an object.
*/
export function defineConfig(...args: ConfigWithExtendsArray): Config[];
/**
* Creates a global ignores config with the given patterns.
* @param {string[]} ignorePatterns The ignore patterns.
* @param {string} [name] The name of the global ignores config.
* @returns {Config} The global ignores config.
* @throws {TypeError} If ignorePatterns is not an array or if it is empty.
*/
export function globalIgnores(ignorePatterns: string[], name?: string): Config;

View File

@@ -0,0 +1,579 @@
// @ts-self-types="./index.d.ts"
/**
* @fileoverview defineConfig helper
* @author Nicholas C. Zakas
*/
//-----------------------------------------------------------------------------
// Type Definitions
//-----------------------------------------------------------------------------
/** @typedef {import("eslint").Linter.Config} Config */
/** @typedef {import("eslint").Linter.LegacyConfig} LegacyConfig */
/** @typedef {import("eslint").ESLint.Plugin} Plugin */
/** @typedef {import("eslint").Linter.RuleEntry} RuleEntry */
/** @typedef {import("./types.ts").ExtendsElement} ExtendsElement */
/** @typedef {import("./types.ts").SimpleExtendsElement} SimpleExtendsElement */
/** @typedef {import("./types.ts").ConfigWithExtends} ConfigWithExtends */
/** @typedef {import("./types.ts").InfiniteArray<Config>} InfiniteConfigArray */
/** @typedef {import("./types.ts").ConfigWithExtendsArray} ConfigWithExtendsArray */
//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------
const eslintrcKeys = [
"env",
"extends",
"globals",
"ignorePatterns",
"noInlineConfig",
"overrides",
"parser",
"parserOptions",
"reportUnusedDisableDirectives",
"root",
];
const allowedGlobalIgnoreKeys = new Set(["basePath", "ignores", "name"]);
/**
* Gets the name of a config object.
* @param {Config} config The config object.
* @param {string} indexPath The index path of the config object.
* @return {string} The name of the config object.
*/
function getConfigName(config, indexPath) {
if (config.name) {
return config.name;
}
return `UserConfig${indexPath}`;
}
/**
* Gets the name of an extension.
* @param {SimpleExtendsElement} extension The extension.
* @param {string} indexPath The index of the extension.
* @return {string} The name of the extension.
*/
function getExtensionName(extension, indexPath) {
if (typeof extension === "string") {
return extension;
}
if (extension.name) {
return extension.name;
}
return `ExtendedConfig${indexPath}`;
}
/**
* Determines if a config object is a legacy config.
* @param {Config|LegacyConfig} config The config object to check.
* @return {config is LegacyConfig} `true` if the config object is a legacy config.
*/
function isLegacyConfig(config) {
for (const key of eslintrcKeys) {
if (key in config) {
return true;
}
}
return false;
}
/**
* Determines if a config object is a global ignores config.
* @param {Config} config The config object to check.
* @return {boolean} `true` if the config object is a global ignores config.
*/
function isGlobalIgnores(config) {
return Object.keys(config).every(key => allowedGlobalIgnoreKeys.has(key));
}
/**
* Parses a plugin member ID (rule, processor, etc.) and returns
* the namespace and member name.
* @param {string} id The ID to parse.
* @returns {{namespace:string, name:string}} The namespace and member name.
*/
function getPluginMember(id) {
const firstSlashIndex = id.indexOf("/");
if (firstSlashIndex === -1) {
return { namespace: "", name: id };
}
let namespace = id.slice(0, firstSlashIndex);
/*
* Special cases:
* 1. The namespace is `@`, that means it's referring to the
* core plugin so `@` is the full namespace.
* 2. The namespace starts with `@`, that means it's referring to
* an npm scoped package. That means the namespace is the scope
* and the package name (i.e., `@eslint/core`).
*/
if (namespace[0] === "@" && namespace !== "@") {
const secondSlashIndex = id.indexOf("/", firstSlashIndex + 1);
if (secondSlashIndex !== -1) {
namespace = id.slice(0, secondSlashIndex);
return { namespace, name: id.slice(secondSlashIndex + 1) };
}
}
const name = id.slice(firstSlashIndex + 1);
return { namespace, name };
}
/**
* Normalizes the plugin config by replacing the namespace with the plugin namespace.
* @param {string} userNamespace The namespace of the plugin.
* @param {Plugin} plugin The plugin config object.
* @param {Config} config The config object to normalize.
* @return {Config} The normalized config object.
*/
function normalizePluginConfig(userNamespace, plugin, config) {
const pluginNamespace = plugin.meta?.namespace;
// don't do anything if the plugin doesn't have a namespace or rules
if (
!pluginNamespace ||
pluginNamespace === userNamespace ||
(!config.rules && !config.processor && !config.language)
) {
return config;
}
const result = { ...config };
// update the rules
if (result.rules) {
const ruleIds = Object.keys(result.rules);
/** @type {Record<string,RuleEntry|undefined>} */
const newRules = {};
for (let i = 0; i < ruleIds.length; i++) {
const ruleId = ruleIds[i];
const { namespace: ruleNamespace, name: ruleName } =
getPluginMember(ruleId);
if (ruleNamespace === pluginNamespace) {
newRules[`${userNamespace}/${ruleName}`] = result.rules[ruleId];
} else {
newRules[ruleId] = result.rules[ruleId];
}
}
result.rules = newRules;
}
// update the processor
if (typeof result.processor === "string") {
const { namespace: processorNamespace, name: processorName } =
getPluginMember(result.processor);
if (processorNamespace) {
if (processorNamespace === pluginNamespace) {
result.processor = `${userNamespace}/${processorName}`;
}
}
}
// update the language
if (typeof result.language === "string") {
const { namespace: languageNamespace, name: languageName } =
getPluginMember(result.language);
if (languageNamespace === pluginNamespace) {
result.language = `${userNamespace}/${languageName}`;
}
}
return result;
}
/**
* Deeply normalizes a plugin config, traversing recursively into an arrays.
* @param {string} userPluginNamespace The namespace of the plugin.
* @param {Plugin} plugin The plugin object.
* @param {Config|LegacyConfig|(Config|LegacyConfig)[]} pluginConfig The plugin config to normalize.
* @param {string} pluginConfigName The name of the plugin config.
* @return {InfiniteConfigArray} The normalized plugin config.
* @throws {TypeError} If the plugin config is a legacy config.
*/
function deepNormalizePluginConfig(
userPluginNamespace,
plugin,
pluginConfig,
pluginConfigName,
) {
// if it's an array then it's definitely a new config
if (Array.isArray(pluginConfig)) {
return pluginConfig.map(pluginSubConfig =>
deepNormalizePluginConfig(
userPluginNamespace,
plugin,
pluginSubConfig,
pluginConfigName,
),
);
}
// if it's a legacy config, throw an error
if (isLegacyConfig(pluginConfig)) {
throw new TypeError(
`Plugin config "${pluginConfigName}" is an eslintrc config and cannot be used in this context.`,
);
}
return normalizePluginConfig(userPluginNamespace, plugin, pluginConfig);
}
/**
* Finds a plugin config by name in the given config.
* @param {Config} config The config object.
* @param {string} pluginConfigName The name of the plugin config.
* @return {InfiniteConfigArray} The plugin config.
* @throws {TypeError} If the plugin config is not found or is a legacy config.
*/
function findPluginConfig(config, pluginConfigName) {
const { namespace: userPluginNamespace, name: configName } =
getPluginMember(pluginConfigName);
const plugin = config.plugins?.[userPluginNamespace];
if (!plugin) {
throw new TypeError(`Plugin "${userPluginNamespace}" not found.`);
}
const directConfig = plugin.configs?.[configName];
if (directConfig) {
// Arrays are always flat configs, and non-legacy configs can be used directly
if (Array.isArray(directConfig) || !isLegacyConfig(directConfig)) {
return deepNormalizePluginConfig(
userPluginNamespace,
plugin,
directConfig,
pluginConfigName,
);
}
// If it's a legacy config, look for the flat version
const flatConfig = plugin.configs?.[`flat/${configName}`];
if (
flatConfig &&
(Array.isArray(flatConfig) || !isLegacyConfig(flatConfig))
) {
return deepNormalizePluginConfig(
userPluginNamespace,
plugin,
flatConfig,
pluginConfigName,
);
}
throw new TypeError(
`Plugin config "${configName}" in plugin "${userPluginNamespace}" is an eslintrc config and cannot be used in this context.`,
);
}
throw new TypeError(
`Plugin config "${configName}" not found in plugin "${userPluginNamespace}".`,
);
}
/**
* Flattens an array while keeping track of the index path.
* @param {any[]} configList The array to traverse.
* @param {string} indexPath The index path of the value in a multidimensional array.
* @return {IterableIterator<{indexPath:string, value:any}>} The flattened list of values.
*/
function* flatTraverse(configList, indexPath = "") {
for (let i = 0; i < configList.length; i++) {
const newIndexPath = indexPath ? `${indexPath}[${i}]` : `[${i}]`;
// if it's an array then traverse it as well
if (Array.isArray(configList[i])) {
yield* flatTraverse(configList[i], newIndexPath);
continue;
}
yield { indexPath: newIndexPath, value: configList[i] };
}
}
/**
* Extends a list of config files by creating every combination of base and extension files.
* @param {(string|string[])[]} [baseFiles] The base files.
* @param {(string|string[])[]} [extensionFiles] The extension files.
* @return {(string|string[])[]} The extended files.
*/
function extendConfigFiles(baseFiles = [], extensionFiles = []) {
if (!extensionFiles.length) {
return baseFiles.concat();
}
if (!baseFiles.length) {
return extensionFiles.concat();
}
/** @type {(string|string[])[]} */
const result = [];
for (const baseFile of baseFiles) {
for (const extensionFile of extensionFiles) {
/*
* Each entry can be a string or array of strings. The end result
* needs to be an array of strings, so we need to be sure to include
* all of the items when there's an array.
*/
const entry = [];
if (Array.isArray(baseFile)) {
entry.push(...baseFile);
} else {
entry.push(baseFile);
}
if (Array.isArray(extensionFile)) {
entry.push(...extensionFile);
} else {
entry.push(extensionFile);
}
result.push(entry);
}
}
return result;
}
/**
* Extends a config object with another config object.
* @param {Config} baseConfig The base config object.
* @param {string} baseConfigName The name of the base config object.
* @param {Config} extension The extension config object.
* @param {string} extensionName The index of the extension config object.
* @return {Config} The extended config object.
*/
function extendConfig(baseConfig, baseConfigName, extension, extensionName) {
const result = { ...extension };
// for global ignores there is no further work to be done, we just keep everything
if (!isGlobalIgnores(extension)) {
// for files we need to create every combination of base and extension files
if (baseConfig.files) {
result.files = extendConfigFiles(baseConfig.files, extension.files);
}
// for ignores we just concatenation the extension ignores onto the base ignores
if (baseConfig.ignores) {
result.ignores = baseConfig.ignores.concat(extension.ignores ?? []);
}
}
result.name = `${baseConfigName} > ${extensionName}`;
// @ts-ignore -- ESLint types aren't updated yet
if (baseConfig.basePath) {
// @ts-ignore -- ESLint types aren't updated yet
result.basePath = baseConfig.basePath;
}
return result;
}
/**
* Processes a list of extends elements.
* @param {ConfigWithExtends} config The config object.
* @param {WeakMap<Config, string>} configNames The map of config objects to their names.
* @return {Config[]} The flattened list of config objects.
* @throws {TypeError} If the `extends` property is not an array or if nested `extends` is found.
*/
function processExtends(config, configNames) {
if (!config.extends) {
return [config];
}
if (!Array.isArray(config.extends)) {
throw new TypeError("The `extends` property must be an array.");
}
const {
/** @type {Config[]} */
extends: extendsList,
/** @type {Config} */
...configObject
} = config;
const extensionNames = new WeakMap();
// replace strings with the actual configs
const objectExtends = extendsList.map(extendsElement => {
if (typeof extendsElement === "string") {
const pluginConfig = findPluginConfig(config, extendsElement);
// assign names
if (Array.isArray(pluginConfig)) {
pluginConfig.forEach((pluginConfigElement, index) => {
extensionNames.set(
pluginConfigElement,
`${extendsElement}[${index}]`,
);
});
} else {
extensionNames.set(pluginConfig, extendsElement);
}
return pluginConfig;
}
return /** @type {Config} */ (extendsElement);
});
const result = [];
for (const { indexPath, value: extendsElement } of flatTraverse(
objectExtends,
)) {
const extension = /** @type {Config} */ (extendsElement);
if ("basePath" in extension) {
throw new TypeError("'basePath' in `extends` is not allowed.");
}
if ("extends" in extension) {
throw new TypeError("Nested 'extends' is not allowed.");
}
const baseConfigName = /** @type {string} */ (configNames.get(config));
const extensionName =
extensionNames.get(extendsElement) ??
getExtensionName(extendsElement, indexPath);
result.push(
extendConfig(
configObject,
baseConfigName,
extension,
extensionName,
),
);
}
/*
* If the base config object has only `ignores` and `extends`, then
* removing `extends` turns it into a global ignores, which is not what
* we want. So we need to check if the base config object is a global ignores
* and if so, we don't add it to the array.
*
* (The other option would be to add a `files` entry, but that would result
* in a config that didn't actually do anything because there are no
* other keys in the config.)
*/
if (!isGlobalIgnores(configObject)) {
result.push(configObject);
}
return result.flat();
}
/**
* Processes a list of config objects and arrays.
* @param {ConfigWithExtends[]} configList The list of config objects and arrays.
* @param {WeakMap<Config, string>} configNames The map of config objects to their names.
* @return {Config[]} The flattened list of config objects.
*/
function processConfigList(configList, configNames) {
return configList.flatMap(config => processExtends(config, configNames));
}
//-----------------------------------------------------------------------------
// Exports
//-----------------------------------------------------------------------------
/**
* Helper function to define a config array.
* @param {ConfigWithExtendsArray} args The arguments to the function.
* @returns {Config[]} The config array.
* @throws {TypeError} If no arguments are provided or if an argument is not an object.
*/
function defineConfig(...args) {
const configNames = new WeakMap();
const configs = [];
if (args.length === 0) {
throw new TypeError("Expected one or more arguments.");
}
// first flatten the list of configs and get the names
for (const { indexPath, value } of flatTraverse(args)) {
if (typeof value !== "object" || value === null) {
throw new TypeError(
`Expected an object but received ${String(value)}.`,
);
}
const config = /** @type {ConfigWithExtends} */ (value);
// save config name for easy reference later
configNames.set(config, getConfigName(config, indexPath));
configs.push(config);
}
return processConfigList(configs, configNames);
}
/**
* @fileoverview Global ignores helper function.
* @author Nicholas C. Zakas
*/
//-----------------------------------------------------------------------------
// Type Definitions
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------
let globalIgnoreCount = 0;
//-----------------------------------------------------------------------------
// Exports
//-----------------------------------------------------------------------------
/**
* Creates a global ignores config with the given patterns.
* @param {string[]} ignorePatterns The ignore patterns.
* @param {string} [name] The name of the global ignores config.
* @returns {Config} The global ignores config.
* @throws {TypeError} If ignorePatterns is not an array or if it is empty.
*/
function globalIgnores(ignorePatterns, name) {
if (!Array.isArray(ignorePatterns)) {
throw new TypeError("ignorePatterns must be an array");
}
if (ignorePatterns.length === 0) {
throw new TypeError("ignorePatterns must contain at least one pattern");
}
const id = globalIgnoreCount++;
return {
name: name || `globalIgnores ${id}`,
ignores: ignorePatterns,
};
}
export { defineConfig, globalIgnores };

View File

@@ -0,0 +1,23 @@
/**
* @fileoverview Types for this package.
*/
import type { Linter } from "eslint";
/**
* Infinite array type.
*/
export type InfiniteArray<T> = T | InfiniteArray<T>[];
/**
* The type of array element in the `extends` property after flattening.
*/
export type SimpleExtendsElement = string | Linter.Config;
/**
* The type of array element in the `extends` property before flattening.
*/
export type ExtendsElement = SimpleExtendsElement | InfiniteArray<Linter.Config>;
/**
* Config with extends. Valid only inside of `defineConfig()`.
*/
export interface ConfigWithExtends extends Linter.Config {
extends?: ExtendsElement[];
}
export type ConfigWithExtendsArray = InfiniteArray<ConfigWithExtends>[];

View File

@@ -0,0 +1,31 @@
/**
* @fileoverview Types for this package.
*/
import type { Linter } from "eslint";
/**
* Infinite array type.
*/
export type InfiniteArray<T> = T | InfiniteArray<T>[];
/**
* The type of array element in the `extends` property after flattening.
*/
export type SimpleExtendsElement = string | Linter.Config;
/**
* The type of array element in the `extends` property before flattening.
*/
export type ExtendsElement =
| SimpleExtendsElement
| InfiniteArray<Linter.Config>;
/**
* Config with extends. Valid only inside of `defineConfig()`.
*/
export interface ConfigWithExtends extends Linter.Config {
extends?: ExtendsElement[];
}
export type ConfigWithExtendsArray = InfiniteArray<ConfigWithExtends>[];

View File

@@ -0,0 +1,57 @@
{
"name": "@eslint/config-helpers",
"version": "0.3.1",
"description": "Helper utilities for creating ESLint configuration",
"type": "module",
"main": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"exports": {
"require": {
"types": "./dist/cjs/index.d.cts",
"default": "./dist/cjs/index.cjs"
},
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
}
},
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"directories": {
"test": "tests"
},
"scripts": {
"build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js",
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
"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",
"test": "mocha tests/*.js",
"test:coverage": "c8 npm test",
"test:types": "tsc -p tests/types/tsconfig.json"
},
"repository": {
"type": "git",
"url": "git+https://github.com/eslint/rewrite.git",
"directory": "packages/config-helpers"
},
"keywords": [
"eslint"
],
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/eslint/rewrite/issues"
},
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/config-helpers#readme",
"devDependencies": {
"@eslint/core": "^0.15.2",
"eslint": "^9.27.0",
"rollup-plugin-copy": "^3.5.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
}