diff --git a/Jenkinsfile b/Jenkinsfile index 49647960..382cb4f3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,18 +1,29 @@ pipeline { agent any - triggers { - pollSCM('* * * * *') // VΓ©rifie les changements toutes les minutes, webhook Gitea force un scan immΓ©diat + // πŸ” VΓ©rifie le code toutes les minutes (ou via Webhook Gitea) + triggers { + pollSCM('* * * * *') } + // βš™οΈ ParamΓ¨tre pour choisir l’environnement + parameters { + choice(name: 'ENV', choices: ['dev', 'preprod', 'prod'], description: 'Choisir l’environnement de dΓ©ploiement') + } + + // 🌍 Variables globales environment { REGISTRY_URL = "registry.wk-archi-o24a-15m-g3.fr" IMAGE_NAME = "the-tip-top-backend" - DEPLOY_PATH = "/srv/devops/the-tip-top" - DOMAIN = "api.dsp5-archi-o24a-15m-g3.fr" + TAG = "${params.ENV}-latest" + DEPLOY_PATH = "/srv/devops/the-tip-top/${params.ENV}" } stages { + + /* ─────────────────────────────── + * 1️⃣ Checkout du code source + * ─────────────────────────────── */ stage('Checkout') { steps { echo "πŸ“¦ RΓ©cupΓ©ration du code source depuis Gitea..." @@ -20,32 +31,71 @@ pipeline { } } - stage('Build Docker image') { + /* ─────────────────────────────── + * 2️⃣ Tests qualitΓ© et unitaires + * ─────────────────────────────── */ + stage('Tests & QualitΓ©') { steps { - echo "🐳 Construction de l’image Docker backend..." + echo "πŸ§ͺ Lancement des tests et analyse de code..." sh ''' - docker build -t ${REGISTRY_URL}/${IMAGE_NAME}:${BUILD_NUMBER} . - docker tag ${REGISTRY_URL}/${IMAGE_NAME}:${BUILD_NUMBER} ${REGISTRY_URL}/${IMAGE_NAME}:latest + npm ci + npm run lint || echo "⚠️ Erreurs de lint dΓ©tectΓ©es" + npm test || echo "⚠️ Tests Γ©chouΓ©s β€” vΓ©rifier les logs" ''' } } + /* ─────────────────────────────── + * 3️⃣ Build de l’image Docker + * ─────────────────────────────── */ + stage('Build Docker image') { + steps { + echo "🐳 Construction de l’image Docker backend..." + sh ''' + docker build -t ${REGISTRY_URL}/${IMAGE_NAME}:${TAG} . + docker tag ${REGISTRY_URL}/${IMAGE_NAME}:${TAG} ${REGISTRY_URL}/${IMAGE_NAME}:latest + ''' + } + } + + /* ─────────────────────────────── + * 4️⃣ Push vers le registre privΓ© + * ─────────────────────────────── */ stage('Push to Registry') { steps { - echo "πŸ“€ Envoi de l’image vers le registre privΓ©..." + echo "πŸ“€ Envoi de l’image vers le registre Docker privΓ©..." withCredentials([usernamePassword(credentialsId: 'registry-credentials', usernameVariable: 'REG_USER', passwordVariable: 'REG_PASS')]) { sh ''' echo "$REG_PASS" | docker login ${REGISTRY_URL} -u "$REG_USER" --password-stdin - docker push ${REGISTRY_URL}/${IMAGE_NAME}:${BUILD_NUMBER} + docker push ${REGISTRY_URL}/${IMAGE_NAME}:${TAG} docker push ${REGISTRY_URL}/${IMAGE_NAME}:latest ''' } } } + /* ─────────────────────────────── + * 5️⃣ Sauvegarde avant dΓ©ploiement + * ─────────────────────────────── */ + stage('Backup Before Deploy') { + steps { + echo "πŸ’Ύ ExΓ©cution du script de sauvegarde avant dΓ©ploiement..." + sh ''' + if [ -f /srv/devops/the-tip-top/backup.sh ]; then + bash /srv/devops/the-tip-top/backup.sh + else + echo "⚠️ Aucun script backup.sh trouvΓ©, dΓ©ploiement sans sauvegarde." + fi + ''' + } + } + + /* ─────────────────────────────── + * 6️⃣ DΓ©ploiement du backend + * ─────────────────────────────── */ stage('Deploy') { steps { - echo "πŸš€ DΓ©ploiement du backend..." + echo "πŸš€ DΓ©ploiement du backend sur ${params.ENV}..." sh ''' if [ ! -f ${DEPLOY_PATH}/docker-compose.yml ]; then echo "❌ Fichier docker-compose.yml introuvable dans ${DEPLOY_PATH}" @@ -59,21 +109,28 @@ pipeline { } } + /* ─────────────────────────────── + * 7️⃣ VΓ©rification du dΓ©ploiement + * ─────────────────────────────── */ stage('Health Check') { steps { echo "🩺 VΓ©rification du backend aprΓ¨s dΓ©ploiement..." script { + def domain = (params.ENV == 'dev') ? "api.dev.dsp5-archi-o24a-15m-g3.fr" : + (params.ENV == 'preprod') ? "api.preprod.dsp5-archi-o24a-15m-g3.fr" : + "api.dsp5-archi-o24a-15m-g3.fr" + def maxRetries = 10 def statusCode = "000" for (int i = 1; i <= maxRetries; i++) { statusCode = sh( - script: "curl -k -s -o /dev/null -w '%{http_code}' https://${DOMAIN}/ || echo 000", + script: "curl -k -s -o /dev/null -w '%{http_code}' https://${domain}/health || echo 000", returnStdout: true ).trim() if (statusCode == '200') { - echo "βœ… Backend opΓ©rationnel (HTTP ${statusCode}) aprΓ¨s ${i} essai(s)" + echo "βœ… Backend ${params.ENV} opΓ©rationnel (HTTP ${statusCode}) aprΓ¨s ${i} essai(s)" break } else { echo "⏳ Tentative ${i}/${maxRetries} β†’ HTTP ${statusCode}" @@ -82,7 +139,7 @@ pipeline { } if (statusCode != '200') { - error("❌ Health check Γ©chouΓ© - code HTTP ${statusCode}") + error("❌ Health check Γ©chouΓ© sur ${params.ENV} - code HTTP ${statusCode}") } } } @@ -91,10 +148,10 @@ pipeline { post { success { - echo "βœ… Pipeline backend terminΓ© avec succΓ¨s !" + echo "βœ… Pipeline backend ${params.ENV} terminΓ© avec succΓ¨s !" } failure { - echo "❌ Γ‰chec du pipeline backend." + echo "❌ Γ‰chec du pipeline backend pour ${params.ENV}." } } } diff --git a/index.js b/index.js index 24397722..ee8a4b36 100644 --- a/index.js +++ b/index.js @@ -34,7 +34,7 @@ app.get("/db-check", async (req, res) => { // --- Route d’accueil (fix pour 'Cannot GET /') --- app.get("/", (req, res) => { - res.json({ message: "βœ… API ThΓ© Tip Top en ligne et opΓ©rationnelle 1200n1 !" }); + res.json({ message: "βœ… API ThΓ© Tip Top en ligne et opΓ©rationnelle 000 !" }); }); // --- Monitoring Prometheus --- diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 6bcf7124..fff720e4 100755 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -590,7 +590,7 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@eslint/config-helpers/node_modules/@eslint/core": { + "node_modules/@eslint/core": { "version": "0.17.0", "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", @@ -603,19 +603,6 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@eslint/core": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.16.0.tgz", - "integrity": "sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, "node_modules/@eslint/eslintrc": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", @@ -641,9 +628,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.38.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.38.0.tgz", - "integrity": "sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A==", + "version": "9.39.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.0.tgz", + "integrity": "sha512-BIhe0sW91JGPiaF1mOuPy5v8NflqfjIcDNpC+LbW9f609WVRX1rArrhi6Z2ymvrAry9jw+5POTj4t2t62o8Bmw==", "dev": true, "license": "MIT", "engines": { @@ -677,19 +664,6 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@eslint/plugin-kit/node_modules/@eslint/core": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", - "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, "node_modules/@humanfs/core": { "version": "0.19.1", "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", @@ -2566,20 +2540,20 @@ } }, "node_modules/eslint": { - "version": "9.38.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.38.0.tgz", - "integrity": "sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw==", + "version": "9.39.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.0.tgz", + "integrity": "sha512-iy2GE3MHrYTL5lrCtMZ0X1KLEKKUjmK0kzwcnefhR66txcEmXZD2YWgR5GNdcEwkNx3a0siYkSvl0vIC+Svjmg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", - "@eslint/config-helpers": "^0.4.1", - "@eslint/core": "^0.16.0", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.38.0", - "@eslint/plugin-kit": "^0.4.0", + "@eslint/js": "9.39.0", + "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", diff --git a/node_modules/@eslint/config-helpers/node_modules/@eslint/core/LICENSE b/node_modules/@eslint/config-helpers/node_modules/@eslint/core/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/node_modules/@eslint/config-helpers/node_modules/@eslint/core/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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. diff --git a/node_modules/@eslint/config-helpers/node_modules/@eslint/core/README.md b/node_modules/@eslint/config-helpers/node_modules/@eslint/core/README.md deleted file mode 100644 index 6c728333..00000000 --- a/node_modules/@eslint/config-helpers/node_modules/@eslint/core/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# ESLint Core - -## Overview - -This package is the future home of the rewritten, runtime-agnostic ESLint core. - -Right now, it exports the core types necessary to implement language plugins. - -## License - -Apache 2.0 - - - - -## 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). - -

Platinum Sponsors

-

Automattic Airbnb

Gold Sponsors

-

Qlty Software trunk.io Shopify

Silver Sponsors

-

Vite Liftoff American Express StackBlitz

Bronze Sponsors

-

Syntax Cybozu Sentry Icons8 Discord GitBook Nx Mercedes-Benz Group HeroCoders LambdaTest

-

Technology Sponsors

-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. -

Netlify Algolia 1Password

- diff --git a/node_modules/@eslint/config-helpers/node_modules/@eslint/core/dist/cjs/types.d.cts b/node_modules/@eslint/config-helpers/node_modules/@eslint/core/dist/cjs/types.d.cts deleted file mode 100644 index 3fa4bebc..00000000 --- a/node_modules/@eslint/config-helpers/node_modules/@eslint/core/dist/cjs/types.d.cts +++ /dev/null @@ -1,1179 +0,0 @@ -/** - * @fileoverview Shared types for ESLint Core. - */ -import type { JSONSchema4 } from "json-schema"; -/** - * Represents an error inside of a file. - */ -export interface FileError { - message: string; - line: number; - column: number; - endLine?: number; - endColumn?: number; -} -/** - * Represents a problem found in a file. - */ -export interface FileProblem { - ruleId: string | null; - message: string; - loc: SourceLocation; -} -/** - * Represents the start and end coordinates of a node inside the source. - */ -export interface SourceLocation { - start: Position; - end: Position; -} -/** - * Represents the start and end coordinates of a node inside the source with an offset. - */ -export interface SourceLocationWithOffset { - start: PositionWithOffset; - end: PositionWithOffset; -} -/** - * Represents a location coordinate inside the source. ESLint-style formats - * have just `line` and `column` while others may have `offset` as well. - */ -export interface Position { - line: number; - column: number; -} -/** - * Represents a location coordinate inside the source with an offset. - */ -export interface PositionWithOffset extends Position { - offset: number; -} -/** - * Represents a range of characters in the source. - */ -export type SourceRange = [number, number]; -/** - * What the rule is responsible for finding: - * - `problem` means the rule has noticed a potential error. - * - `suggestion` means the rule suggests an alternate or better approach. - * - `layout` means the rule is looking at spacing, indentation, etc. - */ -export type RuleType = "problem" | "suggestion" | "layout"; -/** - * The type of fix the rule can provide: - * - `code` means the rule can fix syntax. - * - `whitespace` means the rule can fix spacing and indentation. - */ -export type RuleFixType = "code" | "whitespace"; -/** - * An object containing visitor information for a rule. Each method is either the - * name of a node type or a selector, or is a method that will be called at specific - * times during the traversal. - */ -export type RuleVisitor = Record void) | undefined>; -/** - * Rule meta information used for documentation. - */ -export interface RulesMetaDocs { - /** - * A short description of the rule. - */ - description?: string | undefined; - /** - * The URL to the documentation for the rule. - */ - url?: string | undefined; - /** - * The category the rule falls under. - * @deprecated No longer used. - */ - category?: string | undefined; - /** - * Indicates if the rule is generally recommended for all users. - * - * Note - this will always be a boolean for core rules, but may be used in any way by plugins. - */ - recommended?: unknown; - /** - * Indicates if the rule is frozen (no longer accepting feature requests). - */ - frozen?: boolean | undefined; -} -/** - * Meta information about a rule. - */ -export interface RulesMeta { - /** - * Properties that are used when documenting the rule. - */ - docs?: (RulesMetaDocs & ExtRuleDocs) | undefined; - /** - * The type of rule. - */ - type?: RuleType | undefined; - /** - * The schema for the rule options. Required if the rule has options. - */ - schema?: JSONSchema4 | JSONSchema4[] | false | undefined; - /** - * Any default options to be recursively merged on top of any user-provided options. - */ - defaultOptions?: RuleOptions; - /** - * The messages that the rule can report. - */ - messages?: Record; - /** - * Indicates whether the rule has been deprecated or provides additional metadata about the deprecation. Omit if not deprecated. - */ - deprecated?: boolean | DeprecatedInfo | undefined; - /** - * @deprecated Use deprecated.replacedBy instead. - * The name of the rule(s) this rule was replaced by, if it was deprecated. - */ - replacedBy?: readonly string[] | undefined; - /** - * Indicates if the rule is fixable, and if so, what type of fix it provides. - */ - fixable?: RuleFixType | undefined; - /** - * Indicates if the rule may provide suggestions. - */ - hasSuggestions?: boolean | undefined; - /** - * The language the rule is intended to lint. - */ - language?: string; - /** - * The dialects of `language` that the rule is intended to lint. - */ - dialects?: string[]; -} -/** - * Provides additional metadata about a deprecation. - */ -export interface DeprecatedInfo { - /** - * General message presented to the user, e.g. for the key rule why the rule - * is deprecated or for info how to replace the rule. - */ - message?: string; - /** - * URL to more information about this deprecation in general. - */ - url?: string; - /** - * An empty array explicitly states that there is no replacement. - */ - replacedBy?: ReplacedByInfo[]; - /** - * The package version since when the rule is deprecated (should use full - * semver without a leading "v"). - */ - deprecatedSince?: string; - /** - * The estimated version when the rule is removed (probably the next major - * version). null means the rule is "frozen" (will be available but will not - * be changed). - */ - availableUntil?: string | null; -} -/** - * Provides metadata about a replacement - */ -export interface ReplacedByInfo { - /** - * General message presented to the user, e.g. how to replace the rule - */ - message?: string; - /** - * URL to more information about this replacement in general - */ - url?: string; - /** - * Name should be "eslint" if the replacement is an ESLint core rule. Omit - * the property if the replacement is in the same plugin. - */ - plugin?: ExternalSpecifier; - /** - * Name and documentation of the replacement rule - */ - rule?: ExternalSpecifier; -} -/** - * Specifies the name and url of an external resource. At least one property - * should be set. - */ -export interface ExternalSpecifier { - /** - * Name of the referenced plugin / rule. - */ - name?: string; - /** - * URL pointing to documentation for the plugin / rule. - */ - url?: string; -} -/** - * Generic type for `RuleContext`. - */ -export interface RuleContextTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RuleOptions: unknown[]; - Node: unknown; - MessageIds: string; -} -/** - * Represents the context object that is passed to a rule. This object contains - * information about the current state of the linting process and is the rule's - * view into the outside world. - */ -export interface RuleContext { - /** - * The current working directory for the session. - */ - cwd: string; - /** - * Returns the current working directory for the session. - * @deprecated Use `cwd` instead. - */ - getCwd(): string; - /** - * The filename of the file being linted. - */ - filename: string; - /** - * Returns the filename of the file being linted. - * @deprecated Use `filename` instead. - */ - getFilename(): string; - /** - * The physical filename of the file being linted. - */ - physicalFilename: string; - /** - * Returns the physical filename of the file being linted. - * @deprecated Use `physicalFilename` instead. - */ - getPhysicalFilename(): string; - /** - * The source code object that the rule is running on. - */ - sourceCode: Options["Code"]; - /** - * Returns the source code object that the rule is running on. - * @deprecated Use `sourceCode` instead. - */ - getSourceCode(): Options["Code"]; - /** - * Shared settings for the configuration. - */ - settings: SettingsConfig; - /** - * Parser-specific options for the configuration. - * @deprecated Use `languageOptions.parserOptions` instead. - */ - parserOptions: Record; - /** - * The language options for the configuration. - */ - languageOptions: Options["LangOptions"]; - /** - * The CommonJS path to the parser used while parsing this file. - * @deprecated No longer used. - */ - parserPath: string | undefined; - /** - * The rule ID. - */ - id: string; - /** - * The rule's configured options. - */ - options: Options["RuleOptions"]; - /** - * The report function that the rule should use to report problems. - * @param violation The violation to report. - */ - report(violation: ViolationReport): void; -} -/** - * Manager of text edits for a rule fix. - */ -export interface RuleTextEditor { - /** - * Inserts text after the specified node or token. - * @param syntaxElement The node or token to insert after. - * @param text The edit to insert after the node or token. - */ - insertTextAfter(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Inserts text after the specified range. - * @param range The range to insert after. - * @param text The edit to insert after the range. - */ - insertTextAfterRange(range: SourceRange, text: string): RuleTextEdit; - /** - * Inserts text before the specified node or token. - * @param syntaxElement A syntax element with location information to insert before. - * @param text The edit to insert before the node or token. - */ - insertTextBefore(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Inserts text before the specified range. - * @param range The range to insert before. - * @param text The edit to insert before the range. - */ - insertTextBeforeRange(range: SourceRange, text: string): RuleTextEdit; - /** - * Removes the specified node or token. - * @param syntaxElement A syntax element with location information to remove. - * @returns The edit to remove the node or token. - */ - remove(syntaxElement: EditableSyntaxElement): RuleTextEdit; - /** - * Removes the specified range. - * @param range The range to remove. - * @returns The edit to remove the range. - */ - removeRange(range: SourceRange): RuleTextEdit; - /** - * Replaces the specified node or token with the given text. - * @param syntaxElement A syntax element with location information to replace. - * @param text The text to replace the node or token with. - * @returns The edit to replace the node or token. - */ - replaceText(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Replaces the specified range with the given text. - * @param range The range to replace. - * @param text The text to replace the range with. - * @returns The edit to replace the range. - */ - replaceTextRange(range: SourceRange, text: string): RuleTextEdit; -} -/** - * Represents a fix for a rule violation implemented as a text edit. - */ -export interface RuleTextEdit { - /** - * The range to replace. - */ - range: SourceRange; - /** - * The text to insert. - */ - text: string; -} -/** - * Fixes a violation. - * @param fixer The text editor to apply the fix. - * @returns The fix(es) for the violation. - */ -export type RuleFixer = (fixer: RuleTextEditor) => RuleTextEdit | Iterable | null; -export interface ViolationReportBase { - /** - * The data to insert into the message. - */ - data?: Record | undefined; - /** - * The fix to be applied for the violation. - */ - fix?: RuleFixer | null | undefined; - /** - * An array of suggested fixes for the problem. These fixes may change the - * behavior of the code, so they are not applied automatically. - */ - suggest?: SuggestedEdit[] | null | undefined; -} -export type ViolationMessage = { - message: string; -} | { - messageId: MessageIds; -}; -export type ViolationLocation = { - loc: SourceLocation | Position; -} | { - node: Node; -}; -export type ViolationReport = ViolationReportBase & ViolationMessage & ViolationLocation; -export interface SuggestedEditBase { - /** - * The data to insert into the message. - */ - data?: Record | undefined; - /** - * The fix to be applied for the suggestion. - */ - fix: RuleFixer; -} -export type SuggestionMessage = { - desc: string; -} | { - messageId: string; -}; -/** - * A suggested edit for a rule violation. - */ -export type SuggestedEdit = SuggestedEditBase & SuggestionMessage; -/** - * The normalized version of a lint suggestion. - */ -export interface LintSuggestion { - /** A short description. */ - desc: string; - /** Fix result info. */ - fix: RuleTextEdit; - /** Id referencing a message for the description. */ - messageId?: string | undefined; -} -/** - * The normalized version of a lint violation message. - */ -export interface LintMessage { - /** The 1-based column number. */ - column: number; - /** The 1-based line number. */ - line: number; - /** The 1-based column number of the end location. */ - endColumn?: number | undefined; - /** The 1-based line number of the end location. */ - endLine?: number | undefined; - /** The ID of the rule which makes this message. */ - ruleId: string | null; - /** The reported message. */ - message: string; - /** The ID of the message in the rule's meta. */ - messageId?: string | undefined; - /** - * Type of node. - * @deprecated `nodeType` is deprecated and will be removed in the next major version. - */ - nodeType?: string | undefined; - /** If `true` then this is a fatal error. */ - fatal?: true | undefined; - /** The severity of this message. */ - severity: Exclude; - /** Information for autofix. */ - fix?: RuleTextEdit | undefined; - /** Information for suggestions. */ - suggestions?: LintSuggestion[] | undefined; -} -/** - * Generic options for the `RuleDefinition` type. - */ -export interface RuleDefinitionTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RuleOptions: unknown[]; - Visitor: RuleVisitor; - Node: unknown; - MessageIds: string; - ExtRuleDocs: unknown; -} -/** - * The definition of an ESLint rule. - */ -export interface RuleDefinition { - /** - * The meta information for the rule. - */ - meta?: RulesMeta; - /** - * Creates the visitor that ESLint uses to apply the rule during traversal. - * @param context The rule context. - * @returns The rule visitor. - */ - create(context: RuleContext<{ - LangOptions: Options["LangOptions"]; - Code: Options["Code"]; - RuleOptions: Options["RuleOptions"]; - Node: Options["Node"]; - MessageIds: Options["MessageIds"]; - }>): Options["Visitor"]; -} -/** - * Defaults for non-language-related `RuleDefinition` options. - */ -export interface CustomRuleTypeDefinitions { - RuleOptions: unknown[]; - MessageIds: string; - ExtRuleDocs: Record; -} -/** - * A helper type to define language specific specializations of the `RuleDefinition` type. - * - * @example - * ```ts - * type YourRuleDefinition< - * Options extends Partial = {}, - * > = CustomRuleDefinitionType< - * { - * LangOptions: YourLanguageOptions; - * Code: YourSourceCode; - * Visitor: YourRuleVisitor; - * Node: YourNode; - * }, - * Options - * >; - * ``` - */ -export type CustomRuleDefinitionType, Options extends Partial> = RuleDefinition>>; -/** - * The human readable severity level used in a configuration. - */ -export type SeverityName = "off" | "warn" | "error"; -/** - * The numeric severity level for a rule. - * - * - `0` means off. - * - `1` means warn. - * - `2` means error. - */ -export type SeverityLevel = 0 | 1 | 2; -/** - * The severity of a rule in a configuration. - */ -export type Severity = SeverityName | SeverityLevel; -/** - * Represents the metadata for an object, such as a plugin or processor. - */ -export interface ObjectMetaProperties { - /** @deprecated Use `meta.name` instead. */ - name?: string | undefined; - /** @deprecated Use `meta.version` instead. */ - version?: string | undefined; - meta?: { - name?: string | undefined; - version?: string | undefined; - }; -} -/** - * Represents the configuration options for the core linter. - */ -export interface LinterOptionsConfig { - /** - * Indicates whether or not inline configuration is evaluated. - */ - noInlineConfig?: boolean; - /** - * Indicates what to do when an unused disable directive is found. - */ - reportUnusedDisableDirectives?: boolean | Severity; - /** - * A severity value indicating if and how unused inline configs should be - * tracked and reported. - */ - reportUnusedInlineConfigs?: Severity; -} -/** - * The configuration for a rule. - */ -export type RuleConfig = Severity | [Severity, ...Partial]; -/** - * A collection of rules and their configurations. - */ -export interface RulesConfig { - [key: string]: RuleConfig; -} -/** - * A collection of settings. - */ -export interface SettingsConfig { - [key: string]: unknown; -} -/** - * The configuration for a set of files. - */ -export interface ConfigObject { - /** - * A string to identify the configuration object. Used in error messages and - * inspection tools. - */ - name?: string; - /** - * Path to the directory where the configuration object should apply. - * `files` and `ignores` patterns in the configuration object are - * interpreted as relative to this path. - */ - basePath?: string; - /** - * An array of glob patterns indicating the files that the configuration - * object should apply to. If not specified, the configuration object applies - * to all files - */ - files?: (string | string[])[]; - /** - * An array of glob patterns indicating the files that the configuration - * object should not apply to. If not specified, the configuration object - * applies to all files matched by files - */ - ignores?: string[]; - /** - * The name of the language used for linting. This is used to determine the - * parser and other language-specific settings. - * @since 9.7.0 - */ - language?: string; - /** - * An object containing settings related to how the language is configured for - * linting. - */ - languageOptions?: LanguageOptions; - /** - * An object containing settings related to the linting process - */ - linterOptions?: LinterOptionsConfig; - /** - * Either an object containing preprocess() and postprocess() methods or a - * string indicating the name of a processor inside of a plugin - * (i.e., "pluginName/processorName"). - */ - processor?: string | Processor; - /** - * An object containing a name-value mapping of plugin names to plugin objects. - * When files is specified, these plugins are only available to the matching files. - */ - plugins?: Record; - /** - * An object containing the configured rules. When files or ignores are specified, - * these rule configurations are only available to the matching files. - */ - rules?: Partial; - /** - * An object containing name-value pairs of information that should be - * available to all rules. - */ - settings?: Record; -} -/** @deprecated Only supported in legacy eslintrc config format. */ -export type GlobalAccess = boolean | "off" | "readable" | "readonly" | "writable" | "writeable"; -/** @deprecated Only supported in legacy eslintrc config format. */ -export interface GlobalsConfig { - [name: string]: GlobalAccess; -} -/** - * The ECMAScript version of the code being linted. - * @deprecated Only supported in legacy eslintrc config format. - */ -export type EcmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026 | "latest"; -/** - * The type of JavaScript source code. - * @deprecated Only supported in legacy eslintrc config format. - */ -export type JavaScriptSourceType = "script" | "module" | "commonjs"; -/** - * Parser options. - * @deprecated Only supported in legacy eslintrc config format. - * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options#specifying-parser-options) - */ -export interface JavaScriptParserOptionsConfig { - /** - * Allow the use of reserved words as identifiers (if `ecmaVersion` is 3). - * - * @default false - */ - allowReserved?: boolean | undefined; - /** - * Accepts any valid ECMAScript version number or `'latest'`: - * - * - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, es14, ..., or - * - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, ..., or - * - `'latest'` - * - * When it's a version or a year, the value must be a number - so do not include the `es` prefix. - * - * Specifies the version of ECMAScript syntax you want to use. This is used by the parser to determine how to perform scope analysis, and it affects the default - * - * @default 5 - */ - ecmaVersion?: EcmaVersion | undefined; - /** - * The type of JavaScript source code. Possible values are "script" for - * traditional script files, "module" for ECMAScript modules (ESM), and - * "commonjs" for CommonJS files. - * - * @default 'script' - * - * @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options - */ - sourceType?: JavaScriptSourceType | undefined; - /** - * An object indicating which additional language features you'd like to use. - * - * @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options - */ - ecmaFeatures?: { - globalReturn?: boolean | undefined; - impliedStrict?: boolean | undefined; - jsx?: boolean | undefined; - experimentalObjectRestSpread?: boolean | undefined; - [key: string]: any; - } | undefined; - [key: string]: any; -} -/** @deprecated Only supported in legacy eslintrc config format. */ -export interface EnvironmentConfig { - /** The definition of global variables. */ - globals?: GlobalsConfig | undefined; - /** The parser options that will be enabled under this environment. */ - parserOptions?: JavaScriptParserOptionsConfig | undefined; -} -/** - * A configuration object that may have a `rules` block. - */ -export interface HasRules { - rules?: Partial | undefined; -} -/** - * ESLint legacy configuration. - * - * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) - */ -export interface BaseConfig extends HasRules { - $schema?: string | undefined; - /** - * An environment provides predefined global variables. - * - * @see [Environments](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-environments) - */ - env?: { - [name: string]: boolean; - } | undefined; - /** - * Extending configuration files. - * - * @see [Extends](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#extending-configuration-files) - */ - extends?: string | string[] | undefined; - /** - * Specifying globals. - * - * @see [Globals](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-globals) - */ - globals?: GlobalsConfig | undefined; - /** - * Disable processing of inline comments. - * - * @see [Disabling Inline Comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#disabling-inline-comments) - */ - noInlineConfig?: boolean | undefined; - /** - * Overrides can be used to use a differing configuration for matching sub-directories and files. - * - * @see [How do overrides work](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#how-do-overrides-work) - */ - overrides?: ConfigOverride[] | undefined; - /** - * Parser. - * - * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) - * @see [Specifying Parser](https://eslint.org/docs/latest/use/configure/parser-deprecated) - */ - parser?: string | undefined; - /** - * Parser options. - * - * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) - * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options) - */ - parserOptions?: JavaScriptParserOptionsConfig | undefined; - /** - * Which third-party plugins define additional rules, environments, configs, etc. for ESLint to use. - * - * @see [Configuring Plugins](https://eslint.org/docs/latest/use/configure/plugins-deprecated#configure-plugins) - */ - plugins?: string[] | undefined; - /** - * Specifying processor. - * - * @see [processor](https://eslint.org/docs/latest/use/configure/plugins-deprecated#specify-a-processor) - */ - processor?: string | undefined; - /** - * Report unused eslint-disable comments as warning. - * - * @see [Report unused eslint-disable comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#report-unused-eslint-disable-comments) - */ - reportUnusedDisableDirectives?: boolean | undefined; - /** - * Settings. - * - * @see [Settings](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#adding-shared-settings) - */ - settings?: SettingsConfig | undefined; -} -/** - * The overwrites that apply more differing configuration to specific files or directories. - */ -export interface ConfigOverride extends BaseConfig { - /** - * The glob patterns for excluded files. - */ - excludedFiles?: string | string[] | undefined; - /** - * The glob patterns for target files. - */ - files: string | string[]; -} -/** - * ESLint legacy configuration. - * - * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) - */ -export interface LegacyConfigObject extends BaseConfig { - /** - * Tell ESLint to ignore specific files and directories. - * - * @see [Ignore Patterns](https://eslint.org/docs/latest/use/configure/ignore-deprecated#ignorepatterns-in-config-files) - */ - ignorePatterns?: string | string[] | undefined; - /** - * @see [Using Configuration Files](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#using-configuration-files) - */ - root?: boolean | undefined; -} -/** - * File information passed to a processor. - */ -export interface ProcessorFile { - text: string; - filename: string; -} -/** - * A processor is an object that can preprocess and postprocess files. - */ -export interface Processor extends ObjectMetaProperties { - /** If `true` then it means the processor supports autofix. */ - supportsAutofix?: boolean | undefined; - /** The function to extract code blocks. */ - preprocess?(text: string, filename: string): T[]; - /** The function to merge messages. */ - postprocess?(messages: LintMessage[][], filename: string): LintMessage[]; -} -export interface Plugin extends ObjectMetaProperties { - meta?: ObjectMetaProperties["meta"] & { - namespace?: string | undefined; - }; - configs?: Record | undefined; - environments?: Record | undefined; - languages?: Record | undefined; - processors?: Record | undefined; - rules?: Record | undefined; -} -/** - * Generic options for the `Language` type. - */ -export interface LanguageTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RootNode: unknown; - Node: unknown; -} -/** - * Represents a plugin language. - */ -export interface Language { - /** - * Indicates how ESLint should read the file. - */ - fileType: "text"; - /** - * First line number returned from the parser (text mode only). - */ - lineStart: 0 | 1; - /** - * First column number returned from the parser (text mode only). - */ - columnStart: 0 | 1; - /** - * The property to read the node type from. Used in selector querying. - */ - nodeTypeKey: string; - /** - * The traversal path that tools should take when evaluating the AST - */ - visitorKeys?: Record; - /** - * Default language options. User-defined options are merged with this object. - */ - defaultLanguageOptions?: LanguageOptions; - /** - * Validates languageOptions for this language. - */ - validateLanguageOptions(languageOptions: Options["LangOptions"]): void; - /** - * Normalizes languageOptions for this language. - */ - normalizeLanguageOptions?(languageOptions: Options["LangOptions"]): Options["LangOptions"]; - /** - * Helper for esquery that allows languages to match nodes against - * class. esquery currently has classes like `function` that will - * match all the various function nodes. This method allows languages - * to implement similar shorthands. - */ - matchesSelectorClass?(className: string, node: Options["Node"], ancestry: Options["Node"][]): boolean; - /** - * Parses the given file input into its component parts. This file should not - * throws errors for parsing errors but rather should return any parsing - * errors as parse of the ParseResult object. - */ - parse(file: File, context: LanguageContext): ParseResult; - /** - * Creates SourceCode object that ESLint uses to work with a file. - */ - createSourceCode(file: File, input: OkParseResult, context: LanguageContext): Options["Code"]; -} -/** - * Plugin-defined options for the language. - */ -export type LanguageOptions = Record; -/** - * The context object that is passed to the language plugin methods. - */ -export interface LanguageContext { - languageOptions: LangOptions; -} -/** - * Represents a file read by ESLint. - */ -export interface File { - /** - * The path that ESLint uses for this file. May be a virtual path - * if it was returned by a processor. - */ - path: string; - /** - * The path to the file on disk. This always maps directly to a file - * regardless of whether it was returned from a processor. - */ - physicalPath: string; - /** - * Indicates if the original source contained a byte-order marker. - * ESLint strips the BOM from the `body`, but this info is needed - * to correctly apply autofixing. - */ - bom: boolean; - /** - * The body of the file to parse. - */ - body: string | Uint8Array; -} -/** - * Represents the successful result of parsing a file. - */ -export interface OkParseResult { - /** - * Indicates if the parse was successful. If true, the parse was successful - * and ESLint should continue on to create a SourceCode object and run rules; - * if false, ESLint should just report the error(s) without doing anything - * else. - */ - ok: true; - /** - * The abstract syntax tree created by the parser. (only when ok: true) - */ - ast: RootNode; - /** - * Any additional data that the parser wants to provide. - */ - [key: string]: any; -} -/** - * Represents the unsuccessful result of parsing a file. - */ -export interface NotOkParseResult { - /** - * Indicates if the parse was successful. If true, the parse was successful - * and ESLint should continue on to create a SourceCode object and run rules; - * if false, ESLint should just report the error(s) without doing anything - * else. - */ - ok: false; - /** - * Any parsing errors, whether fatal or not. (only when ok: false) - */ - errors: FileError[]; - /** - * Any additional data that the parser wants to provide. - */ - [key: string]: any; -} -export type ParseResult = OkParseResult | NotOkParseResult; -/** - * Represents inline configuration found in the source code. - */ -interface InlineConfigElement { - /** - * The location of the inline config element. - */ - loc: SourceLocation; - /** - * The interpreted configuration from the inline config element. - */ - config: { - rules: RulesConfig; - }; -} -/** - * Generic options for the `SourceCodeBase` type. - */ -export interface SourceCodeBaseTypeOptions { - LangOptions: LanguageOptions; - RootNode: unknown; - SyntaxElementWithLoc: unknown; - ConfigNode: unknown; -} -/** - * Represents the basic interface for a source code object. - */ -interface SourceCodeBase { - /** - * Root of the AST. - */ - ast: Options["RootNode"]; - /** - * The traversal path that tools should take when evaluating the AST. - * When present, this overrides the `visitorKeys` on the language for - * just this source code object. - */ - visitorKeys?: Record; - /** - * Retrieves the equivalent of `loc` for a given node or token. - * @param syntaxElement The node or token to get the location for. - * @returns The location of the node or token. - */ - getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation; - /** - * Retrieves the equivalent of `range` for a given node or token. - * @param syntaxElement The node or token to get the range for. - * @returns The range of the node or token. - */ - getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange; - /** - * Traversal of AST. - */ - traverse(): Iterable; - /** - * Applies language options passed in from the ESLint core. - */ - applyLanguageOptions?(languageOptions: Options["LangOptions"]): void; - /** - * Return all of the inline areas where ESLint should be disabled/enabled - * along with any problems found in evaluating the directives. - */ - getDisableDirectives?(): { - directives: Directive[]; - problems: FileProblem[]; - }; - /** - * Returns an array of all inline configuration nodes found in the - * source code. - */ - getInlineConfigNodes?(): Options["ConfigNode"][]; - /** - * Applies configuration found inside of the source code. This method is only - * called when ESLint is running with inline configuration allowed. - */ - applyInlineConfig?(): { - configs: InlineConfigElement[]; - problems: FileProblem[]; - }; - /** - * Called by ESLint core to indicate that it has finished providing - * information. We now add in all the missing variables and ensure that - * state-changing methods cannot be called by rules. - * @returns {void} - */ - finalize?(): void; -} -/** - * Represents the source of a text file being linted. - */ -export interface TextSourceCode extends SourceCodeBase { - /** - * The body of the file that you'd like rule developers to access. - */ - text: string; -} -/** - * Represents the source of a binary file being linted. - */ -export interface BinarySourceCode extends SourceCodeBase { - /** - * The body of the file that you'd like rule developers to access. - */ - body: Uint8Array; -} -export type SourceCode = TextSourceCode | BinarySourceCode; -/** - * Represents a traversal step visiting the AST. - */ -export interface VisitTraversalStep { - kind: 1; - target: unknown; - phase: 1 | 2; - args: unknown[]; -} -/** - * Represents a traversal step calling a function. - */ -export interface CallTraversalStep { - kind: 2; - target: string; - phase?: string; - args: unknown[]; -} -export type TraversalStep = VisitTraversalStep | CallTraversalStep; -/** - * The type of disable directive. This determines how ESLint will disable rules. - */ -export type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line"; -/** - * Represents a disable directive. - */ -export interface Directive { - /** - * The type of directive. - */ - type: DirectiveType; - /** - * The node of the directive. May be in the AST or a comment/token. - */ - node: unknown; - /** - * The value of the directive. - */ - value: string; - /** - * The justification for the directive. - */ - justification?: string; -} -export {}; diff --git a/node_modules/@eslint/config-helpers/node_modules/@eslint/core/dist/esm/types.d.ts b/node_modules/@eslint/config-helpers/node_modules/@eslint/core/dist/esm/types.d.ts deleted file mode 100644 index 3fa4bebc..00000000 --- a/node_modules/@eslint/config-helpers/node_modules/@eslint/core/dist/esm/types.d.ts +++ /dev/null @@ -1,1179 +0,0 @@ -/** - * @fileoverview Shared types for ESLint Core. - */ -import type { JSONSchema4 } from "json-schema"; -/** - * Represents an error inside of a file. - */ -export interface FileError { - message: string; - line: number; - column: number; - endLine?: number; - endColumn?: number; -} -/** - * Represents a problem found in a file. - */ -export interface FileProblem { - ruleId: string | null; - message: string; - loc: SourceLocation; -} -/** - * Represents the start and end coordinates of a node inside the source. - */ -export interface SourceLocation { - start: Position; - end: Position; -} -/** - * Represents the start and end coordinates of a node inside the source with an offset. - */ -export interface SourceLocationWithOffset { - start: PositionWithOffset; - end: PositionWithOffset; -} -/** - * Represents a location coordinate inside the source. ESLint-style formats - * have just `line` and `column` while others may have `offset` as well. - */ -export interface Position { - line: number; - column: number; -} -/** - * Represents a location coordinate inside the source with an offset. - */ -export interface PositionWithOffset extends Position { - offset: number; -} -/** - * Represents a range of characters in the source. - */ -export type SourceRange = [number, number]; -/** - * What the rule is responsible for finding: - * - `problem` means the rule has noticed a potential error. - * - `suggestion` means the rule suggests an alternate or better approach. - * - `layout` means the rule is looking at spacing, indentation, etc. - */ -export type RuleType = "problem" | "suggestion" | "layout"; -/** - * The type of fix the rule can provide: - * - `code` means the rule can fix syntax. - * - `whitespace` means the rule can fix spacing and indentation. - */ -export type RuleFixType = "code" | "whitespace"; -/** - * An object containing visitor information for a rule. Each method is either the - * name of a node type or a selector, or is a method that will be called at specific - * times during the traversal. - */ -export type RuleVisitor = Record void) | undefined>; -/** - * Rule meta information used for documentation. - */ -export interface RulesMetaDocs { - /** - * A short description of the rule. - */ - description?: string | undefined; - /** - * The URL to the documentation for the rule. - */ - url?: string | undefined; - /** - * The category the rule falls under. - * @deprecated No longer used. - */ - category?: string | undefined; - /** - * Indicates if the rule is generally recommended for all users. - * - * Note - this will always be a boolean for core rules, but may be used in any way by plugins. - */ - recommended?: unknown; - /** - * Indicates if the rule is frozen (no longer accepting feature requests). - */ - frozen?: boolean | undefined; -} -/** - * Meta information about a rule. - */ -export interface RulesMeta { - /** - * Properties that are used when documenting the rule. - */ - docs?: (RulesMetaDocs & ExtRuleDocs) | undefined; - /** - * The type of rule. - */ - type?: RuleType | undefined; - /** - * The schema for the rule options. Required if the rule has options. - */ - schema?: JSONSchema4 | JSONSchema4[] | false | undefined; - /** - * Any default options to be recursively merged on top of any user-provided options. - */ - defaultOptions?: RuleOptions; - /** - * The messages that the rule can report. - */ - messages?: Record; - /** - * Indicates whether the rule has been deprecated or provides additional metadata about the deprecation. Omit if not deprecated. - */ - deprecated?: boolean | DeprecatedInfo | undefined; - /** - * @deprecated Use deprecated.replacedBy instead. - * The name of the rule(s) this rule was replaced by, if it was deprecated. - */ - replacedBy?: readonly string[] | undefined; - /** - * Indicates if the rule is fixable, and if so, what type of fix it provides. - */ - fixable?: RuleFixType | undefined; - /** - * Indicates if the rule may provide suggestions. - */ - hasSuggestions?: boolean | undefined; - /** - * The language the rule is intended to lint. - */ - language?: string; - /** - * The dialects of `language` that the rule is intended to lint. - */ - dialects?: string[]; -} -/** - * Provides additional metadata about a deprecation. - */ -export interface DeprecatedInfo { - /** - * General message presented to the user, e.g. for the key rule why the rule - * is deprecated or for info how to replace the rule. - */ - message?: string; - /** - * URL to more information about this deprecation in general. - */ - url?: string; - /** - * An empty array explicitly states that there is no replacement. - */ - replacedBy?: ReplacedByInfo[]; - /** - * The package version since when the rule is deprecated (should use full - * semver without a leading "v"). - */ - deprecatedSince?: string; - /** - * The estimated version when the rule is removed (probably the next major - * version). null means the rule is "frozen" (will be available but will not - * be changed). - */ - availableUntil?: string | null; -} -/** - * Provides metadata about a replacement - */ -export interface ReplacedByInfo { - /** - * General message presented to the user, e.g. how to replace the rule - */ - message?: string; - /** - * URL to more information about this replacement in general - */ - url?: string; - /** - * Name should be "eslint" if the replacement is an ESLint core rule. Omit - * the property if the replacement is in the same plugin. - */ - plugin?: ExternalSpecifier; - /** - * Name and documentation of the replacement rule - */ - rule?: ExternalSpecifier; -} -/** - * Specifies the name and url of an external resource. At least one property - * should be set. - */ -export interface ExternalSpecifier { - /** - * Name of the referenced plugin / rule. - */ - name?: string; - /** - * URL pointing to documentation for the plugin / rule. - */ - url?: string; -} -/** - * Generic type for `RuleContext`. - */ -export interface RuleContextTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RuleOptions: unknown[]; - Node: unknown; - MessageIds: string; -} -/** - * Represents the context object that is passed to a rule. This object contains - * information about the current state of the linting process and is the rule's - * view into the outside world. - */ -export interface RuleContext { - /** - * The current working directory for the session. - */ - cwd: string; - /** - * Returns the current working directory for the session. - * @deprecated Use `cwd` instead. - */ - getCwd(): string; - /** - * The filename of the file being linted. - */ - filename: string; - /** - * Returns the filename of the file being linted. - * @deprecated Use `filename` instead. - */ - getFilename(): string; - /** - * The physical filename of the file being linted. - */ - physicalFilename: string; - /** - * Returns the physical filename of the file being linted. - * @deprecated Use `physicalFilename` instead. - */ - getPhysicalFilename(): string; - /** - * The source code object that the rule is running on. - */ - sourceCode: Options["Code"]; - /** - * Returns the source code object that the rule is running on. - * @deprecated Use `sourceCode` instead. - */ - getSourceCode(): Options["Code"]; - /** - * Shared settings for the configuration. - */ - settings: SettingsConfig; - /** - * Parser-specific options for the configuration. - * @deprecated Use `languageOptions.parserOptions` instead. - */ - parserOptions: Record; - /** - * The language options for the configuration. - */ - languageOptions: Options["LangOptions"]; - /** - * The CommonJS path to the parser used while parsing this file. - * @deprecated No longer used. - */ - parserPath: string | undefined; - /** - * The rule ID. - */ - id: string; - /** - * The rule's configured options. - */ - options: Options["RuleOptions"]; - /** - * The report function that the rule should use to report problems. - * @param violation The violation to report. - */ - report(violation: ViolationReport): void; -} -/** - * Manager of text edits for a rule fix. - */ -export interface RuleTextEditor { - /** - * Inserts text after the specified node or token. - * @param syntaxElement The node or token to insert after. - * @param text The edit to insert after the node or token. - */ - insertTextAfter(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Inserts text after the specified range. - * @param range The range to insert after. - * @param text The edit to insert after the range. - */ - insertTextAfterRange(range: SourceRange, text: string): RuleTextEdit; - /** - * Inserts text before the specified node or token. - * @param syntaxElement A syntax element with location information to insert before. - * @param text The edit to insert before the node or token. - */ - insertTextBefore(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Inserts text before the specified range. - * @param range The range to insert before. - * @param text The edit to insert before the range. - */ - insertTextBeforeRange(range: SourceRange, text: string): RuleTextEdit; - /** - * Removes the specified node or token. - * @param syntaxElement A syntax element with location information to remove. - * @returns The edit to remove the node or token. - */ - remove(syntaxElement: EditableSyntaxElement): RuleTextEdit; - /** - * Removes the specified range. - * @param range The range to remove. - * @returns The edit to remove the range. - */ - removeRange(range: SourceRange): RuleTextEdit; - /** - * Replaces the specified node or token with the given text. - * @param syntaxElement A syntax element with location information to replace. - * @param text The text to replace the node or token with. - * @returns The edit to replace the node or token. - */ - replaceText(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Replaces the specified range with the given text. - * @param range The range to replace. - * @param text The text to replace the range with. - * @returns The edit to replace the range. - */ - replaceTextRange(range: SourceRange, text: string): RuleTextEdit; -} -/** - * Represents a fix for a rule violation implemented as a text edit. - */ -export interface RuleTextEdit { - /** - * The range to replace. - */ - range: SourceRange; - /** - * The text to insert. - */ - text: string; -} -/** - * Fixes a violation. - * @param fixer The text editor to apply the fix. - * @returns The fix(es) for the violation. - */ -export type RuleFixer = (fixer: RuleTextEditor) => RuleTextEdit | Iterable | null; -export interface ViolationReportBase { - /** - * The data to insert into the message. - */ - data?: Record | undefined; - /** - * The fix to be applied for the violation. - */ - fix?: RuleFixer | null | undefined; - /** - * An array of suggested fixes for the problem. These fixes may change the - * behavior of the code, so they are not applied automatically. - */ - suggest?: SuggestedEdit[] | null | undefined; -} -export type ViolationMessage = { - message: string; -} | { - messageId: MessageIds; -}; -export type ViolationLocation = { - loc: SourceLocation | Position; -} | { - node: Node; -}; -export type ViolationReport = ViolationReportBase & ViolationMessage & ViolationLocation; -export interface SuggestedEditBase { - /** - * The data to insert into the message. - */ - data?: Record | undefined; - /** - * The fix to be applied for the suggestion. - */ - fix: RuleFixer; -} -export type SuggestionMessage = { - desc: string; -} | { - messageId: string; -}; -/** - * A suggested edit for a rule violation. - */ -export type SuggestedEdit = SuggestedEditBase & SuggestionMessage; -/** - * The normalized version of a lint suggestion. - */ -export interface LintSuggestion { - /** A short description. */ - desc: string; - /** Fix result info. */ - fix: RuleTextEdit; - /** Id referencing a message for the description. */ - messageId?: string | undefined; -} -/** - * The normalized version of a lint violation message. - */ -export interface LintMessage { - /** The 1-based column number. */ - column: number; - /** The 1-based line number. */ - line: number; - /** The 1-based column number of the end location. */ - endColumn?: number | undefined; - /** The 1-based line number of the end location. */ - endLine?: number | undefined; - /** The ID of the rule which makes this message. */ - ruleId: string | null; - /** The reported message. */ - message: string; - /** The ID of the message in the rule's meta. */ - messageId?: string | undefined; - /** - * Type of node. - * @deprecated `nodeType` is deprecated and will be removed in the next major version. - */ - nodeType?: string | undefined; - /** If `true` then this is a fatal error. */ - fatal?: true | undefined; - /** The severity of this message. */ - severity: Exclude; - /** Information for autofix. */ - fix?: RuleTextEdit | undefined; - /** Information for suggestions. */ - suggestions?: LintSuggestion[] | undefined; -} -/** - * Generic options for the `RuleDefinition` type. - */ -export interface RuleDefinitionTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RuleOptions: unknown[]; - Visitor: RuleVisitor; - Node: unknown; - MessageIds: string; - ExtRuleDocs: unknown; -} -/** - * The definition of an ESLint rule. - */ -export interface RuleDefinition { - /** - * The meta information for the rule. - */ - meta?: RulesMeta; - /** - * Creates the visitor that ESLint uses to apply the rule during traversal. - * @param context The rule context. - * @returns The rule visitor. - */ - create(context: RuleContext<{ - LangOptions: Options["LangOptions"]; - Code: Options["Code"]; - RuleOptions: Options["RuleOptions"]; - Node: Options["Node"]; - MessageIds: Options["MessageIds"]; - }>): Options["Visitor"]; -} -/** - * Defaults for non-language-related `RuleDefinition` options. - */ -export interface CustomRuleTypeDefinitions { - RuleOptions: unknown[]; - MessageIds: string; - ExtRuleDocs: Record; -} -/** - * A helper type to define language specific specializations of the `RuleDefinition` type. - * - * @example - * ```ts - * type YourRuleDefinition< - * Options extends Partial = {}, - * > = CustomRuleDefinitionType< - * { - * LangOptions: YourLanguageOptions; - * Code: YourSourceCode; - * Visitor: YourRuleVisitor; - * Node: YourNode; - * }, - * Options - * >; - * ``` - */ -export type CustomRuleDefinitionType, Options extends Partial> = RuleDefinition>>; -/** - * The human readable severity level used in a configuration. - */ -export type SeverityName = "off" | "warn" | "error"; -/** - * The numeric severity level for a rule. - * - * - `0` means off. - * - `1` means warn. - * - `2` means error. - */ -export type SeverityLevel = 0 | 1 | 2; -/** - * The severity of a rule in a configuration. - */ -export type Severity = SeverityName | SeverityLevel; -/** - * Represents the metadata for an object, such as a plugin or processor. - */ -export interface ObjectMetaProperties { - /** @deprecated Use `meta.name` instead. */ - name?: string | undefined; - /** @deprecated Use `meta.version` instead. */ - version?: string | undefined; - meta?: { - name?: string | undefined; - version?: string | undefined; - }; -} -/** - * Represents the configuration options for the core linter. - */ -export interface LinterOptionsConfig { - /** - * Indicates whether or not inline configuration is evaluated. - */ - noInlineConfig?: boolean; - /** - * Indicates what to do when an unused disable directive is found. - */ - reportUnusedDisableDirectives?: boolean | Severity; - /** - * A severity value indicating if and how unused inline configs should be - * tracked and reported. - */ - reportUnusedInlineConfigs?: Severity; -} -/** - * The configuration for a rule. - */ -export type RuleConfig = Severity | [Severity, ...Partial]; -/** - * A collection of rules and their configurations. - */ -export interface RulesConfig { - [key: string]: RuleConfig; -} -/** - * A collection of settings. - */ -export interface SettingsConfig { - [key: string]: unknown; -} -/** - * The configuration for a set of files. - */ -export interface ConfigObject { - /** - * A string to identify the configuration object. Used in error messages and - * inspection tools. - */ - name?: string; - /** - * Path to the directory where the configuration object should apply. - * `files` and `ignores` patterns in the configuration object are - * interpreted as relative to this path. - */ - basePath?: string; - /** - * An array of glob patterns indicating the files that the configuration - * object should apply to. If not specified, the configuration object applies - * to all files - */ - files?: (string | string[])[]; - /** - * An array of glob patterns indicating the files that the configuration - * object should not apply to. If not specified, the configuration object - * applies to all files matched by files - */ - ignores?: string[]; - /** - * The name of the language used for linting. This is used to determine the - * parser and other language-specific settings. - * @since 9.7.0 - */ - language?: string; - /** - * An object containing settings related to how the language is configured for - * linting. - */ - languageOptions?: LanguageOptions; - /** - * An object containing settings related to the linting process - */ - linterOptions?: LinterOptionsConfig; - /** - * Either an object containing preprocess() and postprocess() methods or a - * string indicating the name of a processor inside of a plugin - * (i.e., "pluginName/processorName"). - */ - processor?: string | Processor; - /** - * An object containing a name-value mapping of plugin names to plugin objects. - * When files is specified, these plugins are only available to the matching files. - */ - plugins?: Record; - /** - * An object containing the configured rules. When files or ignores are specified, - * these rule configurations are only available to the matching files. - */ - rules?: Partial; - /** - * An object containing name-value pairs of information that should be - * available to all rules. - */ - settings?: Record; -} -/** @deprecated Only supported in legacy eslintrc config format. */ -export type GlobalAccess = boolean | "off" | "readable" | "readonly" | "writable" | "writeable"; -/** @deprecated Only supported in legacy eslintrc config format. */ -export interface GlobalsConfig { - [name: string]: GlobalAccess; -} -/** - * The ECMAScript version of the code being linted. - * @deprecated Only supported in legacy eslintrc config format. - */ -export type EcmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026 | "latest"; -/** - * The type of JavaScript source code. - * @deprecated Only supported in legacy eslintrc config format. - */ -export type JavaScriptSourceType = "script" | "module" | "commonjs"; -/** - * Parser options. - * @deprecated Only supported in legacy eslintrc config format. - * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options#specifying-parser-options) - */ -export interface JavaScriptParserOptionsConfig { - /** - * Allow the use of reserved words as identifiers (if `ecmaVersion` is 3). - * - * @default false - */ - allowReserved?: boolean | undefined; - /** - * Accepts any valid ECMAScript version number or `'latest'`: - * - * - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, es14, ..., or - * - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, ..., or - * - `'latest'` - * - * When it's a version or a year, the value must be a number - so do not include the `es` prefix. - * - * Specifies the version of ECMAScript syntax you want to use. This is used by the parser to determine how to perform scope analysis, and it affects the default - * - * @default 5 - */ - ecmaVersion?: EcmaVersion | undefined; - /** - * The type of JavaScript source code. Possible values are "script" for - * traditional script files, "module" for ECMAScript modules (ESM), and - * "commonjs" for CommonJS files. - * - * @default 'script' - * - * @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options - */ - sourceType?: JavaScriptSourceType | undefined; - /** - * An object indicating which additional language features you'd like to use. - * - * @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options - */ - ecmaFeatures?: { - globalReturn?: boolean | undefined; - impliedStrict?: boolean | undefined; - jsx?: boolean | undefined; - experimentalObjectRestSpread?: boolean | undefined; - [key: string]: any; - } | undefined; - [key: string]: any; -} -/** @deprecated Only supported in legacy eslintrc config format. */ -export interface EnvironmentConfig { - /** The definition of global variables. */ - globals?: GlobalsConfig | undefined; - /** The parser options that will be enabled under this environment. */ - parserOptions?: JavaScriptParserOptionsConfig | undefined; -} -/** - * A configuration object that may have a `rules` block. - */ -export interface HasRules { - rules?: Partial | undefined; -} -/** - * ESLint legacy configuration. - * - * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) - */ -export interface BaseConfig extends HasRules { - $schema?: string | undefined; - /** - * An environment provides predefined global variables. - * - * @see [Environments](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-environments) - */ - env?: { - [name: string]: boolean; - } | undefined; - /** - * Extending configuration files. - * - * @see [Extends](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#extending-configuration-files) - */ - extends?: string | string[] | undefined; - /** - * Specifying globals. - * - * @see [Globals](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-globals) - */ - globals?: GlobalsConfig | undefined; - /** - * Disable processing of inline comments. - * - * @see [Disabling Inline Comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#disabling-inline-comments) - */ - noInlineConfig?: boolean | undefined; - /** - * Overrides can be used to use a differing configuration for matching sub-directories and files. - * - * @see [How do overrides work](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#how-do-overrides-work) - */ - overrides?: ConfigOverride[] | undefined; - /** - * Parser. - * - * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) - * @see [Specifying Parser](https://eslint.org/docs/latest/use/configure/parser-deprecated) - */ - parser?: string | undefined; - /** - * Parser options. - * - * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) - * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options) - */ - parserOptions?: JavaScriptParserOptionsConfig | undefined; - /** - * Which third-party plugins define additional rules, environments, configs, etc. for ESLint to use. - * - * @see [Configuring Plugins](https://eslint.org/docs/latest/use/configure/plugins-deprecated#configure-plugins) - */ - plugins?: string[] | undefined; - /** - * Specifying processor. - * - * @see [processor](https://eslint.org/docs/latest/use/configure/plugins-deprecated#specify-a-processor) - */ - processor?: string | undefined; - /** - * Report unused eslint-disable comments as warning. - * - * @see [Report unused eslint-disable comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#report-unused-eslint-disable-comments) - */ - reportUnusedDisableDirectives?: boolean | undefined; - /** - * Settings. - * - * @see [Settings](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#adding-shared-settings) - */ - settings?: SettingsConfig | undefined; -} -/** - * The overwrites that apply more differing configuration to specific files or directories. - */ -export interface ConfigOverride extends BaseConfig { - /** - * The glob patterns for excluded files. - */ - excludedFiles?: string | string[] | undefined; - /** - * The glob patterns for target files. - */ - files: string | string[]; -} -/** - * ESLint legacy configuration. - * - * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) - */ -export interface LegacyConfigObject extends BaseConfig { - /** - * Tell ESLint to ignore specific files and directories. - * - * @see [Ignore Patterns](https://eslint.org/docs/latest/use/configure/ignore-deprecated#ignorepatterns-in-config-files) - */ - ignorePatterns?: string | string[] | undefined; - /** - * @see [Using Configuration Files](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#using-configuration-files) - */ - root?: boolean | undefined; -} -/** - * File information passed to a processor. - */ -export interface ProcessorFile { - text: string; - filename: string; -} -/** - * A processor is an object that can preprocess and postprocess files. - */ -export interface Processor extends ObjectMetaProperties { - /** If `true` then it means the processor supports autofix. */ - supportsAutofix?: boolean | undefined; - /** The function to extract code blocks. */ - preprocess?(text: string, filename: string): T[]; - /** The function to merge messages. */ - postprocess?(messages: LintMessage[][], filename: string): LintMessage[]; -} -export interface Plugin extends ObjectMetaProperties { - meta?: ObjectMetaProperties["meta"] & { - namespace?: string | undefined; - }; - configs?: Record | undefined; - environments?: Record | undefined; - languages?: Record | undefined; - processors?: Record | undefined; - rules?: Record | undefined; -} -/** - * Generic options for the `Language` type. - */ -export interface LanguageTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RootNode: unknown; - Node: unknown; -} -/** - * Represents a plugin language. - */ -export interface Language { - /** - * Indicates how ESLint should read the file. - */ - fileType: "text"; - /** - * First line number returned from the parser (text mode only). - */ - lineStart: 0 | 1; - /** - * First column number returned from the parser (text mode only). - */ - columnStart: 0 | 1; - /** - * The property to read the node type from. Used in selector querying. - */ - nodeTypeKey: string; - /** - * The traversal path that tools should take when evaluating the AST - */ - visitorKeys?: Record; - /** - * Default language options. User-defined options are merged with this object. - */ - defaultLanguageOptions?: LanguageOptions; - /** - * Validates languageOptions for this language. - */ - validateLanguageOptions(languageOptions: Options["LangOptions"]): void; - /** - * Normalizes languageOptions for this language. - */ - normalizeLanguageOptions?(languageOptions: Options["LangOptions"]): Options["LangOptions"]; - /** - * Helper for esquery that allows languages to match nodes against - * class. esquery currently has classes like `function` that will - * match all the various function nodes. This method allows languages - * to implement similar shorthands. - */ - matchesSelectorClass?(className: string, node: Options["Node"], ancestry: Options["Node"][]): boolean; - /** - * Parses the given file input into its component parts. This file should not - * throws errors for parsing errors but rather should return any parsing - * errors as parse of the ParseResult object. - */ - parse(file: File, context: LanguageContext): ParseResult; - /** - * Creates SourceCode object that ESLint uses to work with a file. - */ - createSourceCode(file: File, input: OkParseResult, context: LanguageContext): Options["Code"]; -} -/** - * Plugin-defined options for the language. - */ -export type LanguageOptions = Record; -/** - * The context object that is passed to the language plugin methods. - */ -export interface LanguageContext { - languageOptions: LangOptions; -} -/** - * Represents a file read by ESLint. - */ -export interface File { - /** - * The path that ESLint uses for this file. May be a virtual path - * if it was returned by a processor. - */ - path: string; - /** - * The path to the file on disk. This always maps directly to a file - * regardless of whether it was returned from a processor. - */ - physicalPath: string; - /** - * Indicates if the original source contained a byte-order marker. - * ESLint strips the BOM from the `body`, but this info is needed - * to correctly apply autofixing. - */ - bom: boolean; - /** - * The body of the file to parse. - */ - body: string | Uint8Array; -} -/** - * Represents the successful result of parsing a file. - */ -export interface OkParseResult { - /** - * Indicates if the parse was successful. If true, the parse was successful - * and ESLint should continue on to create a SourceCode object and run rules; - * if false, ESLint should just report the error(s) without doing anything - * else. - */ - ok: true; - /** - * The abstract syntax tree created by the parser. (only when ok: true) - */ - ast: RootNode; - /** - * Any additional data that the parser wants to provide. - */ - [key: string]: any; -} -/** - * Represents the unsuccessful result of parsing a file. - */ -export interface NotOkParseResult { - /** - * Indicates if the parse was successful. If true, the parse was successful - * and ESLint should continue on to create a SourceCode object and run rules; - * if false, ESLint should just report the error(s) without doing anything - * else. - */ - ok: false; - /** - * Any parsing errors, whether fatal or not. (only when ok: false) - */ - errors: FileError[]; - /** - * Any additional data that the parser wants to provide. - */ - [key: string]: any; -} -export type ParseResult = OkParseResult | NotOkParseResult; -/** - * Represents inline configuration found in the source code. - */ -interface InlineConfigElement { - /** - * The location of the inline config element. - */ - loc: SourceLocation; - /** - * The interpreted configuration from the inline config element. - */ - config: { - rules: RulesConfig; - }; -} -/** - * Generic options for the `SourceCodeBase` type. - */ -export interface SourceCodeBaseTypeOptions { - LangOptions: LanguageOptions; - RootNode: unknown; - SyntaxElementWithLoc: unknown; - ConfigNode: unknown; -} -/** - * Represents the basic interface for a source code object. - */ -interface SourceCodeBase { - /** - * Root of the AST. - */ - ast: Options["RootNode"]; - /** - * The traversal path that tools should take when evaluating the AST. - * When present, this overrides the `visitorKeys` on the language for - * just this source code object. - */ - visitorKeys?: Record; - /** - * Retrieves the equivalent of `loc` for a given node or token. - * @param syntaxElement The node or token to get the location for. - * @returns The location of the node or token. - */ - getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation; - /** - * Retrieves the equivalent of `range` for a given node or token. - * @param syntaxElement The node or token to get the range for. - * @returns The range of the node or token. - */ - getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange; - /** - * Traversal of AST. - */ - traverse(): Iterable; - /** - * Applies language options passed in from the ESLint core. - */ - applyLanguageOptions?(languageOptions: Options["LangOptions"]): void; - /** - * Return all of the inline areas where ESLint should be disabled/enabled - * along with any problems found in evaluating the directives. - */ - getDisableDirectives?(): { - directives: Directive[]; - problems: FileProblem[]; - }; - /** - * Returns an array of all inline configuration nodes found in the - * source code. - */ - getInlineConfigNodes?(): Options["ConfigNode"][]; - /** - * Applies configuration found inside of the source code. This method is only - * called when ESLint is running with inline configuration allowed. - */ - applyInlineConfig?(): { - configs: InlineConfigElement[]; - problems: FileProblem[]; - }; - /** - * Called by ESLint core to indicate that it has finished providing - * information. We now add in all the missing variables and ensure that - * state-changing methods cannot be called by rules. - * @returns {void} - */ - finalize?(): void; -} -/** - * Represents the source of a text file being linted. - */ -export interface TextSourceCode extends SourceCodeBase { - /** - * The body of the file that you'd like rule developers to access. - */ - text: string; -} -/** - * Represents the source of a binary file being linted. - */ -export interface BinarySourceCode extends SourceCodeBase { - /** - * The body of the file that you'd like rule developers to access. - */ - body: Uint8Array; -} -export type SourceCode = TextSourceCode | BinarySourceCode; -/** - * Represents a traversal step visiting the AST. - */ -export interface VisitTraversalStep { - kind: 1; - target: unknown; - phase: 1 | 2; - args: unknown[]; -} -/** - * Represents a traversal step calling a function. - */ -export interface CallTraversalStep { - kind: 2; - target: string; - phase?: string; - args: unknown[]; -} -export type TraversalStep = VisitTraversalStep | CallTraversalStep; -/** - * The type of disable directive. This determines how ESLint will disable rules. - */ -export type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line"; -/** - * Represents a disable directive. - */ -export interface Directive { - /** - * The type of directive. - */ - type: DirectiveType; - /** - * The node of the directive. May be in the AST or a comment/token. - */ - node: unknown; - /** - * The value of the directive. - */ - value: string; - /** - * The justification for the directive. - */ - justification?: string; -} -export {}; diff --git a/node_modules/@eslint/config-helpers/node_modules/@eslint/core/package.json b/node_modules/@eslint/config-helpers/node_modules/@eslint/core/package.json deleted file mode 100644 index d2f470bb..00000000 --- a/node_modules/@eslint/config-helpers/node_modules/@eslint/core/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "@eslint/core", - "version": "0.17.0", - "description": "Runtime-agnostic core of ESLint", - "type": "module", - "types": "./dist/esm/types.d.ts", - "exports": { - "types": { - "import": "./dist/esm/types.d.ts", - "require": "./dist/cjs/types.d.cts" - } - }, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "scripts": { - "build:cts": "node -e \"fs.cpSync('dist/esm/types.d.ts', 'dist/cjs/types.d.cts')\"", - "build": "tsc && npm run build:cts", - "test:jsr": "npx jsr@latest publish --dry-run", - "test:types": "tsc -p tests/types/tsconfig.json" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/eslint/rewrite.git", - "directory": "packages/core" - }, - "keywords": [ - "eslint", - "core" - ], - "author": "Nicholas C. Zakas", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/eslint/rewrite/issues" - }, - "homepage": "https://github.com/eslint/rewrite/tree/main/packages/core#readme", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "devDependencies": { - "json-schema": "^0.4.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } -} diff --git a/node_modules/@eslint/core/README.md b/node_modules/@eslint/core/README.md index 28f216df..6c728333 100644 --- a/node_modules/@eslint/core/README.md +++ b/node_modules/@eslint/core/README.md @@ -22,7 +22,7 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).

Automattic Airbnb

Gold Sponsors

Qlty Software trunk.io Shopify

Silver Sponsors

Vite Liftoff American Express StackBlitz

Bronze Sponsors

-

Syntax Cybozu Sentry Discord GitBook Nx Mercedes-Benz Group HeroCoders LambdaTest

+

Syntax Cybozu Sentry Icons8 Discord GitBook Nx Mercedes-Benz Group HeroCoders LambdaTest

Technology Sponsors

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.

Netlify Algolia 1Password

diff --git a/node_modules/@eslint/core/dist/cjs/types.d.cts b/node_modules/@eslint/core/dist/cjs/types.d.cts index 10096837..3fa4bebc 100644 --- a/node_modules/@eslint/core/dist/cjs/types.d.cts +++ b/node_modules/@eslint/core/dist/cjs/types.d.cts @@ -117,7 +117,7 @@ export interface RulesMeta RuleTextEdit | Iterable | null; -interface ViolationReportBase { +export type RuleFixer = (fixer: RuleTextEditor) => RuleTextEdit | Iterable | null; +export interface ViolationReportBase { /** * The data to insert into the message. */ - data?: Record | undefined; + data?: Record | undefined; /** * The fix to be applied for the violation. */ @@ -387,28 +387,28 @@ interface ViolationReportBase { */ suggest?: SuggestedEdit[] | null | undefined; } -type ViolationMessage = { +export type ViolationMessage = { message: string; } | { messageId: MessageIds; }; -type ViolationLocation = { +export type ViolationLocation = { loc: SourceLocation | Position; } | { node: Node; }; export type ViolationReport = ViolationReportBase & ViolationMessage & ViolationLocation; -interface SuggestedEditBase { +export interface SuggestedEditBase { /** * The data to insert into the message. */ - data?: Record | undefined; + data?: Record | undefined; /** * The fix to be applied for the suggestion. */ - fix?: RuleFixer | null | undefined; + fix: RuleFixer; } -type SuggestionMessage = { +export type SuggestionMessage = { desc: string; } | { messageId: string; @@ -420,7 +420,7 @@ export type SuggestedEdit = SuggestedEditBase & SuggestionMessage; /** * The normalized version of a lint suggestion. */ -interface LintSuggestion { +export interface LintSuggestion { /** A short description. */ desc: string; /** Fix result info. */ @@ -662,7 +662,7 @@ export type EcmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * The type of JavaScript source code. * @deprecated Only supported in legacy eslintrc config format. */ -type JavaScriptSourceType = "script" | "module" | "commonjs"; +export type JavaScriptSourceType = "script" | "module" | "commonjs"; /** * Parser options. * @deprecated Only supported in legacy eslintrc config format. @@ -723,7 +723,7 @@ export interface EnvironmentConfig { /** * A configuration object that may have a `rules` block. */ -interface HasRules { +export interface HasRules { rules?: Partial | undefined; } /** @@ -731,7 +731,7 @@ interface HasRules { * * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) */ -interface BaseConfig extends HasRules { +export interface BaseConfig extends HasRules { $schema?: string | undefined; /** * An environment provides predefined global variables. diff --git a/node_modules/@eslint/core/dist/esm/types.d.ts b/node_modules/@eslint/core/dist/esm/types.d.ts index 10096837..3fa4bebc 100644 --- a/node_modules/@eslint/core/dist/esm/types.d.ts +++ b/node_modules/@eslint/core/dist/esm/types.d.ts @@ -117,7 +117,7 @@ export interface RulesMeta RuleTextEdit | Iterable | null; -interface ViolationReportBase { +export type RuleFixer = (fixer: RuleTextEditor) => RuleTextEdit | Iterable | null; +export interface ViolationReportBase { /** * The data to insert into the message. */ - data?: Record | undefined; + data?: Record | undefined; /** * The fix to be applied for the violation. */ @@ -387,28 +387,28 @@ interface ViolationReportBase { */ suggest?: SuggestedEdit[] | null | undefined; } -type ViolationMessage = { +export type ViolationMessage = { message: string; } | { messageId: MessageIds; }; -type ViolationLocation = { +export type ViolationLocation = { loc: SourceLocation | Position; } | { node: Node; }; export type ViolationReport = ViolationReportBase & ViolationMessage & ViolationLocation; -interface SuggestedEditBase { +export interface SuggestedEditBase { /** * The data to insert into the message. */ - data?: Record | undefined; + data?: Record | undefined; /** * The fix to be applied for the suggestion. */ - fix?: RuleFixer | null | undefined; + fix: RuleFixer; } -type SuggestionMessage = { +export type SuggestionMessage = { desc: string; } | { messageId: string; @@ -420,7 +420,7 @@ export type SuggestedEdit = SuggestedEditBase & SuggestionMessage; /** * The normalized version of a lint suggestion. */ -interface LintSuggestion { +export interface LintSuggestion { /** A short description. */ desc: string; /** Fix result info. */ @@ -662,7 +662,7 @@ export type EcmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * The type of JavaScript source code. * @deprecated Only supported in legacy eslintrc config format. */ -type JavaScriptSourceType = "script" | "module" | "commonjs"; +export type JavaScriptSourceType = "script" | "module" | "commonjs"; /** * Parser options. * @deprecated Only supported in legacy eslintrc config format. @@ -723,7 +723,7 @@ export interface EnvironmentConfig { /** * A configuration object that may have a `rules` block. */ -interface HasRules { +export interface HasRules { rules?: Partial | undefined; } /** @@ -731,7 +731,7 @@ interface HasRules { * * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) */ -interface BaseConfig extends HasRules { +export interface BaseConfig extends HasRules { $schema?: string | undefined; /** * An environment provides predefined global variables. diff --git a/node_modules/@eslint/core/package.json b/node_modules/@eslint/core/package.json index 99951312..d2f470bb 100644 --- a/node_modules/@eslint/core/package.json +++ b/node_modules/@eslint/core/package.json @@ -1,6 +1,6 @@ { "name": "@eslint/core", - "version": "0.16.0", + "version": "0.17.0", "description": "Runtime-agnostic core of ESLint", "type": "module", "types": "./dist/esm/types.d.ts", diff --git a/node_modules/@eslint/js/package.json b/node_modules/@eslint/js/package.json index 65dbba16..20adef18 100644 --- a/node_modules/@eslint/js/package.json +++ b/node_modules/@eslint/js/package.json @@ -1,6 +1,6 @@ { "name": "@eslint/js", - "version": "9.38.0", + "version": "9.39.0", "description": "ESLint JavaScript language implementation", "funding": "https://eslint.org/donate", "main": "./src/index.js", diff --git a/node_modules/@eslint/js/src/configs/eslint-recommended.js b/node_modules/@eslint/js/src/configs/eslint-recommended.js index d4105c1e..9ff6a398 100644 --- a/node_modules/@eslint/js/src/configs/eslint-recommended.js +++ b/node_modules/@eslint/js/src/configs/eslint-recommended.js @@ -1,13 +1,9 @@ -/** - * @fileoverview Configuration applied when a user configuration extends from - * eslint:recommended. - * @author Nicholas C. Zakas +/* + * WARNING: This file is autogenerated using the tools/update-eslint-recommended.js + * script. Do not edit manually. */ - "use strict"; -/* eslint sort-keys: ["error", "asc"] -- Long, so make more readable */ - /* * IMPORTANT! * @@ -17,67 +13,67 @@ */ module.exports = Object.freeze({ - rules: Object.freeze({ - "constructor-super": "error", - "for-direction": "error", - "getter-return": "error", - "no-async-promise-executor": "error", - "no-case-declarations": "error", - "no-class-assign": "error", - "no-compare-neg-zero": "error", - "no-cond-assign": "error", - "no-const-assign": "error", - "no-constant-binary-expression": "error", - "no-constant-condition": "error", - "no-control-regex": "error", - "no-debugger": "error", - "no-delete-var": "error", - "no-dupe-args": "error", - "no-dupe-class-members": "error", - "no-dupe-else-if": "error", - "no-dupe-keys": "error", - "no-duplicate-case": "error", - "no-empty": "error", - "no-empty-character-class": "error", - "no-empty-pattern": "error", - "no-empty-static-block": "error", - "no-ex-assign": "error", - "no-extra-boolean-cast": "error", - "no-fallthrough": "error", - "no-func-assign": "error", - "no-global-assign": "error", - "no-import-assign": "error", - "no-invalid-regexp": "error", - "no-irregular-whitespace": "error", - "no-loss-of-precision": "error", - "no-misleading-character-class": "error", - "no-new-native-nonconstructor": "error", - "no-nonoctal-decimal-escape": "error", - "no-obj-calls": "error", - "no-octal": "error", - "no-prototype-builtins": "error", - "no-redeclare": "error", - "no-regex-spaces": "error", - "no-self-assign": "error", - "no-setter-return": "error", - "no-shadow-restricted-names": "error", - "no-sparse-arrays": "error", - "no-this-before-super": "error", - "no-undef": "error", - "no-unexpected-multiline": "error", - "no-unreachable": "error", - "no-unsafe-finally": "error", - "no-unsafe-negation": "error", - "no-unsafe-optional-chaining": "error", - "no-unused-labels": "error", - "no-unused-private-class-members": "error", - "no-unused-vars": "error", - "no-useless-backreference": "error", - "no-useless-catch": "error", - "no-useless-escape": "error", - "no-with": "error", - "require-yield": "error", - "use-isnan": "error", - "valid-typeof": "error", - }), + rules: Object.freeze({ + "constructor-super": "error", + "for-direction": "error", + "getter-return": "error", + "no-async-promise-executor": "error", + "no-case-declarations": "error", + "no-class-assign": "error", + "no-compare-neg-zero": "error", + "no-cond-assign": "error", + "no-const-assign": "error", + "no-constant-binary-expression": "error", + "no-constant-condition": "error", + "no-control-regex": "error", + "no-debugger": "error", + "no-delete-var": "error", + "no-dupe-args": "error", + "no-dupe-class-members": "error", + "no-dupe-else-if": "error", + "no-dupe-keys": "error", + "no-duplicate-case": "error", + "no-empty": "error", + "no-empty-character-class": "error", + "no-empty-pattern": "error", + "no-empty-static-block": "error", + "no-ex-assign": "error", + "no-extra-boolean-cast": "error", + "no-fallthrough": "error", + "no-func-assign": "error", + "no-global-assign": "error", + "no-import-assign": "error", + "no-invalid-regexp": "error", + "no-irregular-whitespace": "error", + "no-loss-of-precision": "error", + "no-misleading-character-class": "error", + "no-new-native-nonconstructor": "error", + "no-nonoctal-decimal-escape": "error", + "no-obj-calls": "error", + "no-octal": "error", + "no-prototype-builtins": "error", + "no-redeclare": "error", + "no-regex-spaces": "error", + "no-self-assign": "error", + "no-setter-return": "error", + "no-shadow-restricted-names": "error", + "no-sparse-arrays": "error", + "no-this-before-super": "error", + "no-undef": "error", + "no-unexpected-multiline": "error", + "no-unreachable": "error", + "no-unsafe-finally": "error", + "no-unsafe-negation": "error", + "no-unsafe-optional-chaining": "error", + "no-unused-labels": "error", + "no-unused-private-class-members": "error", + "no-unused-vars": "error", + "no-useless-backreference": "error", + "no-useless-catch": "error", + "no-useless-escape": "error", + "no-with": "error", + "require-yield": "error", + "use-isnan": "error", + "valid-typeof": "error" + }), }); diff --git a/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/LICENSE b/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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. diff --git a/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/README.md b/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/README.md deleted file mode 100644 index 6c728333..00000000 --- a/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# ESLint Core - -## Overview - -This package is the future home of the rewritten, runtime-agnostic ESLint core. - -Right now, it exports the core types necessary to implement language plugins. - -## License - -Apache 2.0 - - - - -## 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). - -

Platinum Sponsors

-

Automattic Airbnb

Gold Sponsors

-

Qlty Software trunk.io Shopify

Silver Sponsors

-

Vite Liftoff American Express StackBlitz

Bronze Sponsors

-

Syntax Cybozu Sentry Icons8 Discord GitBook Nx Mercedes-Benz Group HeroCoders LambdaTest

-

Technology Sponsors

-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. -

Netlify Algolia 1Password

- diff --git a/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/dist/cjs/types.d.cts b/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/dist/cjs/types.d.cts deleted file mode 100644 index 3fa4bebc..00000000 --- a/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/dist/cjs/types.d.cts +++ /dev/null @@ -1,1179 +0,0 @@ -/** - * @fileoverview Shared types for ESLint Core. - */ -import type { JSONSchema4 } from "json-schema"; -/** - * Represents an error inside of a file. - */ -export interface FileError { - message: string; - line: number; - column: number; - endLine?: number; - endColumn?: number; -} -/** - * Represents a problem found in a file. - */ -export interface FileProblem { - ruleId: string | null; - message: string; - loc: SourceLocation; -} -/** - * Represents the start and end coordinates of a node inside the source. - */ -export interface SourceLocation { - start: Position; - end: Position; -} -/** - * Represents the start and end coordinates of a node inside the source with an offset. - */ -export interface SourceLocationWithOffset { - start: PositionWithOffset; - end: PositionWithOffset; -} -/** - * Represents a location coordinate inside the source. ESLint-style formats - * have just `line` and `column` while others may have `offset` as well. - */ -export interface Position { - line: number; - column: number; -} -/** - * Represents a location coordinate inside the source with an offset. - */ -export interface PositionWithOffset extends Position { - offset: number; -} -/** - * Represents a range of characters in the source. - */ -export type SourceRange = [number, number]; -/** - * What the rule is responsible for finding: - * - `problem` means the rule has noticed a potential error. - * - `suggestion` means the rule suggests an alternate or better approach. - * - `layout` means the rule is looking at spacing, indentation, etc. - */ -export type RuleType = "problem" | "suggestion" | "layout"; -/** - * The type of fix the rule can provide: - * - `code` means the rule can fix syntax. - * - `whitespace` means the rule can fix spacing and indentation. - */ -export type RuleFixType = "code" | "whitespace"; -/** - * An object containing visitor information for a rule. Each method is either the - * name of a node type or a selector, or is a method that will be called at specific - * times during the traversal. - */ -export type RuleVisitor = Record void) | undefined>; -/** - * Rule meta information used for documentation. - */ -export interface RulesMetaDocs { - /** - * A short description of the rule. - */ - description?: string | undefined; - /** - * The URL to the documentation for the rule. - */ - url?: string | undefined; - /** - * The category the rule falls under. - * @deprecated No longer used. - */ - category?: string | undefined; - /** - * Indicates if the rule is generally recommended for all users. - * - * Note - this will always be a boolean for core rules, but may be used in any way by plugins. - */ - recommended?: unknown; - /** - * Indicates if the rule is frozen (no longer accepting feature requests). - */ - frozen?: boolean | undefined; -} -/** - * Meta information about a rule. - */ -export interface RulesMeta { - /** - * Properties that are used when documenting the rule. - */ - docs?: (RulesMetaDocs & ExtRuleDocs) | undefined; - /** - * The type of rule. - */ - type?: RuleType | undefined; - /** - * The schema for the rule options. Required if the rule has options. - */ - schema?: JSONSchema4 | JSONSchema4[] | false | undefined; - /** - * Any default options to be recursively merged on top of any user-provided options. - */ - defaultOptions?: RuleOptions; - /** - * The messages that the rule can report. - */ - messages?: Record; - /** - * Indicates whether the rule has been deprecated or provides additional metadata about the deprecation. Omit if not deprecated. - */ - deprecated?: boolean | DeprecatedInfo | undefined; - /** - * @deprecated Use deprecated.replacedBy instead. - * The name of the rule(s) this rule was replaced by, if it was deprecated. - */ - replacedBy?: readonly string[] | undefined; - /** - * Indicates if the rule is fixable, and if so, what type of fix it provides. - */ - fixable?: RuleFixType | undefined; - /** - * Indicates if the rule may provide suggestions. - */ - hasSuggestions?: boolean | undefined; - /** - * The language the rule is intended to lint. - */ - language?: string; - /** - * The dialects of `language` that the rule is intended to lint. - */ - dialects?: string[]; -} -/** - * Provides additional metadata about a deprecation. - */ -export interface DeprecatedInfo { - /** - * General message presented to the user, e.g. for the key rule why the rule - * is deprecated or for info how to replace the rule. - */ - message?: string; - /** - * URL to more information about this deprecation in general. - */ - url?: string; - /** - * An empty array explicitly states that there is no replacement. - */ - replacedBy?: ReplacedByInfo[]; - /** - * The package version since when the rule is deprecated (should use full - * semver without a leading "v"). - */ - deprecatedSince?: string; - /** - * The estimated version when the rule is removed (probably the next major - * version). null means the rule is "frozen" (will be available but will not - * be changed). - */ - availableUntil?: string | null; -} -/** - * Provides metadata about a replacement - */ -export interface ReplacedByInfo { - /** - * General message presented to the user, e.g. how to replace the rule - */ - message?: string; - /** - * URL to more information about this replacement in general - */ - url?: string; - /** - * Name should be "eslint" if the replacement is an ESLint core rule. Omit - * the property if the replacement is in the same plugin. - */ - plugin?: ExternalSpecifier; - /** - * Name and documentation of the replacement rule - */ - rule?: ExternalSpecifier; -} -/** - * Specifies the name and url of an external resource. At least one property - * should be set. - */ -export interface ExternalSpecifier { - /** - * Name of the referenced plugin / rule. - */ - name?: string; - /** - * URL pointing to documentation for the plugin / rule. - */ - url?: string; -} -/** - * Generic type for `RuleContext`. - */ -export interface RuleContextTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RuleOptions: unknown[]; - Node: unknown; - MessageIds: string; -} -/** - * Represents the context object that is passed to a rule. This object contains - * information about the current state of the linting process and is the rule's - * view into the outside world. - */ -export interface RuleContext { - /** - * The current working directory for the session. - */ - cwd: string; - /** - * Returns the current working directory for the session. - * @deprecated Use `cwd` instead. - */ - getCwd(): string; - /** - * The filename of the file being linted. - */ - filename: string; - /** - * Returns the filename of the file being linted. - * @deprecated Use `filename` instead. - */ - getFilename(): string; - /** - * The physical filename of the file being linted. - */ - physicalFilename: string; - /** - * Returns the physical filename of the file being linted. - * @deprecated Use `physicalFilename` instead. - */ - getPhysicalFilename(): string; - /** - * The source code object that the rule is running on. - */ - sourceCode: Options["Code"]; - /** - * Returns the source code object that the rule is running on. - * @deprecated Use `sourceCode` instead. - */ - getSourceCode(): Options["Code"]; - /** - * Shared settings for the configuration. - */ - settings: SettingsConfig; - /** - * Parser-specific options for the configuration. - * @deprecated Use `languageOptions.parserOptions` instead. - */ - parserOptions: Record; - /** - * The language options for the configuration. - */ - languageOptions: Options["LangOptions"]; - /** - * The CommonJS path to the parser used while parsing this file. - * @deprecated No longer used. - */ - parserPath: string | undefined; - /** - * The rule ID. - */ - id: string; - /** - * The rule's configured options. - */ - options: Options["RuleOptions"]; - /** - * The report function that the rule should use to report problems. - * @param violation The violation to report. - */ - report(violation: ViolationReport): void; -} -/** - * Manager of text edits for a rule fix. - */ -export interface RuleTextEditor { - /** - * Inserts text after the specified node or token. - * @param syntaxElement The node or token to insert after. - * @param text The edit to insert after the node or token. - */ - insertTextAfter(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Inserts text after the specified range. - * @param range The range to insert after. - * @param text The edit to insert after the range. - */ - insertTextAfterRange(range: SourceRange, text: string): RuleTextEdit; - /** - * Inserts text before the specified node or token. - * @param syntaxElement A syntax element with location information to insert before. - * @param text The edit to insert before the node or token. - */ - insertTextBefore(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Inserts text before the specified range. - * @param range The range to insert before. - * @param text The edit to insert before the range. - */ - insertTextBeforeRange(range: SourceRange, text: string): RuleTextEdit; - /** - * Removes the specified node or token. - * @param syntaxElement A syntax element with location information to remove. - * @returns The edit to remove the node or token. - */ - remove(syntaxElement: EditableSyntaxElement): RuleTextEdit; - /** - * Removes the specified range. - * @param range The range to remove. - * @returns The edit to remove the range. - */ - removeRange(range: SourceRange): RuleTextEdit; - /** - * Replaces the specified node or token with the given text. - * @param syntaxElement A syntax element with location information to replace. - * @param text The text to replace the node or token with. - * @returns The edit to replace the node or token. - */ - replaceText(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Replaces the specified range with the given text. - * @param range The range to replace. - * @param text The text to replace the range with. - * @returns The edit to replace the range. - */ - replaceTextRange(range: SourceRange, text: string): RuleTextEdit; -} -/** - * Represents a fix for a rule violation implemented as a text edit. - */ -export interface RuleTextEdit { - /** - * The range to replace. - */ - range: SourceRange; - /** - * The text to insert. - */ - text: string; -} -/** - * Fixes a violation. - * @param fixer The text editor to apply the fix. - * @returns The fix(es) for the violation. - */ -export type RuleFixer = (fixer: RuleTextEditor) => RuleTextEdit | Iterable | null; -export interface ViolationReportBase { - /** - * The data to insert into the message. - */ - data?: Record | undefined; - /** - * The fix to be applied for the violation. - */ - fix?: RuleFixer | null | undefined; - /** - * An array of suggested fixes for the problem. These fixes may change the - * behavior of the code, so they are not applied automatically. - */ - suggest?: SuggestedEdit[] | null | undefined; -} -export type ViolationMessage = { - message: string; -} | { - messageId: MessageIds; -}; -export type ViolationLocation = { - loc: SourceLocation | Position; -} | { - node: Node; -}; -export type ViolationReport = ViolationReportBase & ViolationMessage & ViolationLocation; -export interface SuggestedEditBase { - /** - * The data to insert into the message. - */ - data?: Record | undefined; - /** - * The fix to be applied for the suggestion. - */ - fix: RuleFixer; -} -export type SuggestionMessage = { - desc: string; -} | { - messageId: string; -}; -/** - * A suggested edit for a rule violation. - */ -export type SuggestedEdit = SuggestedEditBase & SuggestionMessage; -/** - * The normalized version of a lint suggestion. - */ -export interface LintSuggestion { - /** A short description. */ - desc: string; - /** Fix result info. */ - fix: RuleTextEdit; - /** Id referencing a message for the description. */ - messageId?: string | undefined; -} -/** - * The normalized version of a lint violation message. - */ -export interface LintMessage { - /** The 1-based column number. */ - column: number; - /** The 1-based line number. */ - line: number; - /** The 1-based column number of the end location. */ - endColumn?: number | undefined; - /** The 1-based line number of the end location. */ - endLine?: number | undefined; - /** The ID of the rule which makes this message. */ - ruleId: string | null; - /** The reported message. */ - message: string; - /** The ID of the message in the rule's meta. */ - messageId?: string | undefined; - /** - * Type of node. - * @deprecated `nodeType` is deprecated and will be removed in the next major version. - */ - nodeType?: string | undefined; - /** If `true` then this is a fatal error. */ - fatal?: true | undefined; - /** The severity of this message. */ - severity: Exclude; - /** Information for autofix. */ - fix?: RuleTextEdit | undefined; - /** Information for suggestions. */ - suggestions?: LintSuggestion[] | undefined; -} -/** - * Generic options for the `RuleDefinition` type. - */ -export interface RuleDefinitionTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RuleOptions: unknown[]; - Visitor: RuleVisitor; - Node: unknown; - MessageIds: string; - ExtRuleDocs: unknown; -} -/** - * The definition of an ESLint rule. - */ -export interface RuleDefinition { - /** - * The meta information for the rule. - */ - meta?: RulesMeta; - /** - * Creates the visitor that ESLint uses to apply the rule during traversal. - * @param context The rule context. - * @returns The rule visitor. - */ - create(context: RuleContext<{ - LangOptions: Options["LangOptions"]; - Code: Options["Code"]; - RuleOptions: Options["RuleOptions"]; - Node: Options["Node"]; - MessageIds: Options["MessageIds"]; - }>): Options["Visitor"]; -} -/** - * Defaults for non-language-related `RuleDefinition` options. - */ -export interface CustomRuleTypeDefinitions { - RuleOptions: unknown[]; - MessageIds: string; - ExtRuleDocs: Record; -} -/** - * A helper type to define language specific specializations of the `RuleDefinition` type. - * - * @example - * ```ts - * type YourRuleDefinition< - * Options extends Partial = {}, - * > = CustomRuleDefinitionType< - * { - * LangOptions: YourLanguageOptions; - * Code: YourSourceCode; - * Visitor: YourRuleVisitor; - * Node: YourNode; - * }, - * Options - * >; - * ``` - */ -export type CustomRuleDefinitionType, Options extends Partial> = RuleDefinition>>; -/** - * The human readable severity level used in a configuration. - */ -export type SeverityName = "off" | "warn" | "error"; -/** - * The numeric severity level for a rule. - * - * - `0` means off. - * - `1` means warn. - * - `2` means error. - */ -export type SeverityLevel = 0 | 1 | 2; -/** - * The severity of a rule in a configuration. - */ -export type Severity = SeverityName | SeverityLevel; -/** - * Represents the metadata for an object, such as a plugin or processor. - */ -export interface ObjectMetaProperties { - /** @deprecated Use `meta.name` instead. */ - name?: string | undefined; - /** @deprecated Use `meta.version` instead. */ - version?: string | undefined; - meta?: { - name?: string | undefined; - version?: string | undefined; - }; -} -/** - * Represents the configuration options for the core linter. - */ -export interface LinterOptionsConfig { - /** - * Indicates whether or not inline configuration is evaluated. - */ - noInlineConfig?: boolean; - /** - * Indicates what to do when an unused disable directive is found. - */ - reportUnusedDisableDirectives?: boolean | Severity; - /** - * A severity value indicating if and how unused inline configs should be - * tracked and reported. - */ - reportUnusedInlineConfigs?: Severity; -} -/** - * The configuration for a rule. - */ -export type RuleConfig = Severity | [Severity, ...Partial]; -/** - * A collection of rules and their configurations. - */ -export interface RulesConfig { - [key: string]: RuleConfig; -} -/** - * A collection of settings. - */ -export interface SettingsConfig { - [key: string]: unknown; -} -/** - * The configuration for a set of files. - */ -export interface ConfigObject { - /** - * A string to identify the configuration object. Used in error messages and - * inspection tools. - */ - name?: string; - /** - * Path to the directory where the configuration object should apply. - * `files` and `ignores` patterns in the configuration object are - * interpreted as relative to this path. - */ - basePath?: string; - /** - * An array of glob patterns indicating the files that the configuration - * object should apply to. If not specified, the configuration object applies - * to all files - */ - files?: (string | string[])[]; - /** - * An array of glob patterns indicating the files that the configuration - * object should not apply to. If not specified, the configuration object - * applies to all files matched by files - */ - ignores?: string[]; - /** - * The name of the language used for linting. This is used to determine the - * parser and other language-specific settings. - * @since 9.7.0 - */ - language?: string; - /** - * An object containing settings related to how the language is configured for - * linting. - */ - languageOptions?: LanguageOptions; - /** - * An object containing settings related to the linting process - */ - linterOptions?: LinterOptionsConfig; - /** - * Either an object containing preprocess() and postprocess() methods or a - * string indicating the name of a processor inside of a plugin - * (i.e., "pluginName/processorName"). - */ - processor?: string | Processor; - /** - * An object containing a name-value mapping of plugin names to plugin objects. - * When files is specified, these plugins are only available to the matching files. - */ - plugins?: Record; - /** - * An object containing the configured rules. When files or ignores are specified, - * these rule configurations are only available to the matching files. - */ - rules?: Partial; - /** - * An object containing name-value pairs of information that should be - * available to all rules. - */ - settings?: Record; -} -/** @deprecated Only supported in legacy eslintrc config format. */ -export type GlobalAccess = boolean | "off" | "readable" | "readonly" | "writable" | "writeable"; -/** @deprecated Only supported in legacy eslintrc config format. */ -export interface GlobalsConfig { - [name: string]: GlobalAccess; -} -/** - * The ECMAScript version of the code being linted. - * @deprecated Only supported in legacy eslintrc config format. - */ -export type EcmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026 | "latest"; -/** - * The type of JavaScript source code. - * @deprecated Only supported in legacy eslintrc config format. - */ -export type JavaScriptSourceType = "script" | "module" | "commonjs"; -/** - * Parser options. - * @deprecated Only supported in legacy eslintrc config format. - * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options#specifying-parser-options) - */ -export interface JavaScriptParserOptionsConfig { - /** - * Allow the use of reserved words as identifiers (if `ecmaVersion` is 3). - * - * @default false - */ - allowReserved?: boolean | undefined; - /** - * Accepts any valid ECMAScript version number or `'latest'`: - * - * - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, es14, ..., or - * - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, ..., or - * - `'latest'` - * - * When it's a version or a year, the value must be a number - so do not include the `es` prefix. - * - * Specifies the version of ECMAScript syntax you want to use. This is used by the parser to determine how to perform scope analysis, and it affects the default - * - * @default 5 - */ - ecmaVersion?: EcmaVersion | undefined; - /** - * The type of JavaScript source code. Possible values are "script" for - * traditional script files, "module" for ECMAScript modules (ESM), and - * "commonjs" for CommonJS files. - * - * @default 'script' - * - * @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options - */ - sourceType?: JavaScriptSourceType | undefined; - /** - * An object indicating which additional language features you'd like to use. - * - * @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options - */ - ecmaFeatures?: { - globalReturn?: boolean | undefined; - impliedStrict?: boolean | undefined; - jsx?: boolean | undefined; - experimentalObjectRestSpread?: boolean | undefined; - [key: string]: any; - } | undefined; - [key: string]: any; -} -/** @deprecated Only supported in legacy eslintrc config format. */ -export interface EnvironmentConfig { - /** The definition of global variables. */ - globals?: GlobalsConfig | undefined; - /** The parser options that will be enabled under this environment. */ - parserOptions?: JavaScriptParserOptionsConfig | undefined; -} -/** - * A configuration object that may have a `rules` block. - */ -export interface HasRules { - rules?: Partial | undefined; -} -/** - * ESLint legacy configuration. - * - * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) - */ -export interface BaseConfig extends HasRules { - $schema?: string | undefined; - /** - * An environment provides predefined global variables. - * - * @see [Environments](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-environments) - */ - env?: { - [name: string]: boolean; - } | undefined; - /** - * Extending configuration files. - * - * @see [Extends](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#extending-configuration-files) - */ - extends?: string | string[] | undefined; - /** - * Specifying globals. - * - * @see [Globals](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-globals) - */ - globals?: GlobalsConfig | undefined; - /** - * Disable processing of inline comments. - * - * @see [Disabling Inline Comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#disabling-inline-comments) - */ - noInlineConfig?: boolean | undefined; - /** - * Overrides can be used to use a differing configuration for matching sub-directories and files. - * - * @see [How do overrides work](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#how-do-overrides-work) - */ - overrides?: ConfigOverride[] | undefined; - /** - * Parser. - * - * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) - * @see [Specifying Parser](https://eslint.org/docs/latest/use/configure/parser-deprecated) - */ - parser?: string | undefined; - /** - * Parser options. - * - * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) - * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options) - */ - parserOptions?: JavaScriptParserOptionsConfig | undefined; - /** - * Which third-party plugins define additional rules, environments, configs, etc. for ESLint to use. - * - * @see [Configuring Plugins](https://eslint.org/docs/latest/use/configure/plugins-deprecated#configure-plugins) - */ - plugins?: string[] | undefined; - /** - * Specifying processor. - * - * @see [processor](https://eslint.org/docs/latest/use/configure/plugins-deprecated#specify-a-processor) - */ - processor?: string | undefined; - /** - * Report unused eslint-disable comments as warning. - * - * @see [Report unused eslint-disable comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#report-unused-eslint-disable-comments) - */ - reportUnusedDisableDirectives?: boolean | undefined; - /** - * Settings. - * - * @see [Settings](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#adding-shared-settings) - */ - settings?: SettingsConfig | undefined; -} -/** - * The overwrites that apply more differing configuration to specific files or directories. - */ -export interface ConfigOverride extends BaseConfig { - /** - * The glob patterns for excluded files. - */ - excludedFiles?: string | string[] | undefined; - /** - * The glob patterns for target files. - */ - files: string | string[]; -} -/** - * ESLint legacy configuration. - * - * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) - */ -export interface LegacyConfigObject extends BaseConfig { - /** - * Tell ESLint to ignore specific files and directories. - * - * @see [Ignore Patterns](https://eslint.org/docs/latest/use/configure/ignore-deprecated#ignorepatterns-in-config-files) - */ - ignorePatterns?: string | string[] | undefined; - /** - * @see [Using Configuration Files](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#using-configuration-files) - */ - root?: boolean | undefined; -} -/** - * File information passed to a processor. - */ -export interface ProcessorFile { - text: string; - filename: string; -} -/** - * A processor is an object that can preprocess and postprocess files. - */ -export interface Processor extends ObjectMetaProperties { - /** If `true` then it means the processor supports autofix. */ - supportsAutofix?: boolean | undefined; - /** The function to extract code blocks. */ - preprocess?(text: string, filename: string): T[]; - /** The function to merge messages. */ - postprocess?(messages: LintMessage[][], filename: string): LintMessage[]; -} -export interface Plugin extends ObjectMetaProperties { - meta?: ObjectMetaProperties["meta"] & { - namespace?: string | undefined; - }; - configs?: Record | undefined; - environments?: Record | undefined; - languages?: Record | undefined; - processors?: Record | undefined; - rules?: Record | undefined; -} -/** - * Generic options for the `Language` type. - */ -export interface LanguageTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RootNode: unknown; - Node: unknown; -} -/** - * Represents a plugin language. - */ -export interface Language { - /** - * Indicates how ESLint should read the file. - */ - fileType: "text"; - /** - * First line number returned from the parser (text mode only). - */ - lineStart: 0 | 1; - /** - * First column number returned from the parser (text mode only). - */ - columnStart: 0 | 1; - /** - * The property to read the node type from. Used in selector querying. - */ - nodeTypeKey: string; - /** - * The traversal path that tools should take when evaluating the AST - */ - visitorKeys?: Record; - /** - * Default language options. User-defined options are merged with this object. - */ - defaultLanguageOptions?: LanguageOptions; - /** - * Validates languageOptions for this language. - */ - validateLanguageOptions(languageOptions: Options["LangOptions"]): void; - /** - * Normalizes languageOptions for this language. - */ - normalizeLanguageOptions?(languageOptions: Options["LangOptions"]): Options["LangOptions"]; - /** - * Helper for esquery that allows languages to match nodes against - * class. esquery currently has classes like `function` that will - * match all the various function nodes. This method allows languages - * to implement similar shorthands. - */ - matchesSelectorClass?(className: string, node: Options["Node"], ancestry: Options["Node"][]): boolean; - /** - * Parses the given file input into its component parts. This file should not - * throws errors for parsing errors but rather should return any parsing - * errors as parse of the ParseResult object. - */ - parse(file: File, context: LanguageContext): ParseResult; - /** - * Creates SourceCode object that ESLint uses to work with a file. - */ - createSourceCode(file: File, input: OkParseResult, context: LanguageContext): Options["Code"]; -} -/** - * Plugin-defined options for the language. - */ -export type LanguageOptions = Record; -/** - * The context object that is passed to the language plugin methods. - */ -export interface LanguageContext { - languageOptions: LangOptions; -} -/** - * Represents a file read by ESLint. - */ -export interface File { - /** - * The path that ESLint uses for this file. May be a virtual path - * if it was returned by a processor. - */ - path: string; - /** - * The path to the file on disk. This always maps directly to a file - * regardless of whether it was returned from a processor. - */ - physicalPath: string; - /** - * Indicates if the original source contained a byte-order marker. - * ESLint strips the BOM from the `body`, but this info is needed - * to correctly apply autofixing. - */ - bom: boolean; - /** - * The body of the file to parse. - */ - body: string | Uint8Array; -} -/** - * Represents the successful result of parsing a file. - */ -export interface OkParseResult { - /** - * Indicates if the parse was successful. If true, the parse was successful - * and ESLint should continue on to create a SourceCode object and run rules; - * if false, ESLint should just report the error(s) without doing anything - * else. - */ - ok: true; - /** - * The abstract syntax tree created by the parser. (only when ok: true) - */ - ast: RootNode; - /** - * Any additional data that the parser wants to provide. - */ - [key: string]: any; -} -/** - * Represents the unsuccessful result of parsing a file. - */ -export interface NotOkParseResult { - /** - * Indicates if the parse was successful. If true, the parse was successful - * and ESLint should continue on to create a SourceCode object and run rules; - * if false, ESLint should just report the error(s) without doing anything - * else. - */ - ok: false; - /** - * Any parsing errors, whether fatal or not. (only when ok: false) - */ - errors: FileError[]; - /** - * Any additional data that the parser wants to provide. - */ - [key: string]: any; -} -export type ParseResult = OkParseResult | NotOkParseResult; -/** - * Represents inline configuration found in the source code. - */ -interface InlineConfigElement { - /** - * The location of the inline config element. - */ - loc: SourceLocation; - /** - * The interpreted configuration from the inline config element. - */ - config: { - rules: RulesConfig; - }; -} -/** - * Generic options for the `SourceCodeBase` type. - */ -export interface SourceCodeBaseTypeOptions { - LangOptions: LanguageOptions; - RootNode: unknown; - SyntaxElementWithLoc: unknown; - ConfigNode: unknown; -} -/** - * Represents the basic interface for a source code object. - */ -interface SourceCodeBase { - /** - * Root of the AST. - */ - ast: Options["RootNode"]; - /** - * The traversal path that tools should take when evaluating the AST. - * When present, this overrides the `visitorKeys` on the language for - * just this source code object. - */ - visitorKeys?: Record; - /** - * Retrieves the equivalent of `loc` for a given node or token. - * @param syntaxElement The node or token to get the location for. - * @returns The location of the node or token. - */ - getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation; - /** - * Retrieves the equivalent of `range` for a given node or token. - * @param syntaxElement The node or token to get the range for. - * @returns The range of the node or token. - */ - getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange; - /** - * Traversal of AST. - */ - traverse(): Iterable; - /** - * Applies language options passed in from the ESLint core. - */ - applyLanguageOptions?(languageOptions: Options["LangOptions"]): void; - /** - * Return all of the inline areas where ESLint should be disabled/enabled - * along with any problems found in evaluating the directives. - */ - getDisableDirectives?(): { - directives: Directive[]; - problems: FileProblem[]; - }; - /** - * Returns an array of all inline configuration nodes found in the - * source code. - */ - getInlineConfigNodes?(): Options["ConfigNode"][]; - /** - * Applies configuration found inside of the source code. This method is only - * called when ESLint is running with inline configuration allowed. - */ - applyInlineConfig?(): { - configs: InlineConfigElement[]; - problems: FileProblem[]; - }; - /** - * Called by ESLint core to indicate that it has finished providing - * information. We now add in all the missing variables and ensure that - * state-changing methods cannot be called by rules. - * @returns {void} - */ - finalize?(): void; -} -/** - * Represents the source of a text file being linted. - */ -export interface TextSourceCode extends SourceCodeBase { - /** - * The body of the file that you'd like rule developers to access. - */ - text: string; -} -/** - * Represents the source of a binary file being linted. - */ -export interface BinarySourceCode extends SourceCodeBase { - /** - * The body of the file that you'd like rule developers to access. - */ - body: Uint8Array; -} -export type SourceCode = TextSourceCode | BinarySourceCode; -/** - * Represents a traversal step visiting the AST. - */ -export interface VisitTraversalStep { - kind: 1; - target: unknown; - phase: 1 | 2; - args: unknown[]; -} -/** - * Represents a traversal step calling a function. - */ -export interface CallTraversalStep { - kind: 2; - target: string; - phase?: string; - args: unknown[]; -} -export type TraversalStep = VisitTraversalStep | CallTraversalStep; -/** - * The type of disable directive. This determines how ESLint will disable rules. - */ -export type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line"; -/** - * Represents a disable directive. - */ -export interface Directive { - /** - * The type of directive. - */ - type: DirectiveType; - /** - * The node of the directive. May be in the AST or a comment/token. - */ - node: unknown; - /** - * The value of the directive. - */ - value: string; - /** - * The justification for the directive. - */ - justification?: string; -} -export {}; diff --git a/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/dist/esm/types.d.ts b/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/dist/esm/types.d.ts deleted file mode 100644 index 3fa4bebc..00000000 --- a/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/dist/esm/types.d.ts +++ /dev/null @@ -1,1179 +0,0 @@ -/** - * @fileoverview Shared types for ESLint Core. - */ -import type { JSONSchema4 } from "json-schema"; -/** - * Represents an error inside of a file. - */ -export interface FileError { - message: string; - line: number; - column: number; - endLine?: number; - endColumn?: number; -} -/** - * Represents a problem found in a file. - */ -export interface FileProblem { - ruleId: string | null; - message: string; - loc: SourceLocation; -} -/** - * Represents the start and end coordinates of a node inside the source. - */ -export interface SourceLocation { - start: Position; - end: Position; -} -/** - * Represents the start and end coordinates of a node inside the source with an offset. - */ -export interface SourceLocationWithOffset { - start: PositionWithOffset; - end: PositionWithOffset; -} -/** - * Represents a location coordinate inside the source. ESLint-style formats - * have just `line` and `column` while others may have `offset` as well. - */ -export interface Position { - line: number; - column: number; -} -/** - * Represents a location coordinate inside the source with an offset. - */ -export interface PositionWithOffset extends Position { - offset: number; -} -/** - * Represents a range of characters in the source. - */ -export type SourceRange = [number, number]; -/** - * What the rule is responsible for finding: - * - `problem` means the rule has noticed a potential error. - * - `suggestion` means the rule suggests an alternate or better approach. - * - `layout` means the rule is looking at spacing, indentation, etc. - */ -export type RuleType = "problem" | "suggestion" | "layout"; -/** - * The type of fix the rule can provide: - * - `code` means the rule can fix syntax. - * - `whitespace` means the rule can fix spacing and indentation. - */ -export type RuleFixType = "code" | "whitespace"; -/** - * An object containing visitor information for a rule. Each method is either the - * name of a node type or a selector, or is a method that will be called at specific - * times during the traversal. - */ -export type RuleVisitor = Record void) | undefined>; -/** - * Rule meta information used for documentation. - */ -export interface RulesMetaDocs { - /** - * A short description of the rule. - */ - description?: string | undefined; - /** - * The URL to the documentation for the rule. - */ - url?: string | undefined; - /** - * The category the rule falls under. - * @deprecated No longer used. - */ - category?: string | undefined; - /** - * Indicates if the rule is generally recommended for all users. - * - * Note - this will always be a boolean for core rules, but may be used in any way by plugins. - */ - recommended?: unknown; - /** - * Indicates if the rule is frozen (no longer accepting feature requests). - */ - frozen?: boolean | undefined; -} -/** - * Meta information about a rule. - */ -export interface RulesMeta { - /** - * Properties that are used when documenting the rule. - */ - docs?: (RulesMetaDocs & ExtRuleDocs) | undefined; - /** - * The type of rule. - */ - type?: RuleType | undefined; - /** - * The schema for the rule options. Required if the rule has options. - */ - schema?: JSONSchema4 | JSONSchema4[] | false | undefined; - /** - * Any default options to be recursively merged on top of any user-provided options. - */ - defaultOptions?: RuleOptions; - /** - * The messages that the rule can report. - */ - messages?: Record; - /** - * Indicates whether the rule has been deprecated or provides additional metadata about the deprecation. Omit if not deprecated. - */ - deprecated?: boolean | DeprecatedInfo | undefined; - /** - * @deprecated Use deprecated.replacedBy instead. - * The name of the rule(s) this rule was replaced by, if it was deprecated. - */ - replacedBy?: readonly string[] | undefined; - /** - * Indicates if the rule is fixable, and if so, what type of fix it provides. - */ - fixable?: RuleFixType | undefined; - /** - * Indicates if the rule may provide suggestions. - */ - hasSuggestions?: boolean | undefined; - /** - * The language the rule is intended to lint. - */ - language?: string; - /** - * The dialects of `language` that the rule is intended to lint. - */ - dialects?: string[]; -} -/** - * Provides additional metadata about a deprecation. - */ -export interface DeprecatedInfo { - /** - * General message presented to the user, e.g. for the key rule why the rule - * is deprecated or for info how to replace the rule. - */ - message?: string; - /** - * URL to more information about this deprecation in general. - */ - url?: string; - /** - * An empty array explicitly states that there is no replacement. - */ - replacedBy?: ReplacedByInfo[]; - /** - * The package version since when the rule is deprecated (should use full - * semver without a leading "v"). - */ - deprecatedSince?: string; - /** - * The estimated version when the rule is removed (probably the next major - * version). null means the rule is "frozen" (will be available but will not - * be changed). - */ - availableUntil?: string | null; -} -/** - * Provides metadata about a replacement - */ -export interface ReplacedByInfo { - /** - * General message presented to the user, e.g. how to replace the rule - */ - message?: string; - /** - * URL to more information about this replacement in general - */ - url?: string; - /** - * Name should be "eslint" if the replacement is an ESLint core rule. Omit - * the property if the replacement is in the same plugin. - */ - plugin?: ExternalSpecifier; - /** - * Name and documentation of the replacement rule - */ - rule?: ExternalSpecifier; -} -/** - * Specifies the name and url of an external resource. At least one property - * should be set. - */ -export interface ExternalSpecifier { - /** - * Name of the referenced plugin / rule. - */ - name?: string; - /** - * URL pointing to documentation for the plugin / rule. - */ - url?: string; -} -/** - * Generic type for `RuleContext`. - */ -export interface RuleContextTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RuleOptions: unknown[]; - Node: unknown; - MessageIds: string; -} -/** - * Represents the context object that is passed to a rule. This object contains - * information about the current state of the linting process and is the rule's - * view into the outside world. - */ -export interface RuleContext { - /** - * The current working directory for the session. - */ - cwd: string; - /** - * Returns the current working directory for the session. - * @deprecated Use `cwd` instead. - */ - getCwd(): string; - /** - * The filename of the file being linted. - */ - filename: string; - /** - * Returns the filename of the file being linted. - * @deprecated Use `filename` instead. - */ - getFilename(): string; - /** - * The physical filename of the file being linted. - */ - physicalFilename: string; - /** - * Returns the physical filename of the file being linted. - * @deprecated Use `physicalFilename` instead. - */ - getPhysicalFilename(): string; - /** - * The source code object that the rule is running on. - */ - sourceCode: Options["Code"]; - /** - * Returns the source code object that the rule is running on. - * @deprecated Use `sourceCode` instead. - */ - getSourceCode(): Options["Code"]; - /** - * Shared settings for the configuration. - */ - settings: SettingsConfig; - /** - * Parser-specific options for the configuration. - * @deprecated Use `languageOptions.parserOptions` instead. - */ - parserOptions: Record; - /** - * The language options for the configuration. - */ - languageOptions: Options["LangOptions"]; - /** - * The CommonJS path to the parser used while parsing this file. - * @deprecated No longer used. - */ - parserPath: string | undefined; - /** - * The rule ID. - */ - id: string; - /** - * The rule's configured options. - */ - options: Options["RuleOptions"]; - /** - * The report function that the rule should use to report problems. - * @param violation The violation to report. - */ - report(violation: ViolationReport): void; -} -/** - * Manager of text edits for a rule fix. - */ -export interface RuleTextEditor { - /** - * Inserts text after the specified node or token. - * @param syntaxElement The node or token to insert after. - * @param text The edit to insert after the node or token. - */ - insertTextAfter(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Inserts text after the specified range. - * @param range The range to insert after. - * @param text The edit to insert after the range. - */ - insertTextAfterRange(range: SourceRange, text: string): RuleTextEdit; - /** - * Inserts text before the specified node or token. - * @param syntaxElement A syntax element with location information to insert before. - * @param text The edit to insert before the node or token. - */ - insertTextBefore(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Inserts text before the specified range. - * @param range The range to insert before. - * @param text The edit to insert before the range. - */ - insertTextBeforeRange(range: SourceRange, text: string): RuleTextEdit; - /** - * Removes the specified node or token. - * @param syntaxElement A syntax element with location information to remove. - * @returns The edit to remove the node or token. - */ - remove(syntaxElement: EditableSyntaxElement): RuleTextEdit; - /** - * Removes the specified range. - * @param range The range to remove. - * @returns The edit to remove the range. - */ - removeRange(range: SourceRange): RuleTextEdit; - /** - * Replaces the specified node or token with the given text. - * @param syntaxElement A syntax element with location information to replace. - * @param text The text to replace the node or token with. - * @returns The edit to replace the node or token. - */ - replaceText(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Replaces the specified range with the given text. - * @param range The range to replace. - * @param text The text to replace the range with. - * @returns The edit to replace the range. - */ - replaceTextRange(range: SourceRange, text: string): RuleTextEdit; -} -/** - * Represents a fix for a rule violation implemented as a text edit. - */ -export interface RuleTextEdit { - /** - * The range to replace. - */ - range: SourceRange; - /** - * The text to insert. - */ - text: string; -} -/** - * Fixes a violation. - * @param fixer The text editor to apply the fix. - * @returns The fix(es) for the violation. - */ -export type RuleFixer = (fixer: RuleTextEditor) => RuleTextEdit | Iterable | null; -export interface ViolationReportBase { - /** - * The data to insert into the message. - */ - data?: Record | undefined; - /** - * The fix to be applied for the violation. - */ - fix?: RuleFixer | null | undefined; - /** - * An array of suggested fixes for the problem. These fixes may change the - * behavior of the code, so they are not applied automatically. - */ - suggest?: SuggestedEdit[] | null | undefined; -} -export type ViolationMessage = { - message: string; -} | { - messageId: MessageIds; -}; -export type ViolationLocation = { - loc: SourceLocation | Position; -} | { - node: Node; -}; -export type ViolationReport = ViolationReportBase & ViolationMessage & ViolationLocation; -export interface SuggestedEditBase { - /** - * The data to insert into the message. - */ - data?: Record | undefined; - /** - * The fix to be applied for the suggestion. - */ - fix: RuleFixer; -} -export type SuggestionMessage = { - desc: string; -} | { - messageId: string; -}; -/** - * A suggested edit for a rule violation. - */ -export type SuggestedEdit = SuggestedEditBase & SuggestionMessage; -/** - * The normalized version of a lint suggestion. - */ -export interface LintSuggestion { - /** A short description. */ - desc: string; - /** Fix result info. */ - fix: RuleTextEdit; - /** Id referencing a message for the description. */ - messageId?: string | undefined; -} -/** - * The normalized version of a lint violation message. - */ -export interface LintMessage { - /** The 1-based column number. */ - column: number; - /** The 1-based line number. */ - line: number; - /** The 1-based column number of the end location. */ - endColumn?: number | undefined; - /** The 1-based line number of the end location. */ - endLine?: number | undefined; - /** The ID of the rule which makes this message. */ - ruleId: string | null; - /** The reported message. */ - message: string; - /** The ID of the message in the rule's meta. */ - messageId?: string | undefined; - /** - * Type of node. - * @deprecated `nodeType` is deprecated and will be removed in the next major version. - */ - nodeType?: string | undefined; - /** If `true` then this is a fatal error. */ - fatal?: true | undefined; - /** The severity of this message. */ - severity: Exclude; - /** Information for autofix. */ - fix?: RuleTextEdit | undefined; - /** Information for suggestions. */ - suggestions?: LintSuggestion[] | undefined; -} -/** - * Generic options for the `RuleDefinition` type. - */ -export interface RuleDefinitionTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RuleOptions: unknown[]; - Visitor: RuleVisitor; - Node: unknown; - MessageIds: string; - ExtRuleDocs: unknown; -} -/** - * The definition of an ESLint rule. - */ -export interface RuleDefinition { - /** - * The meta information for the rule. - */ - meta?: RulesMeta; - /** - * Creates the visitor that ESLint uses to apply the rule during traversal. - * @param context The rule context. - * @returns The rule visitor. - */ - create(context: RuleContext<{ - LangOptions: Options["LangOptions"]; - Code: Options["Code"]; - RuleOptions: Options["RuleOptions"]; - Node: Options["Node"]; - MessageIds: Options["MessageIds"]; - }>): Options["Visitor"]; -} -/** - * Defaults for non-language-related `RuleDefinition` options. - */ -export interface CustomRuleTypeDefinitions { - RuleOptions: unknown[]; - MessageIds: string; - ExtRuleDocs: Record; -} -/** - * A helper type to define language specific specializations of the `RuleDefinition` type. - * - * @example - * ```ts - * type YourRuleDefinition< - * Options extends Partial = {}, - * > = CustomRuleDefinitionType< - * { - * LangOptions: YourLanguageOptions; - * Code: YourSourceCode; - * Visitor: YourRuleVisitor; - * Node: YourNode; - * }, - * Options - * >; - * ``` - */ -export type CustomRuleDefinitionType, Options extends Partial> = RuleDefinition>>; -/** - * The human readable severity level used in a configuration. - */ -export type SeverityName = "off" | "warn" | "error"; -/** - * The numeric severity level for a rule. - * - * - `0` means off. - * - `1` means warn. - * - `2` means error. - */ -export type SeverityLevel = 0 | 1 | 2; -/** - * The severity of a rule in a configuration. - */ -export type Severity = SeverityName | SeverityLevel; -/** - * Represents the metadata for an object, such as a plugin or processor. - */ -export interface ObjectMetaProperties { - /** @deprecated Use `meta.name` instead. */ - name?: string | undefined; - /** @deprecated Use `meta.version` instead. */ - version?: string | undefined; - meta?: { - name?: string | undefined; - version?: string | undefined; - }; -} -/** - * Represents the configuration options for the core linter. - */ -export interface LinterOptionsConfig { - /** - * Indicates whether or not inline configuration is evaluated. - */ - noInlineConfig?: boolean; - /** - * Indicates what to do when an unused disable directive is found. - */ - reportUnusedDisableDirectives?: boolean | Severity; - /** - * A severity value indicating if and how unused inline configs should be - * tracked and reported. - */ - reportUnusedInlineConfigs?: Severity; -} -/** - * The configuration for a rule. - */ -export type RuleConfig = Severity | [Severity, ...Partial]; -/** - * A collection of rules and their configurations. - */ -export interface RulesConfig { - [key: string]: RuleConfig; -} -/** - * A collection of settings. - */ -export interface SettingsConfig { - [key: string]: unknown; -} -/** - * The configuration for a set of files. - */ -export interface ConfigObject { - /** - * A string to identify the configuration object. Used in error messages and - * inspection tools. - */ - name?: string; - /** - * Path to the directory where the configuration object should apply. - * `files` and `ignores` patterns in the configuration object are - * interpreted as relative to this path. - */ - basePath?: string; - /** - * An array of glob patterns indicating the files that the configuration - * object should apply to. If not specified, the configuration object applies - * to all files - */ - files?: (string | string[])[]; - /** - * An array of glob patterns indicating the files that the configuration - * object should not apply to. If not specified, the configuration object - * applies to all files matched by files - */ - ignores?: string[]; - /** - * The name of the language used for linting. This is used to determine the - * parser and other language-specific settings. - * @since 9.7.0 - */ - language?: string; - /** - * An object containing settings related to how the language is configured for - * linting. - */ - languageOptions?: LanguageOptions; - /** - * An object containing settings related to the linting process - */ - linterOptions?: LinterOptionsConfig; - /** - * Either an object containing preprocess() and postprocess() methods or a - * string indicating the name of a processor inside of a plugin - * (i.e., "pluginName/processorName"). - */ - processor?: string | Processor; - /** - * An object containing a name-value mapping of plugin names to plugin objects. - * When files is specified, these plugins are only available to the matching files. - */ - plugins?: Record; - /** - * An object containing the configured rules. When files or ignores are specified, - * these rule configurations are only available to the matching files. - */ - rules?: Partial; - /** - * An object containing name-value pairs of information that should be - * available to all rules. - */ - settings?: Record; -} -/** @deprecated Only supported in legacy eslintrc config format. */ -export type GlobalAccess = boolean | "off" | "readable" | "readonly" | "writable" | "writeable"; -/** @deprecated Only supported in legacy eslintrc config format. */ -export interface GlobalsConfig { - [name: string]: GlobalAccess; -} -/** - * The ECMAScript version of the code being linted. - * @deprecated Only supported in legacy eslintrc config format. - */ -export type EcmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026 | "latest"; -/** - * The type of JavaScript source code. - * @deprecated Only supported in legacy eslintrc config format. - */ -export type JavaScriptSourceType = "script" | "module" | "commonjs"; -/** - * Parser options. - * @deprecated Only supported in legacy eslintrc config format. - * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options#specifying-parser-options) - */ -export interface JavaScriptParserOptionsConfig { - /** - * Allow the use of reserved words as identifiers (if `ecmaVersion` is 3). - * - * @default false - */ - allowReserved?: boolean | undefined; - /** - * Accepts any valid ECMAScript version number or `'latest'`: - * - * - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, es14, ..., or - * - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, ..., or - * - `'latest'` - * - * When it's a version or a year, the value must be a number - so do not include the `es` prefix. - * - * Specifies the version of ECMAScript syntax you want to use. This is used by the parser to determine how to perform scope analysis, and it affects the default - * - * @default 5 - */ - ecmaVersion?: EcmaVersion | undefined; - /** - * The type of JavaScript source code. Possible values are "script" for - * traditional script files, "module" for ECMAScript modules (ESM), and - * "commonjs" for CommonJS files. - * - * @default 'script' - * - * @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options - */ - sourceType?: JavaScriptSourceType | undefined; - /** - * An object indicating which additional language features you'd like to use. - * - * @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options - */ - ecmaFeatures?: { - globalReturn?: boolean | undefined; - impliedStrict?: boolean | undefined; - jsx?: boolean | undefined; - experimentalObjectRestSpread?: boolean | undefined; - [key: string]: any; - } | undefined; - [key: string]: any; -} -/** @deprecated Only supported in legacy eslintrc config format. */ -export interface EnvironmentConfig { - /** The definition of global variables. */ - globals?: GlobalsConfig | undefined; - /** The parser options that will be enabled under this environment. */ - parserOptions?: JavaScriptParserOptionsConfig | undefined; -} -/** - * A configuration object that may have a `rules` block. - */ -export interface HasRules { - rules?: Partial | undefined; -} -/** - * ESLint legacy configuration. - * - * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) - */ -export interface BaseConfig extends HasRules { - $schema?: string | undefined; - /** - * An environment provides predefined global variables. - * - * @see [Environments](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-environments) - */ - env?: { - [name: string]: boolean; - } | undefined; - /** - * Extending configuration files. - * - * @see [Extends](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#extending-configuration-files) - */ - extends?: string | string[] | undefined; - /** - * Specifying globals. - * - * @see [Globals](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-globals) - */ - globals?: GlobalsConfig | undefined; - /** - * Disable processing of inline comments. - * - * @see [Disabling Inline Comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#disabling-inline-comments) - */ - noInlineConfig?: boolean | undefined; - /** - * Overrides can be used to use a differing configuration for matching sub-directories and files. - * - * @see [How do overrides work](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#how-do-overrides-work) - */ - overrides?: ConfigOverride[] | undefined; - /** - * Parser. - * - * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) - * @see [Specifying Parser](https://eslint.org/docs/latest/use/configure/parser-deprecated) - */ - parser?: string | undefined; - /** - * Parser options. - * - * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) - * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options) - */ - parserOptions?: JavaScriptParserOptionsConfig | undefined; - /** - * Which third-party plugins define additional rules, environments, configs, etc. for ESLint to use. - * - * @see [Configuring Plugins](https://eslint.org/docs/latest/use/configure/plugins-deprecated#configure-plugins) - */ - plugins?: string[] | undefined; - /** - * Specifying processor. - * - * @see [processor](https://eslint.org/docs/latest/use/configure/plugins-deprecated#specify-a-processor) - */ - processor?: string | undefined; - /** - * Report unused eslint-disable comments as warning. - * - * @see [Report unused eslint-disable comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#report-unused-eslint-disable-comments) - */ - reportUnusedDisableDirectives?: boolean | undefined; - /** - * Settings. - * - * @see [Settings](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#adding-shared-settings) - */ - settings?: SettingsConfig | undefined; -} -/** - * The overwrites that apply more differing configuration to specific files or directories. - */ -export interface ConfigOverride extends BaseConfig { - /** - * The glob patterns for excluded files. - */ - excludedFiles?: string | string[] | undefined; - /** - * The glob patterns for target files. - */ - files: string | string[]; -} -/** - * ESLint legacy configuration. - * - * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) - */ -export interface LegacyConfigObject extends BaseConfig { - /** - * Tell ESLint to ignore specific files and directories. - * - * @see [Ignore Patterns](https://eslint.org/docs/latest/use/configure/ignore-deprecated#ignorepatterns-in-config-files) - */ - ignorePatterns?: string | string[] | undefined; - /** - * @see [Using Configuration Files](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#using-configuration-files) - */ - root?: boolean | undefined; -} -/** - * File information passed to a processor. - */ -export interface ProcessorFile { - text: string; - filename: string; -} -/** - * A processor is an object that can preprocess and postprocess files. - */ -export interface Processor extends ObjectMetaProperties { - /** If `true` then it means the processor supports autofix. */ - supportsAutofix?: boolean | undefined; - /** The function to extract code blocks. */ - preprocess?(text: string, filename: string): T[]; - /** The function to merge messages. */ - postprocess?(messages: LintMessage[][], filename: string): LintMessage[]; -} -export interface Plugin extends ObjectMetaProperties { - meta?: ObjectMetaProperties["meta"] & { - namespace?: string | undefined; - }; - configs?: Record | undefined; - environments?: Record | undefined; - languages?: Record | undefined; - processors?: Record | undefined; - rules?: Record | undefined; -} -/** - * Generic options for the `Language` type. - */ -export interface LanguageTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RootNode: unknown; - Node: unknown; -} -/** - * Represents a plugin language. - */ -export interface Language { - /** - * Indicates how ESLint should read the file. - */ - fileType: "text"; - /** - * First line number returned from the parser (text mode only). - */ - lineStart: 0 | 1; - /** - * First column number returned from the parser (text mode only). - */ - columnStart: 0 | 1; - /** - * The property to read the node type from. Used in selector querying. - */ - nodeTypeKey: string; - /** - * The traversal path that tools should take when evaluating the AST - */ - visitorKeys?: Record; - /** - * Default language options. User-defined options are merged with this object. - */ - defaultLanguageOptions?: LanguageOptions; - /** - * Validates languageOptions for this language. - */ - validateLanguageOptions(languageOptions: Options["LangOptions"]): void; - /** - * Normalizes languageOptions for this language. - */ - normalizeLanguageOptions?(languageOptions: Options["LangOptions"]): Options["LangOptions"]; - /** - * Helper for esquery that allows languages to match nodes against - * class. esquery currently has classes like `function` that will - * match all the various function nodes. This method allows languages - * to implement similar shorthands. - */ - matchesSelectorClass?(className: string, node: Options["Node"], ancestry: Options["Node"][]): boolean; - /** - * Parses the given file input into its component parts. This file should not - * throws errors for parsing errors but rather should return any parsing - * errors as parse of the ParseResult object. - */ - parse(file: File, context: LanguageContext): ParseResult; - /** - * Creates SourceCode object that ESLint uses to work with a file. - */ - createSourceCode(file: File, input: OkParseResult, context: LanguageContext): Options["Code"]; -} -/** - * Plugin-defined options for the language. - */ -export type LanguageOptions = Record; -/** - * The context object that is passed to the language plugin methods. - */ -export interface LanguageContext { - languageOptions: LangOptions; -} -/** - * Represents a file read by ESLint. - */ -export interface File { - /** - * The path that ESLint uses for this file. May be a virtual path - * if it was returned by a processor. - */ - path: string; - /** - * The path to the file on disk. This always maps directly to a file - * regardless of whether it was returned from a processor. - */ - physicalPath: string; - /** - * Indicates if the original source contained a byte-order marker. - * ESLint strips the BOM from the `body`, but this info is needed - * to correctly apply autofixing. - */ - bom: boolean; - /** - * The body of the file to parse. - */ - body: string | Uint8Array; -} -/** - * Represents the successful result of parsing a file. - */ -export interface OkParseResult { - /** - * Indicates if the parse was successful. If true, the parse was successful - * and ESLint should continue on to create a SourceCode object and run rules; - * if false, ESLint should just report the error(s) without doing anything - * else. - */ - ok: true; - /** - * The abstract syntax tree created by the parser. (only when ok: true) - */ - ast: RootNode; - /** - * Any additional data that the parser wants to provide. - */ - [key: string]: any; -} -/** - * Represents the unsuccessful result of parsing a file. - */ -export interface NotOkParseResult { - /** - * Indicates if the parse was successful. If true, the parse was successful - * and ESLint should continue on to create a SourceCode object and run rules; - * if false, ESLint should just report the error(s) without doing anything - * else. - */ - ok: false; - /** - * Any parsing errors, whether fatal or not. (only when ok: false) - */ - errors: FileError[]; - /** - * Any additional data that the parser wants to provide. - */ - [key: string]: any; -} -export type ParseResult = OkParseResult | NotOkParseResult; -/** - * Represents inline configuration found in the source code. - */ -interface InlineConfigElement { - /** - * The location of the inline config element. - */ - loc: SourceLocation; - /** - * The interpreted configuration from the inline config element. - */ - config: { - rules: RulesConfig; - }; -} -/** - * Generic options for the `SourceCodeBase` type. - */ -export interface SourceCodeBaseTypeOptions { - LangOptions: LanguageOptions; - RootNode: unknown; - SyntaxElementWithLoc: unknown; - ConfigNode: unknown; -} -/** - * Represents the basic interface for a source code object. - */ -interface SourceCodeBase { - /** - * Root of the AST. - */ - ast: Options["RootNode"]; - /** - * The traversal path that tools should take when evaluating the AST. - * When present, this overrides the `visitorKeys` on the language for - * just this source code object. - */ - visitorKeys?: Record; - /** - * Retrieves the equivalent of `loc` for a given node or token. - * @param syntaxElement The node or token to get the location for. - * @returns The location of the node or token. - */ - getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation; - /** - * Retrieves the equivalent of `range` for a given node or token. - * @param syntaxElement The node or token to get the range for. - * @returns The range of the node or token. - */ - getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange; - /** - * Traversal of AST. - */ - traverse(): Iterable; - /** - * Applies language options passed in from the ESLint core. - */ - applyLanguageOptions?(languageOptions: Options["LangOptions"]): void; - /** - * Return all of the inline areas where ESLint should be disabled/enabled - * along with any problems found in evaluating the directives. - */ - getDisableDirectives?(): { - directives: Directive[]; - problems: FileProblem[]; - }; - /** - * Returns an array of all inline configuration nodes found in the - * source code. - */ - getInlineConfigNodes?(): Options["ConfigNode"][]; - /** - * Applies configuration found inside of the source code. This method is only - * called when ESLint is running with inline configuration allowed. - */ - applyInlineConfig?(): { - configs: InlineConfigElement[]; - problems: FileProblem[]; - }; - /** - * Called by ESLint core to indicate that it has finished providing - * information. We now add in all the missing variables and ensure that - * state-changing methods cannot be called by rules. - * @returns {void} - */ - finalize?(): void; -} -/** - * Represents the source of a text file being linted. - */ -export interface TextSourceCode extends SourceCodeBase { - /** - * The body of the file that you'd like rule developers to access. - */ - text: string; -} -/** - * Represents the source of a binary file being linted. - */ -export interface BinarySourceCode extends SourceCodeBase { - /** - * The body of the file that you'd like rule developers to access. - */ - body: Uint8Array; -} -export type SourceCode = TextSourceCode | BinarySourceCode; -/** - * Represents a traversal step visiting the AST. - */ -export interface VisitTraversalStep { - kind: 1; - target: unknown; - phase: 1 | 2; - args: unknown[]; -} -/** - * Represents a traversal step calling a function. - */ -export interface CallTraversalStep { - kind: 2; - target: string; - phase?: string; - args: unknown[]; -} -export type TraversalStep = VisitTraversalStep | CallTraversalStep; -/** - * The type of disable directive. This determines how ESLint will disable rules. - */ -export type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line"; -/** - * Represents a disable directive. - */ -export interface Directive { - /** - * The type of directive. - */ - type: DirectiveType; - /** - * The node of the directive. May be in the AST or a comment/token. - */ - node: unknown; - /** - * The value of the directive. - */ - value: string; - /** - * The justification for the directive. - */ - justification?: string; -} -export {}; diff --git a/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/package.json b/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/package.json deleted file mode 100644 index d2f470bb..00000000 --- a/node_modules/@eslint/plugin-kit/node_modules/@eslint/core/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "@eslint/core", - "version": "0.17.0", - "description": "Runtime-agnostic core of ESLint", - "type": "module", - "types": "./dist/esm/types.d.ts", - "exports": { - "types": { - "import": "./dist/esm/types.d.ts", - "require": "./dist/cjs/types.d.cts" - } - }, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "scripts": { - "build:cts": "node -e \"fs.cpSync('dist/esm/types.d.ts', 'dist/cjs/types.d.cts')\"", - "build": "tsc && npm run build:cts", - "test:jsr": "npx jsr@latest publish --dry-run", - "test:types": "tsc -p tests/types/tsconfig.json" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/eslint/rewrite.git", - "directory": "packages/core" - }, - "keywords": [ - "eslint", - "core" - ], - "author": "Nicholas C. Zakas", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/eslint/rewrite/issues" - }, - "homepage": "https://github.com/eslint/rewrite/tree/main/packages/core#readme", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "devDependencies": { - "json-schema": "^0.4.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } -} diff --git a/node_modules/eslint/README.md b/node_modules/eslint/README.md index b89254f3..54537f7a 100644 --- a/node_modules/eslint/README.md +++ b/node_modules/eslint/README.md @@ -342,8 +342,8 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).

Platinum Sponsors

Automattic Airbnb

Gold Sponsors

Qlty Software trunk.io Shopify

Silver Sponsors

-

Vite Liftoff American Express StackBlitz

Bronze Sponsors

-

Syntax Cybozu Sentry Discord GitBook Nx Mercedes-Benz Group HeroCoders LambdaTest

+

Vite Liftoff American Express StackBlitz

Bronze Sponsors

+

Syntax Cybozu Sentry Icons8 Discord GitBook Nx Mercedes-Benz Group HeroCoders LambdaTest

Technology Sponsors

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.

Netlify Algolia 1Password

diff --git a/node_modules/eslint/lib/eslint/eslint.js b/node_modules/eslint/lib/eslint/eslint.js index 7e68c893..92e90b3e 100644 --- a/node_modules/eslint/lib/eslint/eslint.js +++ b/node_modules/eslint/lib/eslint/eslint.js @@ -17,6 +17,7 @@ const { pathToFileURL } = require("node:url"); const { SHARE_ENV, Worker } = require("node:worker_threads"); const { version } = require("../../package.json"); const { defaultConfig } = require("../config/default-config"); +const timing = require("../linter/timing"); const { createDebug, @@ -503,6 +504,11 @@ async function runWorkers( worstNetLintingRatio, netLintingRatio, ); + + if (timing.enabled && indexedResults.timings) { + timing.mergeData(indexedResults.timings); + } + for (const result of indexedResults) { const { index } = result; delete result.index; @@ -522,7 +528,17 @@ async function runWorkers( for (let index = 0; index < workerCount; ++index) { promises[index] = new Promise(workerExecutor); } - await Promise.all(promises); + + try { + await Promise.all(promises); + } catch (error) { + /* + * If any worker fails, suppress timing display in the main thread + * to avoid printing partial or misleading timing output. + */ + timing.disableDisplay(); + throw error; + } if (worstNetLintingRatio < LOW_NET_LINTING_RATIO) { warnOnLowNetLintingRatio(); diff --git a/node_modules/eslint/lib/eslint/worker.js b/node_modules/eslint/lib/eslint/worker.js index 2741d752..7001bf21 100644 --- a/node_modules/eslint/lib/eslint/worker.js +++ b/node_modules/eslint/lib/eslint/worker.js @@ -29,6 +29,7 @@ const { processOptions, } = require("./eslint-helpers"); const { WarningService } = require("../services/warning-service"); +const timing = require("../linter/timing"); const depsLoadedTime = hrtimeBigint(); @@ -39,7 +40,7 @@ const depsLoadedTime = hrtimeBigint(); /** @typedef {import("../types").ESLint.LintResult} LintResult */ /** @typedef {import("../types").ESLint.Options} ESLintOptions */ /** @typedef {LintResult & { index?: number; }} IndexedLintResult */ -/** @typedef {IndexedLintResult[] & { netLintingDuration: bigint; }} WorkerLintResults */ +/** @typedef {IndexedLintResult[] & { netLintingDuration: bigint; timings?: Record; }} WorkerLintResults */ /** * @typedef {Object} WorkerData - Data passed to the worker thread. * @property {ESLintOptions | string} eslintOptionsOrURL - The unprocessed ESLint options or the URL of the options module. @@ -57,6 +58,12 @@ const debug = createDebug(`eslint:worker:thread-${threadId}`); // Main //------------------------------------------------------------------------------ +/* + * Prevent timing module from printing profiling output from worker threads. + * The main thread is responsible for displaying any aggregated timings. + */ +timing.disableDisplay(); + debug("Dependencies loaded in %t", depsLoadedTime - startTime); (async () => { @@ -158,5 +165,9 @@ debug("Dependencies loaded in %t", depsLoadedTime - startTime); indexedResults.netLintingDuration = lintingDuration - loadConfigTotalDuration - readFileCounter.duration; + if (timing.enabled) { + indexedResults.timings = timing.getData(); + } + parentPort.postMessage(indexedResults); })(); diff --git a/node_modules/eslint/lib/linter/file-report.js b/node_modules/eslint/lib/linter/file-report.js index 9528aa16..29cea0a5 100644 --- a/node_modules/eslint/lib/linter/file-report.js +++ b/node_modules/eslint/lib/linter/file-report.js @@ -426,7 +426,7 @@ function validateSuggestions(suggest, messages) { if (typeof suggestion.fix !== "function") { throw new TypeError( - `context.report() called with a suggest option without a fix function. See: ${suggestion}`, + `context.report() called with a suggest option without a fix function. See: ${JSON.stringify(suggestion, null, 2)}`, ); } }); diff --git a/node_modules/eslint/lib/linter/source-code-traverser.js b/node_modules/eslint/lib/linter/source-code-traverser.js index 32b94b1f..0a6235e0 100644 --- a/node_modules/eslint/lib/linter/source-code-traverser.js +++ b/node_modules/eslint/lib/linter/source-code-traverser.js @@ -17,8 +17,9 @@ const vk = require("eslint-visitor-keys"); //----------------------------------------------------------------------------- /** - * @import { ESQueryParsedSelector } from "./esquery.js"; * @import { Language, SourceCode } from "@eslint/core"; + * @import { ESQueryOptions } from "esquery"; + * @import { ESQueryParsedSelector } from "./esquery.js"; * @import { SourceCodeVisitor } from "./source-code-visitor.js"; */ @@ -47,11 +48,10 @@ class ESQueryHelper { * Creates a new instance. * @param {SourceCodeVisitor} visitor The visitor containing the functions to call. * @param {ESQueryOptions} esqueryOptions `esquery` options for traversing custom nodes. - * @returns {NodeEventGenerator} new instance */ constructor(visitor, esqueryOptions) { /** - * The emitter to use during traversal. + * The visitor to use during traversal. * @type {SourceCodeVisitor} */ this.visitor = visitor; @@ -288,7 +288,10 @@ class SourceCodeTraverser { false, ) .forEach(selector => { - visitor.callSync(selector, step.target); + visitor.callSync( + selector, + ...(step.args ?? [step.target]), + ); }); currentAncestry.unshift(step.target); } else { @@ -300,7 +303,10 @@ class SourceCodeTraverser { true, ) .forEach(selector => { - visitor.callSync(selector, step.target); + visitor.callSync( + selector, + ...(step.args ?? [step.target]), + ); }); } } catch (err) { diff --git a/node_modules/eslint/lib/linter/timing.js b/node_modules/eslint/lib/linter/timing.js index f0aa1d2e..1791f8fd 100644 --- a/node_modules/eslint/lib/linter/timing.js +++ b/node_modules/eslint/lib/linter/timing.js @@ -131,6 +131,7 @@ function display(data) { /* c8 ignore next */ module.exports = (function () { const data = Object.create(null); + let displayEnabled = true; /** * Time the run @@ -158,9 +159,42 @@ module.exports = (function () { }; } + /** + * Returns a shallow copy of the collected timings data. + * @returns {Record} mapping of ruleId to total time in ms + */ + function getData() { + return { ...data }; + } + + /** + * Merges rule timing totals collected elsewhere into this process' totals. + * @param {Record} dataToMerge mapping of ruleId to total time in ms + * @returns {void} + */ + function mergeData(dataToMerge) { + for (const [key, value] of Object.entries(dataToMerge)) { + if (typeof data[key] === "undefined") { + data[key] = 0; + } + data[key] += value; + } + } + + /** + * Disables printing of timing data on process exit. + * Intended for worker threads or non-main contexts. + * @returns {void} + */ + function disableDisplay() { + displayEnabled = false; + } + if (enabled) { process.on("exit", () => { - display(data); + if (displayEnabled && Object.keys(data).length > 0) { + display(data); + } }); } @@ -168,5 +202,8 @@ module.exports = (function () { time, enabled, getListSize, + getData, + mergeData, + disableDisplay, }; })(); diff --git a/node_modules/eslint/lib/rules/complexity.js b/node_modules/eslint/lib/rules/complexity.js index f31586e9..23a018b9 100644 --- a/node_modules/eslint/lib/rules/complexity.js +++ b/node_modules/eslint/lib/rules/complexity.js @@ -68,6 +68,7 @@ module.exports = { }, create(context) { + const sourceCode = context.sourceCode; const option = context.options[0]; let threshold = THRESHOLD_DEFAULT; let VARIANT = "classic"; @@ -177,12 +178,10 @@ module.exports = { name = "class field initializer"; } else if (codePath.origin === "class-static-block") { name = "class static block"; + loc = sourceCode.getFirstToken(node).loc; } else { name = astUtils.getFunctionNameWithKind(node); - loc = astUtils.getFunctionHeadLoc( - node, - context.sourceCode, - ); + loc = astUtils.getFunctionHeadLoc(node, sourceCode); } context.report({ diff --git a/node_modules/eslint/lib/rules/for-direction.js b/node_modules/eslint/lib/rules/for-direction.js index 078d121f..7cf14b99 100644 --- a/node_modules/eslint/lib/rules/for-direction.js +++ b/node_modules/eslint/lib/rules/for-direction.js @@ -46,7 +46,10 @@ module.exports = { */ function report(node) { context.report({ - node, + loc: { + start: node.loc.start, + end: sourceCode.getTokenBefore(node.body).loc.end, + }, messageId: "incorrectDirection", }); } diff --git a/node_modules/eslint/lib/rules/no-dupe-args.js b/node_modules/eslint/lib/rules/no-dupe-args.js index cfde8ecf..788b98d8 100644 --- a/node_modules/eslint/lib/rules/no-dupe-args.js +++ b/node_modules/eslint/lib/rules/no-dupe-args.js @@ -5,6 +5,12 @@ "use strict"; +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -58,10 +64,15 @@ module.exports = { // Checks and reports duplications. const defs = variable.defs.filter(isParameter); + const loc = { + start: astUtils.getOpeningParenOfParams(node, sourceCode) + .loc.start, + end: sourceCode.getTokenBefore(node.body).loc.end, + }; if (defs.length >= 2) { context.report({ - node, + loc, messageId: "unexpected", data: { name: variable.name }, }); diff --git a/node_modules/eslint/lib/rules/no-dupe-class-members.js b/node_modules/eslint/lib/rules/no-dupe-class-members.js index f99b1a07..3b9292b7 100644 --- a/node_modules/eslint/lib/rules/no-dupe-class-members.js +++ b/node_modules/eslint/lib/rules/no-dupe-class-members.js @@ -106,7 +106,7 @@ module.exports = { if (isDuplicate) { context.report({ - node, + loc: node.key.loc, messageId: "unexpected", data: { name }, }); diff --git a/node_modules/eslint/lib/rules/object-shorthand.js b/node_modules/eslint/lib/rules/object-shorthand.js index 5ada21da..916d5374 100644 --- a/node_modules/eslint/lib/rules/object-shorthand.js +++ b/node_modules/eslint/lib/rules/object-shorthand.js @@ -19,6 +19,86 @@ const OPTIONS = { //------------------------------------------------------------------------------ const astUtils = require("./utils/ast-utils"); +//-------------------------------------------------------------------------- +// Helpers +//-------------------------------------------------------------------------- +const CTOR_PREFIX_REGEX = /[^_$0-9]/u; +const JSDOC_COMMENT_REGEX = /^\s*\*/u; + +/** + * Determines if the first character of the name is a capital letter. + * @param {string} name The name of the node to evaluate. + * @returns {boolean} True if the first character of the property name is a capital letter, false if not. + * @private + */ +function isConstructor(name) { + const match = CTOR_PREFIX_REGEX.exec(name); + + // Not a constructor if name has no characters apart from '_', '$' and digits e.g. '_', '$$', '_8' + if (!match) { + return false; + } + + const firstChar = name.charAt(match.index); + + return firstChar === firstChar.toUpperCase(); +} + +/** + * Determines if the property can have a shorthand form. + * @param {ASTNode} property Property AST node + * @returns {boolean} True if the property can have a shorthand form + * @private + */ +function canHaveShorthand(property) { + return ( + property.kind !== "set" && + property.kind !== "get" && + property.type !== "SpreadElement" && + property.type !== "SpreadProperty" && + property.type !== "ExperimentalSpreadProperty" + ); +} + +/** + * Checks whether a node is a string literal. + * @param {ASTNode} node Any AST node. + * @returns {boolean} `true` if it is a string literal. + */ +function isStringLiteral(node) { + return node.type === "Literal" && typeof node.value === "string"; +} + +/** + * Determines if the property is a shorthand or not. + * @param {ASTNode} property Property AST node + * @returns {boolean} True if the property is considered shorthand, false if not. + * @private + */ +function isShorthand(property) { + // property.method is true when `{a(){}}`. + return property.shorthand || property.method; +} + +/** + * Determines if the property's key and method or value are named equally. + * @param {ASTNode} property Property AST node + * @returns {boolean} True if the key and value are named equally, false if not. + * @private + */ +function isRedundant(property) { + const value = property.value; + + if (value.type === "FunctionExpression") { + return !value.id; // Only anonymous should be shorthand method. + } + if (value.type === "Identifier") { + return astUtils.getStaticPropertyName(property) === value.name; + } + + return false; +} + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -139,86 +219,6 @@ module.exports = { const AVOID_EXPLICIT_RETURN_ARROWS = !!PARAMS.avoidExplicitReturnArrows; const sourceCode = context.sourceCode; - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - const CTOR_PREFIX_REGEX = /[^_$0-9]/u; - - /** - * Determines if the first character of the name is a capital letter. - * @param {string} name The name of the node to evaluate. - * @returns {boolean} True if the first character of the property name is a capital letter, false if not. - * @private - */ - function isConstructor(name) { - const match = CTOR_PREFIX_REGEX.exec(name); - - // Not a constructor if name has no characters apart from '_', '$' and digits e.g. '_', '$$', '_8' - if (!match) { - return false; - } - - const firstChar = name.charAt(match.index); - - return firstChar === firstChar.toUpperCase(); - } - - /** - * Determines if the property can have a shorthand form. - * @param {ASTNode} property Property AST node - * @returns {boolean} True if the property can have a shorthand form - * @private - */ - function canHaveShorthand(property) { - return ( - property.kind !== "set" && - property.kind !== "get" && - property.type !== "SpreadElement" && - property.type !== "SpreadProperty" && - property.type !== "ExperimentalSpreadProperty" - ); - } - - /** - * Checks whether a node is a string literal. - * @param {ASTNode} node Any AST node. - * @returns {boolean} `true` if it is a string literal. - */ - function isStringLiteral(node) { - return node.type === "Literal" && typeof node.value === "string"; - } - - /** - * Determines if the property is a shorthand or not. - * @param {ASTNode} property Property AST node - * @returns {boolean} True if the property is considered shorthand, false if not. - * @private - */ - function isShorthand(property) { - // property.method is true when `{a(){}}`. - return property.shorthand || property.method; - } - - /** - * Determines if the property's key and method or value are named equally. - * @param {ASTNode} property Property AST node - * @returns {boolean} True if the key and value are named equally, false if not. - * @private - */ - function isRedundant(property) { - const value = property.value; - - if (value.type === "FunctionExpression") { - return !value.id; // Only anonymous should be shorthand method. - } - if (value.type === "Identifier") { - return astUtils.getStaticPropertyName(property) === value.name; - } - - return false; - } - /** * Ensures that an object's properties are consistently shorthand, or not shorthand at all. * @param {ASTNode} node Property AST node @@ -582,6 +582,19 @@ module.exports = { node.key.name === node.value.name && APPLY_TO_PROPS ) { + // Skip if there are JSDoc comments inside the property (e.g., JSDoc type annotations) + const comments = sourceCode.getCommentsInside(node); + if ( + comments.some( + comment => + comment.type === "Block" && + JSDOC_COMMENT_REGEX.test(comment.value) && + comment.value.includes("@type"), + ) + ) { + return; + } + // {x: x} should be written as {x} context.report({ node, @@ -606,6 +619,18 @@ module.exports = { return; } + const comments = sourceCode.getCommentsInside(node); + if ( + comments.some( + comment => + comment.type === "Block" && + comment.value.startsWith("*") && + comment.value.includes("@type"), + ) + ) { + return; + } + // {"x": x} should be written as {x} context.report({ node, diff --git a/node_modules/eslint/lib/rules/utils/ast-utils.js b/node_modules/eslint/lib/rules/utils/ast-utils.js index bb465e04..dff0945d 100644 --- a/node_modules/eslint/lib/rules/utils/ast-utils.js +++ b/node_modules/eslint/lib/rules/utils/ast-utils.js @@ -2729,4 +2729,5 @@ module.exports = { isStartOfExpressionStatement, needsPrecedingSemicolon, isImportAttributeKey, + getOpeningParenOfParams, }; diff --git a/node_modules/eslint/lib/types/index.d.ts b/node_modules/eslint/lib/types/index.d.ts index fb423d4b..e316106b 100644 --- a/node_modules/eslint/lib/types/index.d.ts +++ b/node_modules/eslint/lib/types/index.d.ts @@ -33,7 +33,6 @@ import type { LanguageOptions as GenericLanguageOptions, RuleContext as CoreRuleContext, RuleDefinition, - RuleVisitor, SourceRange, TextSourceCode, TraversalStep, @@ -56,11 +55,40 @@ import type { ProcessorFile as CoreProcessorFile, JavaScriptParserOptionsConfig, RulesMeta, + RuleConfig, RuleTextEditor, RuleTextEdit, + RuleVisitor, + BaseConfig as CoreBaseConfig, + RuleFixer as CoreRuleFixer, + ViolationReportBase, + ViolationMessage, + ViolationLocation, + SuggestionMessage, + LintSuggestion as CoreLintSuggestion, + JavaScriptSourceType, + HasRules as CoreHasRules, + SuggestedEditBase, + SuggestedEdit, + ViolationReport, } from "@eslint/core"; import { LegacyESLint } from "./use-at-your-own-risk.js"; +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** Adds matching `:exit` selectors for all properties of a `RuleVisitor`. */ +type WithExit = { + [Key in keyof RuleVisitorType as + | Key + | `${Key & string}:exit`]: RuleVisitorType[Key]; +}; + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + export namespace AST { type TokenType = | "Boolean" @@ -133,6 +161,10 @@ export namespace Scope { references: Reference[]; through: Reference[]; functionExpressionScope: boolean; + implicit?: { + variables: Variable[]; + set: Map; + }; } interface Variable { @@ -173,7 +205,14 @@ export namespace Scope { node: ESTree.FunctionDeclaration | ESTree.FunctionExpression; parent: null; } - | { type: "ImplicitGlobalVariable"; node: ESTree.Program; parent: null } + | { + type: "ImplicitGlobalVariable"; + node: + | ESTree.AssignmentExpression + | ESTree.ForInStatement + | ESTree.ForOfStatement; + parent: null; + } | { type: "ImportBinding"; node: @@ -640,480 +679,35 @@ export namespace Rule { LangOptions: Linter.LanguageOptions; Code: SourceCode; RuleOptions: any[]; - Visitor: NodeListener; + Visitor: RuleListener; Node: JSSyntaxElement; MessageIds: string; ExtRuleDocs: {}; }> { - create(context: RuleContext): NodeListener; + create(context: RuleContext): RuleListener; } type NodeTypes = ESTree.Node["type"]; - interface NodeListener extends RuleVisitor { - ArrayExpression?: - | ((node: ESTree.ArrayExpression & NodeParentExtension) => void) - | undefined; - "ArrayExpression:exit"?: - | ((node: ESTree.ArrayExpression & NodeParentExtension) => void) - | undefined; - ArrayPattern?: - | ((node: ESTree.ArrayPattern & NodeParentExtension) => void) - | undefined; - "ArrayPattern:exit"?: - | ((node: ESTree.ArrayPattern & NodeParentExtension) => void) - | undefined; - ArrowFunctionExpression?: - | (( - node: ESTree.ArrowFunctionExpression & NodeParentExtension, - ) => void) - | undefined; - "ArrowFunctionExpression:exit"?: - | (( - node: ESTree.ArrowFunctionExpression & NodeParentExtension, - ) => void) - | undefined; - AssignmentExpression?: - | (( - node: ESTree.AssignmentExpression & NodeParentExtension, - ) => void) - | undefined; - "AssignmentExpression:exit"?: - | (( - node: ESTree.AssignmentExpression & NodeParentExtension, - ) => void) - | undefined; - AssignmentPattern?: - | ((node: ESTree.AssignmentPattern & NodeParentExtension) => void) - | undefined; - "AssignmentPattern:exit"?: - | ((node: ESTree.AssignmentPattern & NodeParentExtension) => void) - | undefined; - AwaitExpression?: - | ((node: ESTree.AwaitExpression & NodeParentExtension) => void) - | undefined; - "AwaitExpression:exit"?: - | ((node: ESTree.AwaitExpression & NodeParentExtension) => void) - | undefined; - BinaryExpression?: - | ((node: ESTree.BinaryExpression & NodeParentExtension) => void) - | undefined; - "BinaryExpression:exit"?: - | ((node: ESTree.BinaryExpression & NodeParentExtension) => void) - | undefined; - BlockStatement?: - | ((node: ESTree.BlockStatement & NodeParentExtension) => void) - | undefined; - "BlockStatement:exit"?: - | ((node: ESTree.BlockStatement & NodeParentExtension) => void) - | undefined; - BreakStatement?: - | ((node: ESTree.BreakStatement & NodeParentExtension) => void) - | undefined; - "BreakStatement:exit"?: - | ((node: ESTree.BreakStatement & NodeParentExtension) => void) - | undefined; - CallExpression?: - | ((node: ESTree.CallExpression & NodeParentExtension) => void) - | undefined; - "CallExpression:exit"?: - | ((node: ESTree.CallExpression & NodeParentExtension) => void) - | undefined; - CatchClause?: - | ((node: ESTree.CatchClause & NodeParentExtension) => void) - | undefined; - "CatchClause:exit"?: - | ((node: ESTree.CatchClause & NodeParentExtension) => void) - | undefined; - ChainExpression?: - | ((node: ESTree.ChainExpression & NodeParentExtension) => void) - | undefined; - "ChainExpression:exit"?: - | ((node: ESTree.ChainExpression & NodeParentExtension) => void) - | undefined; - ClassBody?: - | ((node: ESTree.ClassBody & NodeParentExtension) => void) - | undefined; - "ClassBody:exit"?: - | ((node: ESTree.ClassBody & NodeParentExtension) => void) - | undefined; - ClassDeclaration?: - | ((node: ESTree.ClassDeclaration & NodeParentExtension) => void) - | undefined; - "ClassDeclaration:exit"?: - | ((node: ESTree.ClassDeclaration & NodeParentExtension) => void) - | undefined; - ClassExpression?: - | ((node: ESTree.ClassExpression & NodeParentExtension) => void) - | undefined; - "ClassExpression:exit"?: - | ((node: ESTree.ClassExpression & NodeParentExtension) => void) - | undefined; - ConditionalExpression?: - | (( - node: ESTree.ConditionalExpression & NodeParentExtension, - ) => void) - | undefined; - "ConditionalExpression:exit"?: - | (( - node: ESTree.ConditionalExpression & NodeParentExtension, - ) => void) - | undefined; - ContinueStatement?: - | ((node: ESTree.ContinueStatement & NodeParentExtension) => void) - | undefined; - "ContinueStatement:exit"?: - | ((node: ESTree.ContinueStatement & NodeParentExtension) => void) - | undefined; - DebuggerStatement?: - | ((node: ESTree.DebuggerStatement & NodeParentExtension) => void) - | undefined; - "DebuggerStatement:exit"?: - | ((node: ESTree.DebuggerStatement & NodeParentExtension) => void) - | undefined; - DoWhileStatement?: - | ((node: ESTree.DoWhileStatement & NodeParentExtension) => void) - | undefined; - "DoWhileStatement:exit"?: - | ((node: ESTree.DoWhileStatement & NodeParentExtension) => void) - | undefined; - EmptyStatement?: - | ((node: ESTree.EmptyStatement & NodeParentExtension) => void) - | undefined; - "EmptyStatement:exit"?: - | ((node: ESTree.EmptyStatement & NodeParentExtension) => void) - | undefined; - ExportAllDeclaration?: - | (( - node: ESTree.ExportAllDeclaration & NodeParentExtension, - ) => void) - | undefined; - "ExportAllDeclaration:exit"?: - | (( - node: ESTree.ExportAllDeclaration & NodeParentExtension, - ) => void) - | undefined; - ExportDefaultDeclaration?: - | (( - node: ESTree.ExportDefaultDeclaration & NodeParentExtension, - ) => void) - | undefined; - "ExportDefaultDeclaration:exit"?: - | (( - node: ESTree.ExportDefaultDeclaration & NodeParentExtension, - ) => void) - | undefined; - ExportNamedDeclaration?: - | (( - node: ESTree.ExportNamedDeclaration & NodeParentExtension, - ) => void) - | undefined; - "ExportNamedDeclaration:exit"?: - | (( - node: ESTree.ExportNamedDeclaration & NodeParentExtension, - ) => void) - | undefined; - ExportSpecifier?: - | ((node: ESTree.ExportSpecifier & NodeParentExtension) => void) - | undefined; - "ExportSpecifier:exit"?: - | ((node: ESTree.ExportSpecifier & NodeParentExtension) => void) - | undefined; - ExpressionStatement?: - | ((node: ESTree.ExpressionStatement & NodeParentExtension) => void) - | undefined; - "ExpressionStatement:exit"?: - | ((node: ESTree.ExpressionStatement & NodeParentExtension) => void) - | undefined; - ForInStatement?: - | ((node: ESTree.ForInStatement & NodeParentExtension) => void) - | undefined; - "ForInStatement:exit"?: - | ((node: ESTree.ForInStatement & NodeParentExtension) => void) - | undefined; - ForOfStatement?: - | ((node: ESTree.ForOfStatement & NodeParentExtension) => void) - | undefined; - "ForOfStatement:exit"?: - | ((node: ESTree.ForOfStatement & NodeParentExtension) => void) - | undefined; - ForStatement?: - | ((node: ESTree.ForStatement & NodeParentExtension) => void) - | undefined; - "ForStatement:exit"?: - | ((node: ESTree.ForStatement & NodeParentExtension) => void) - | undefined; - FunctionDeclaration?: - | ((node: ESTree.FunctionDeclaration & NodeParentExtension) => void) - | undefined; - "FunctionDeclaration:exit"?: - | ((node: ESTree.FunctionDeclaration & NodeParentExtension) => void) - | undefined; - FunctionExpression?: - | ((node: ESTree.FunctionExpression & NodeParentExtension) => void) - | undefined; - "FunctionExpression:exit"?: - | ((node: ESTree.FunctionExpression & NodeParentExtension) => void) - | undefined; - Identifier?: - | ((node: ESTree.Identifier & NodeParentExtension) => void) - | undefined; - "Identifier:exit"?: - | ((node: ESTree.Identifier & NodeParentExtension) => void) - | undefined; - IfStatement?: - | ((node: ESTree.IfStatement & NodeParentExtension) => void) - | undefined; - "IfStatement:exit"?: - | ((node: ESTree.IfStatement & NodeParentExtension) => void) - | undefined; - ImportDeclaration?: - | ((node: ESTree.ImportDeclaration & NodeParentExtension) => void) - | undefined; - "ImportDeclaration:exit"?: - | ((node: ESTree.ImportDeclaration & NodeParentExtension) => void) - | undefined; - ImportDefaultSpecifier?: - | (( - node: ESTree.ImportDefaultSpecifier & NodeParentExtension, - ) => void) - | undefined; - "ImportDefaultSpecifier:exit"?: - | (( - node: ESTree.ImportDefaultSpecifier & NodeParentExtension, - ) => void) - | undefined; - ImportExpression?: - | ((node: ESTree.ImportExpression & NodeParentExtension) => void) - | undefined; - "ImportExpression:exit"?: - | ((node: ESTree.ImportExpression & NodeParentExtension) => void) - | undefined; - ImportNamespaceSpecifier?: - | (( - node: ESTree.ImportNamespaceSpecifier & NodeParentExtension, - ) => void) - | undefined; - "ImportNamespaceSpecifier:exit"?: - | (( - node: ESTree.ImportNamespaceSpecifier & NodeParentExtension, - ) => void) - | undefined; - ImportSpecifier?: - | ((node: ESTree.ImportSpecifier & NodeParentExtension) => void) - | undefined; - "ImportSpecifier:exit"?: - | ((node: ESTree.ImportSpecifier & NodeParentExtension) => void) - | undefined; - LabeledStatement?: - | ((node: ESTree.LabeledStatement & NodeParentExtension) => void) - | undefined; - "LabeledStatement:exit"?: - | ((node: ESTree.LabeledStatement & NodeParentExtension) => void) - | undefined; - Literal?: - | ((node: ESTree.Literal & NodeParentExtension) => void) - | undefined; - "Literal:exit"?: - | ((node: ESTree.Literal & NodeParentExtension) => void) - | undefined; - LogicalExpression?: - | ((node: ESTree.LogicalExpression & NodeParentExtension) => void) - | undefined; - "LogicalExpression:exit"?: - | ((node: ESTree.LogicalExpression & NodeParentExtension) => void) - | undefined; - MemberExpression?: - | ((node: ESTree.MemberExpression & NodeParentExtension) => void) - | undefined; - "MemberExpression:exit"?: - | ((node: ESTree.MemberExpression & NodeParentExtension) => void) - | undefined; - MetaProperty?: - | ((node: ESTree.MetaProperty & NodeParentExtension) => void) - | undefined; - "MetaProperty:exit"?: - | ((node: ESTree.MetaProperty & NodeParentExtension) => void) - | undefined; - MethodDefinition?: - | ((node: ESTree.MethodDefinition & NodeParentExtension) => void) - | undefined; - "MethodDefinition:exit"?: - | ((node: ESTree.MethodDefinition & NodeParentExtension) => void) - | undefined; - NewExpression?: - | ((node: ESTree.NewExpression & NodeParentExtension) => void) - | undefined; - "NewExpression:exit"?: - | ((node: ESTree.NewExpression & NodeParentExtension) => void) - | undefined; - ObjectExpression?: - | ((node: ESTree.ObjectExpression & NodeParentExtension) => void) - | undefined; - "ObjectExpression:exit"?: - | ((node: ESTree.ObjectExpression & NodeParentExtension) => void) - | undefined; - ObjectPattern?: - | ((node: ESTree.ObjectPattern & NodeParentExtension) => void) - | undefined; - "ObjectPattern:exit"?: - | ((node: ESTree.ObjectPattern & NodeParentExtension) => void) - | undefined; - PrivateIdentifier?: - | ((node: ESTree.PrivateIdentifier & NodeParentExtension) => void) - | undefined; - "PrivateIdentifier:exit"?: - | ((node: ESTree.PrivateIdentifier & NodeParentExtension) => void) - | undefined; - Program?: ((node: ESTree.Program) => void) | undefined; - "Program:exit"?: ((node: ESTree.Program) => void) | undefined; - Property?: - | ((node: ESTree.Property & NodeParentExtension) => void) - | undefined; - "Property:exit"?: - | ((node: ESTree.Property & NodeParentExtension) => void) - | undefined; - PropertyDefinition?: - | ((node: ESTree.PropertyDefinition & NodeParentExtension) => void) - | undefined; - "PropertyDefinition:exit"?: - | ((node: ESTree.PropertyDefinition & NodeParentExtension) => void) - | undefined; - RestElement?: - | ((node: ESTree.RestElement & NodeParentExtension) => void) - | undefined; - "RestElement:exit"?: - | ((node: ESTree.RestElement & NodeParentExtension) => void) - | undefined; - ReturnStatement?: - | ((node: ESTree.ReturnStatement & NodeParentExtension) => void) - | undefined; - "ReturnStatement:exit"?: - | ((node: ESTree.ReturnStatement & NodeParentExtension) => void) - | undefined; - SequenceExpression?: - | ((node: ESTree.SequenceExpression & NodeParentExtension) => void) - | undefined; - "SequenceExpression:exit"?: - | ((node: ESTree.SequenceExpression & NodeParentExtension) => void) - | undefined; - SpreadElement?: - | ((node: ESTree.SpreadElement & NodeParentExtension) => void) - | undefined; - "SpreadElement:exit"?: - | ((node: ESTree.SpreadElement & NodeParentExtension) => void) - | undefined; - StaticBlock?: - | ((node: ESTree.StaticBlock & NodeParentExtension) => void) - | undefined; - "StaticBlock:exit"?: - | ((node: ESTree.StaticBlock & NodeParentExtension) => void) - | undefined; - Super?: - | ((node: ESTree.Super & NodeParentExtension) => void) - | undefined; - "Super:exit"?: - | ((node: ESTree.Super & NodeParentExtension) => void) - | undefined; - SwitchCase?: - | ((node: ESTree.SwitchCase & NodeParentExtension) => void) - | undefined; - "SwitchCase:exit"?: - | ((node: ESTree.SwitchCase & NodeParentExtension) => void) - | undefined; - SwitchStatement?: - | ((node: ESTree.SwitchStatement & NodeParentExtension) => void) - | undefined; - "SwitchStatement:exit"?: - | ((node: ESTree.SwitchStatement & NodeParentExtension) => void) - | undefined; - TaggedTemplateExpression?: - | (( - node: ESTree.TaggedTemplateExpression & NodeParentExtension, - ) => void) - | undefined; - "TaggedTemplateExpression:exit"?: - | (( - node: ESTree.TaggedTemplateExpression & NodeParentExtension, - ) => void) - | undefined; - TemplateElement?: - | ((node: ESTree.TemplateElement & NodeParentExtension) => void) - | undefined; - "TemplateElement:exit"?: - | ((node: ESTree.TemplateElement & NodeParentExtension) => void) - | undefined; - TemplateLiteral?: - | ((node: ESTree.TemplateLiteral & NodeParentExtension) => void) - | undefined; - "TemplateLiteral:exit"?: - | ((node: ESTree.TemplateLiteral & NodeParentExtension) => void) - | undefined; - ThisExpression?: - | ((node: ESTree.ThisExpression & NodeParentExtension) => void) - | undefined; - "ThisExpression:exit"?: - | ((node: ESTree.ThisExpression & NodeParentExtension) => void) - | undefined; - ThrowStatement?: - | ((node: ESTree.ThrowStatement & NodeParentExtension) => void) - | undefined; - "ThrowStatement:exit"?: - | ((node: ESTree.ThrowStatement & NodeParentExtension) => void) - | undefined; - TryStatement?: - | ((node: ESTree.TryStatement & NodeParentExtension) => void) - | undefined; - "TryStatement:exit"?: - | ((node: ESTree.TryStatement & NodeParentExtension) => void) - | undefined; - UnaryExpression?: - | ((node: ESTree.UnaryExpression & NodeParentExtension) => void) - | undefined; - "UnaryExpression:exit"?: - | ((node: ESTree.UnaryExpression & NodeParentExtension) => void) - | undefined; - UpdateExpression?: - | ((node: ESTree.UpdateExpression & NodeParentExtension) => void) - | undefined; - "UpdateExpression:exit"?: - | ((node: ESTree.UpdateExpression & NodeParentExtension) => void) - | undefined; - VariableDeclaration?: - | ((node: ESTree.VariableDeclaration & NodeParentExtension) => void) - | undefined; - "VariableDeclaration:exit"?: - | ((node: ESTree.VariableDeclaration & NodeParentExtension) => void) - | undefined; - VariableDeclarator?: - | ((node: ESTree.VariableDeclarator & NodeParentExtension) => void) - | undefined; - "VariableDeclarator:exit"?: - | ((node: ESTree.VariableDeclarator & NodeParentExtension) => void) - | undefined; - WhileStatement?: - | ((node: ESTree.WhileStatement & NodeParentExtension) => void) - | undefined; - "WhileStatement:exit"?: - | ((node: ESTree.WhileStatement & NodeParentExtension) => void) - | undefined; - WithStatement?: - | ((node: ESTree.WithStatement & NodeParentExtension) => void) - | undefined; - "WithStatement:exit"?: - | ((node: ESTree.WithStatement & NodeParentExtension) => void) - | undefined; - YieldExpression?: - | ((node: ESTree.YieldExpression & NodeParentExtension) => void) - | undefined; - "YieldExpression:exit"?: - | ((node: ESTree.YieldExpression & NodeParentExtension) => void) - | undefined; - } + + interface NodeListener + extends WithExit< + { + [Node in Rule.Node as Node["type"]]?: + | ((node: Node) => void) + | undefined; + } & { + // A `Program` visitor's node type has no `parent` property. + Program?: ((node: AST.Program) => void) | undefined; + } + > {} interface NodeParentExtension { parent: Node; } - type Node = ESTree.Node & NodeParentExtension; + + type Node = + | (AST.Program & { parent: null }) + | (Exclude & NodeParentExtension); interface RuleListener extends NodeListener { onCodePathStart?(codePath: CodePath, node: Node): void; @@ -1124,6 +718,16 @@ export namespace Rule { onCodePathSegmentEnd?(segment: CodePathSegment, node: Node): void; + onUnreachableCodePathSegmentStart?( + segment: CodePathSegment, + node: Node, + ): void; + + onUnreachableCodePathSegmentEnd?( + segment: CodePathSegment, + node: Node, + ): void; + onCodePathSegmentLoop?( fromSegment: CodePathSegment, toSegment: CodePathSegment, @@ -1178,37 +782,21 @@ export namespace Rule { MessageIds: string; }> {} - type ReportFixer = ( - fixer: RuleFixer, - ) => null | Fix | IterableIterator | Fix[]; + type ReportFixer = CoreRuleFixer; - interface ReportDescriptorOptionsBase { - data?: { [key: string]: string }; + /** @deprecated Use `ReportDescriptorOptions` instead. */ + type ReportDescriptorOptionsBase = ViolationReportBase; - fix?: null | ReportFixer; - } + type SuggestionReportOptions = SuggestedEditBase; + type SuggestionDescriptorMessage = SuggestionMessage; + type SuggestionReportDescriptor = SuggestedEdit; - interface SuggestionReportOptions { - data?: { [key: string]: string }; + // redundant with ReportDescriptorOptionsBase but kept for clarity + type ReportDescriptorOptions = ViolationReportBase; - fix: ReportFixer; - } - - type SuggestionDescriptorMessage = { desc: string } | { messageId: string }; - type SuggestionReportDescriptor = SuggestionDescriptorMessage & - SuggestionReportOptions; - - interface ReportDescriptorOptions extends ReportDescriptorOptionsBase { - suggest?: SuggestionReportDescriptor[] | null | undefined; - } - - type ReportDescriptor = ReportDescriptorMessage & - ReportDescriptorLocation & - ReportDescriptorOptions; - type ReportDescriptorMessage = { message: string } | { messageId: string }; - type ReportDescriptorLocation = - | { node: ESTree.Node } - | { loc: AST.SourceLocation | { line: number; column: number } }; + type ReportDescriptor = ViolationReport; + type ReportDescriptorMessage = ViolationMessage; + type ReportDescriptorLocation = ViolationLocation; type RuleFixer = RuleTextEditor; type Fix = RuleTextEdit; @@ -1222,7 +810,7 @@ export type JSRuleDefinition< { LangOptions: Linter.LanguageOptions; Code: SourceCode; - Visitor: Rule.NodeListener; + Visitor: Rule.RuleListener; Node: JSSyntaxElement; }, Options @@ -1318,9 +906,7 @@ export namespace Linter { * * @see [Rules](https://eslint.org/docs/latest/use/configure/rules) */ - type RuleEntry = - | RuleSeverity - | RuleSeverityAndOptions; + type RuleEntry = RuleConfig; /** * The rules config object is a key/value map of rule names and their severity and options. @@ -1330,9 +916,8 @@ export namespace Linter { /** * A configuration object that may have a `rules` block. */ - interface HasRules { - rules?: Partial | undefined; - } + type HasRules = + CoreHasRules; /** * The ECMAScript version of the code being linted. @@ -1342,99 +927,17 @@ export namespace Linter { /** * The type of JavaScript source code. */ - // TODO: Refactor to JavaScriptSourceType when exported from @eslint/core. - type SourceType = "script" | "module" | "commonjs"; + type SourceType = JavaScriptSourceType; /** * ESLint legacy configuration. * * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) */ - interface BaseConfig< + type BaseConfig< Rules extends RulesConfig = RulesConfig, OverrideRules extends RulesConfig = Rules, - > extends HasRules { - $schema?: string | undefined; - - /** - * An environment provides predefined global variables. - * - * @see [Environments](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-environments) - */ - env?: { [name: string]: boolean } | undefined; - - /** - * Extending configuration files. - * - * @see [Extends](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#extending-configuration-files) - */ - extends?: string | string[] | undefined; - - /** - * Specifying globals. - * - * @see [Globals](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-globals) - */ - globals?: Linter.Globals | undefined; - - /** - * Disable processing of inline comments. - * - * @see [Disabling Inline Comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#disabling-inline-comments) - */ - noInlineConfig?: boolean | undefined; - - /** - * Overrides can be used to use a differing configuration for matching sub-directories and files. - * - * @see [How do overrides work](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#how-do-overrides-work) - */ - overrides?: Array> | undefined; - - /** - * Parser. - * - * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) - * @see [Specifying Parser](https://eslint.org/docs/latest/use/configure/parser-deprecated) - */ - parser?: string | undefined; - - /** - * Parser options. - * - * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) - * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options) - */ - parserOptions?: JavaScriptParserOptionsConfig | undefined; - - /** - * Which third-party plugins define additional rules, environments, configs, etc. for ESLint to use. - * - * @see [Configuring Plugins](https://eslint.org/docs/latest/use/configure/plugins-deprecated#configure-plugins) - */ - plugins?: string[] | undefined; - - /** - * Specifying processor. - * - * @see [processor](https://eslint.org/docs/latest/use/configure/plugins-deprecated#specify-a-processor) - */ - processor?: string | undefined; - - /** - * Report unused eslint-disable comments as warning. - * - * @see [Report unused eslint-disable comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#report-unused-eslint-disable-comments) - */ - reportUnusedDisableDirectives?: boolean | undefined; - - /** - * Settings. - * - * @see [Settings](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#adding-shared-settings) - */ - settings?: { [name: string]: any } | undefined; - } + > = CoreBaseConfig; /** * The overwrites that apply more differing configuration to specific files or directories. @@ -1477,18 +980,7 @@ export namespace Linter { reportUnusedDisableDirectives?: boolean | undefined; } - // TODO: Once exported from @eslint/core, remove this and use that instead - interface LintSuggestion { - /** A short description. */ - desc: string; - - /** Fix result info. */ - fix: Rule.Fix; - - /** Id referencing a message for the description. */ - messageId?: string | undefined; - } - + type LintSuggestion = CoreLintSuggestion; type LintMessage = CoreLintMessage; interface LintSuppression { diff --git a/node_modules/eslint/package.json b/node_modules/eslint/package.json index 61fe32f2..69fe1151 100644 --- a/node_modules/eslint/package.json +++ b/node_modules/eslint/package.json @@ -1,6 +1,6 @@ { "name": "eslint", - "version": "9.38.0", + "version": "9.39.0", "author": "Nicholas C. Zakas ", "description": "An AST-based pattern checker for JavaScript.", "type": "commonjs", @@ -83,8 +83,9 @@ "*": "trunk check --fix", "lib/rules/*.js": [ "node tools/update-eslint-all.js", + "node tools/update-eslint-recommended.js", "node tools/update-rule-type-headers.js", - "git add packages/js/src/configs/eslint-all.js lib/types/rules.d.ts" + "git add packages/js/src/configs/*.js lib/types/rules.d.ts" ], "docs/src/rules/*.md": [ "node tools/check-rule-examples.js", @@ -108,11 +109,11 @@ "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", - "@eslint/config-helpers": "^0.4.1", - "@eslint/core": "^0.16.0", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.38.0", - "@eslint/plugin-kit": "^0.4.0", + "@eslint/js": "9.39.0", + "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", @@ -145,7 +146,7 @@ "@babel/core": "^7.4.3", "@babel/preset-env": "^7.4.3", "@cypress/webpack-preprocessor": "^6.0.2", - "@eslint/json": "^0.13.0", + "@eslint/json": "^0.13.2", "@trunkio/launcher": "^1.3.4", "@types/esquery": "^1.5.4", "@types/node": "^22.13.14", diff --git a/package-lock.json b/package-lock.json index 672f81a6..f55b00b8 100755 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "prom-client": "^15.1.3" }, "devDependencies": { - "eslint": "^9.38.0", + "eslint": "^9.39.0", "jest": "^30.2.0", "nodemon": "^3.1.10", "supertest": "^7.1.4" @@ -650,7 +650,7 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@eslint/config-helpers/node_modules/@eslint/core": { + "node_modules/@eslint/core": { "version": "0.17.0", "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", @@ -663,19 +663,6 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@eslint/core": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.16.0.tgz", - "integrity": "sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, "node_modules/@eslint/eslintrc": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", @@ -701,9 +688,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.38.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.38.0.tgz", - "integrity": "sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A==", + "version": "9.39.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.0.tgz", + "integrity": "sha512-BIhe0sW91JGPiaF1mOuPy5v8NflqfjIcDNpC+LbW9f609WVRX1rArrhi6Z2ymvrAry9jw+5POTj4t2t62o8Bmw==", "dev": true, "license": "MIT", "engines": { @@ -737,19 +724,6 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@eslint/plugin-kit/node_modules/@eslint/core": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", - "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, "node_modules/@humanfs/core": { "version": "0.19.1", "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", @@ -2905,20 +2879,20 @@ } }, "node_modules/eslint": { - "version": "9.38.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.38.0.tgz", - "integrity": "sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw==", + "version": "9.39.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.0.tgz", + "integrity": "sha512-iy2GE3MHrYTL5lrCtMZ0X1KLEKKUjmK0kzwcnefhR66txcEmXZD2YWgR5GNdcEwkNx3a0siYkSvl0vIC+Svjmg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", - "@eslint/config-helpers": "^0.4.1", - "@eslint/core": "^0.16.0", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.38.0", - "@eslint/plugin-kit": "^0.4.0", + "@eslint/js": "9.39.0", + "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", diff --git a/package.json b/package.json index f72818a3..69c82ff5 100755 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "start": "node index.js", "dev": "nodemon index.js", "lint": "eslint .", - "test": "jest --coverage", + "test": "jest", "test:integration": "jest --config jest.integration.config.js" }, "keywords": [], @@ -30,7 +30,7 @@ "prom-client": "^15.1.3" }, "devDependencies": { - "eslint": "^9.38.0", + "eslint": "^9.39.0", "jest": "^30.2.0", "nodemon": "^3.1.10", "supertest": "^7.1.4" diff --git a/test/app.test.js b/test/app.test.js new file mode 100644 index 00000000..2fd6a0ba --- /dev/null +++ b/test/app.test.js @@ -0,0 +1,9 @@ +const request = require('supertest'); +const app = require('../index'); // ton serveur express + +describe('Test API health', () => { + it('GET /health doit rΓ©pondre 200', async () => { + const res = await request(app).get('/health'); + expect(res.statusCode).toBe(200); + }); +});