diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 1d4c74bd43..0000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,126 +0,0 @@ -/*! - * Copyright 2020 Google LLC - * - * 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. - */ - -module.exports = { - root: true, - parser: '@typescript-eslint/parser', - plugins: [ - '@typescript-eslint', - ], - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - ], - rules: { - // Following checks are temporarily disabled. We shall incrementally enable them in the - // future, fixing any violations as we go. - '@typescript-eslint/no-non-null-assertion': 0, - - // Disabled checks - '@typescript-eslint/no-explicit-any': 0, - '@typescript-eslint/no-use-before-define': 0, - '@typescript-eslint/no-var-requires': 0, - '@typescript-eslint/no-require-imports': 0, - '@typescript-eslint/no-unused-expressions': 0, - - // Required checks - 'indent': ['error', 2], - 'keyword-spacing': ['error'], - 'max-len': [ - 'error', - { - 'code': 120, - 'ignoreUrls': true - } - ], - 'object-curly-spacing': [2, 'always'], - '@typescript-eslint/explicit-function-return-type': [ - 'error', - { - 'allowExpressions': true, - 'allowTypedFunctionExpressions': true, - 'allowHigherOrderFunctions': true - } - ], - 'no-unused-vars': 'off', // Must be disabled to enable the next rule - '@typescript-eslint/no-unused-vars': [ - 'error', - { - 'varsIgnorePattern': '^_', - 'argsIgnorePattern': '^_', - 'caughtErrors': 'none' - } - ], - 'quotes': ['error', 'single', {'avoidEscape': true}], - '@typescript-eslint/naming-convention': [ - 'error', - { - "selector": "variable", - "format": ["camelCase", "UPPER_CASE"] - }, - { - "selector": "parameter", - "format": ["camelCase"], - "leadingUnderscore": "allow" - }, - - { - "selector": "memberLike", - "format": ["camelCase"] - }, - - { - "selector": "typeLike", - "format": ["PascalCase"] - }, - - // Ignore properties that require quotes (HTTP headers, names that include spaces or dashes etc.). - { - "selector": [ - "classProperty", - "objectLiteralProperty", - "typeProperty", - "classMethod", - "objectLiteralMethod", - "typeMethod", - "accessor", - "enumMember" - ], - "format": null, - "modifiers": ["requiresQuotes"] - }, - - // Ignore destructured property names. - { - "selector": "variable", - "modifiers": ["destructured"], - "format": null - }, - - // Following types are temporarily disabled. We shall incrementally enable them in the - // future, fixing any violations as we go. - { - "selector": [ - "classProperty", - "objectLiteralProperty", - "typeProperty", - "enumMember" - ], - "format": null - } - ], - } -}; diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000000..f9cbfc179a --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,153 @@ +/*! + * Copyright 2026 Google LLC + * + * 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. + */ + +import { defineConfig } from 'eslint/config'; +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import globals from 'globals'; + +export default defineConfig([ + eslint.configs.recommended, + ...tseslint.configs.recommended, + { + files: ['src/**/*.ts', 'test/**/*.ts'], + languageOptions: { + globals: { + ...globals.node, + }, + }, + rules: { + // Following checks are temporarily disabled. We shall incrementally enable them in the + // future, fixing any violations as we go. + '@typescript-eslint/no-non-null-assertion': 0, + + // Disabled checks + '@typescript-eslint/no-explicit-any': 0, + '@typescript-eslint/no-use-before-define': 0, + '@typescript-eslint/no-var-requires': 0, + '@typescript-eslint/no-require-imports': 0, + '@typescript-eslint/no-unused-expressions': 0, + + // Required checks + 'indent': ['error', 2], + 'keyword-spacing': ['error'], + 'max-len': [ + 'error', + { + 'code': 120, + 'ignoreUrls': true + } + ], + 'object-curly-spacing': [2, 'always'], + '@typescript-eslint/explicit-function-return-type': [ + 'error', + { + 'allowExpressions': true, + 'allowTypedFunctionExpressions': true, + 'allowHigherOrderFunctions': true + } + ], + 'no-unused-vars': 'off', // Must be disabled to enable the next rule + '@typescript-eslint/no-unused-vars': [ + 'error', + { + 'varsIgnorePattern': '^_', + 'argsIgnorePattern': '^_', + 'caughtErrors': 'none' + } + ], + 'quotes': ['error', 'single', {'avoidEscape': true}], + '@typescript-eslint/naming-convention': [ + 'error', + { + "selector": "variable", + "format": ["camelCase", "UPPER_CASE"] + }, + { + "selector": "parameter", + "format": ["camelCase"], + "leadingUnderscore": "allow" + }, + + { + "selector": "memberLike", + "format": ["camelCase"] + }, + + { + "selector": "typeLike", + "format": ["PascalCase"] + }, + + // Ignore properties that require quotes (HTTP headers, names that include spaces or dashes etc.). + { + "selector": [ + "classProperty", + "objectLiteralProperty", + "typeProperty", + "classMethod", + "objectLiteralMethod", + "typeMethod", + "accessor", + "enumMember" + ], + "format": null, + "modifiers": ["requiresQuotes"] + }, + + // Ignore destructured property names. + { + "selector": "variable", + "modifiers": ["destructured"], + "format": null + }, + + // Following types are temporarily disabled. We shall incrementally enable them in the + // future, fixing any violations as we go. + { + "selector": [ + "classProperty", + "objectLiteralProperty", + "typeProperty", + "enumMember" + ], + "format": null + } + ], + } + }, + { + files: ['test/**/*.ts'], + languageOptions: { + globals: { + ...globals.mocha, + }, + }, + }, + { + ignores: [ + 'lib/', + 'node_modules/', + 'temp/', + 'docgen/', + 'dist/', + 'coverage/', + '**/*.d.ts', + '**/*.js', + 'firebase-admin-*.tgz' + ] + } +]); diff --git a/package-lock.json b/package-lock.json index 247185a203..2445788e91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "uuid": "^11.0.2" }, "devDependencies": { + "@eslint/js": "^10.0.1", "@firebase/api-documenter": "^0.5.0", "@firebase/app-compat": "^0.5.12", "@firebase/auth-compat": "^0.6.6", @@ -50,8 +51,9 @@ "chalk": "^4.1.1", "child-process-promise": "^2.2.1", "del": "^6.0.0", - "eslint": "^8.56.0", + "eslint": "10.3.0", "firebase-token-generator": "^2.0.0", + "globals": "^17.6.0", "gulp": "^5.0.0", "gulp-filter": "^7.0.0", "gulp-header": "^2.0.9", @@ -71,10 +73,11 @@ "sinon-chai": "^3.0.0", "ts-node": "^10.2.0", "typescript": "^5.7.3", + "typescript-eslint": "^8.59.3", "yargs": "^17.0.1" }, "engines": { - "node": ">=18" + "node": ">=22" }, "optionalDependencies": { "@google-cloud/firestore": "^8.6.0", @@ -418,103 +421,106 @@ "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, - "node_modules/@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "node_modules/@eslint/config-array": { + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", "dev": true, - "license": "MIT", + "license": "Apache-2.0", "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^10.2.4" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" + "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/@eslint/eslintrc/node_modules/ajv": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz", - "integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==", + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", "dev": true, - "license": "MIT", + "license": "BlueOak-1.0.0", "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" + "brace-expansion": "^5.0.5" + }, + "engines": { + "node": "18 || 20 || >=22" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@eslint/eslintrc/node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "node_modules/@eslint/config-helpers": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.5.5.tgz", + "integrity": "sha512-eIJYKTCECbP/nsKaaruF6LW967mtbQbsw4JTtSVkUQc9MneSkbrgPJAbKl9nWr0ZeowV8BfsarBmPpBzGelA2w==", "dev": true, - "license": "MIT" + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } }, - "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", - "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", "dev": true, - "license": "MIT", + "license": "Apache-2.0", "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/@eslint/eslintrc/node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "node_modules/@eslint/js": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz", + "integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==", "dev": true, "license": "MIT", "engines": { - "node": ">= 4" + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "eslint": "^10.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } } }, - "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@eslint/eslintrc/node_modules/minimatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", - "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, + "license": "Apache-2.0", "engines": { - "node": "*" + "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/@eslint/js": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", - "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", + "node_modules/@eslint/plugin-kit": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.1.tgz", + "integrity": "sha512-rZAP3aVgB9ds9KOeUSL+zZ21hPmo8dh6fnIFwRQj5EAZl9gzR7wxYbYXYysAM8CTqGmUGyp2S4kUdV17MnGuWQ==", "dev": true, - "license": "MIT", + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" + }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^20.19.0 || ^22.13.0 || >=24" } }, "node_modules/@fastify/busboy": { @@ -927,51 +933,42 @@ "node": ">=10.13.0" } }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", - "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", - "deprecated": "Use @eslint/config-array instead", + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@humanwhocodes/object-schema": "^2.0.3", - "debug": "^4.3.1", - "minimatch": "^3.0.5" + "@humanfs/types": "^0.15.0" }, "engines": { - "node": ">=10.10.0" + "node": ">=18.18.0" } }, - "node_modules/@humanwhocodes/config-array/node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", "dev": true, - "license": "MIT" - }, - "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", - "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", - "dev": true, - "license": "MIT", + "license": "Apache-2.0", "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" } }, - "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", - "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, + "license": "Apache-2.0", "engines": { - "node": "*" + "node": ">=18.18.0" } }, "node_modules/@humanwhocodes/module-importer": { @@ -988,13 +985,19 @@ "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", - "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", - "deprecated": "Use @eslint/object-schema instead", + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", "dev": true, - "license": "BSD-3-Clause" + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } }, "node_modules/@isaacs/cliui": { "version": "8.0.2", @@ -1943,6 +1946,20 @@ "@types/chai": "*" } }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/firebase-token-generator": { "version": "2.0.33", "resolved": "https://registry.npmjs.org/@types/firebase-token-generator/-/firebase-token-generator-2.0.33.tgz", @@ -1950,6 +1967,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/jsonwebtoken": { "version": "8.5.1", "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", @@ -2326,13 +2350,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/@ungap/structured-clone": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", - "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", - "dev": true, - "license": "ISC" - }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -3339,16 +3356,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -4064,19 +4071,6 @@ "node": ">=8" } }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -4347,74 +4341,75 @@ } }, "node_modules/eslint": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", - "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", - "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.3.0.tgz", + "integrity": "sha512-XbEXaRva5cF0ZQB8w6MluHA0kZZfV2DuCMJ3ozyEOHLwDpZX2Lmm/7Pp0xdJmI0GL1W05VH5VwIFHEm1Vcw2gw==", "dev": true, "license": "MIT", "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.1", - "@humanwhocodes/config-array": "^0.13.0", + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.5.5", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.1", + "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", "debug": "^4.3.2", - "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", + "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", + "minimatch": "^10.2.4", "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" + "optionator": "^0.9.3" }, "bin": { "eslint": "bin/eslint.js" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^20.19.0 || ^22.13.0 || >=24" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } } }, "node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", "dev": true, "license": "BSD-2-Clause", "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", "esrecurse": "^4.3.0", "estraverse": "^5.2.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^20.19.0 || ^22.13.0 || >=24" }, "funding": { "url": "https://opencollective.com/eslint" @@ -4450,24 +4445,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/eslint/node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/eslint/node_modules/brace-expansion": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", - "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/eslint/node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -4483,6 +4460,19 @@ "node": ">= 8" } }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/eslint/node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -4501,16 +4491,19 @@ "license": "MIT" }, "node_modules/eslint/node_modules/minimatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", - "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^5.0.5" }, "engines": { - "node": "*" + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/eslint/node_modules/which": { @@ -4530,18 +4523,31 @@ } }, "node_modules/espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "acorn": "^8.9.0", + "acorn": "^8.16.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" + "eslint-visitor-keys": "^5.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" }, "funding": { "url": "https://opencollective.com/eslint" @@ -4870,16 +4876,16 @@ } }, "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, "license": "MIT", "dependencies": { - "flat-cache": "^3.0.4" + "flat-cache": "^4.0.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16.0.0" } }, "node_modules/fill-range": { @@ -4991,18 +4997,17 @@ } }, "node_modules/flat-cache": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", - "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, "license": "MIT", "dependencies": { "flatted": "^3.2.9", - "keyv": "^4.5.3", - "rimraf": "^3.0.2" + "keyv": "^4.5.4" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16" } }, "node_modules/flatted": { @@ -5639,16 +5644,13 @@ } }, "node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "version": "17.6.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.6.0.tgz", + "integrity": "sha512-sepffkT8stwnIYbsMBpoCHJuJM5l98FUF2AnE07hfvE0m/qp3R586hw4jF4uadbhvg1ooIdzuu7CsfD2jzCaNA==", "dev": true, "license": "MIT", - "dependencies": { - "type-fest": "^0.20.2" - }, "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -5895,13 +5897,6 @@ "dev": true, "license": "ISC" }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true, - "license": "MIT" - }, "node_modules/gtoken": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.1.0.tgz", @@ -6799,23 +6794,6 @@ "node": ">= 4" } }, - "node_modules/import-fresh": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", - "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/import-lazy": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", @@ -8201,13 +8179,6 @@ "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", "license": "MIT" }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true, - "license": "MIT" - }, "node_modules/lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", @@ -9529,19 +9500,6 @@ "devOptional": true, "license": "BlueOak-1.0.0" }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "license": "MIT", - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/parse-filepath": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", @@ -10484,16 +10442,6 @@ "node": ">=0.10.0" } }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/resolve-options": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-2.0.0.tgz", @@ -11814,13 +11762,6 @@ "b4a": "^1.6.4" } }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true, - "license": "MIT" - }, "node_modules/thenify": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", @@ -12151,19 +12092,6 @@ "node": ">=4" } }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/typed-array-buffer": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", @@ -12273,6 +12201,30 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.59.3.tgz", + "integrity": "sha512-KgusgyDgG4LI8Ih/sWaCtZ06tckLAS5CvT5A4D1Q7bYVoAAyzwiZvE4BmwDHkhRVkvhRBepKeASoFzQetha7Fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.59.3", + "@typescript-eslint/parser": "8.59.3", + "@typescript-eslint/typescript-estree": "8.59.3", + "@typescript-eslint/utils": "8.59.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, "node_modules/unbox-primitive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", diff --git a/package.json b/package.json index 338d069fcb..49aabe3e43 100644 --- a/package.json +++ b/package.json @@ -18,10 +18,10 @@ "test:unit": "mocha test/unit/*.spec.ts --require ts-node/register", "test:integration": "mocha test/integration/*.ts --slow 5000 --timeout 20000 --require ts-node/register", "test:coverage": "nyc npm run test:unit", - "lint:src": "eslint src/ --ext .ts", - "lint:src:fix": "eslint src/ --ext .ts --fix", - "lint:test": "eslint test/ --ext .ts", - "lint:test:fix": "eslint test/ --ext .ts --fix", + "lint:src": "eslint src/", + "lint:src:fix": "eslint src/ --fix", + "lint:test": "eslint test/", + "lint:test:fix": "eslint test/ --fix", "apidocs": "run-s api-extractor:local api-documenter", "api-extractor": "node generate-reports.js", "api-extractor:local": "npm run build && node generate-reports.js --local", @@ -230,6 +230,7 @@ "@google-cloud/storage": "^7.19.0" }, "devDependencies": { + "@eslint/js": "^10.0.1", "@firebase/api-documenter": "^0.5.0", "@firebase/app-compat": "^0.5.12", "@firebase/auth-compat": "^0.6.6", @@ -259,8 +260,9 @@ "chalk": "^4.1.1", "child-process-promise": "^2.2.1", "del": "^6.0.0", - "eslint": "^8.56.0", + "eslint": "^10.3.0", "firebase-token-generator": "^2.0.0", + "globals": "^17.6.0", "gulp": "^5.0.0", "gulp-filter": "^7.0.0", "gulp-header": "^2.0.9", @@ -280,6 +282,7 @@ "sinon-chai": "^3.0.0", "ts-node": "^10.2.0", "typescript": "^5.7.3", + "typescript-eslint": "^8.59.3", "yargs": "^17.0.1" } } diff --git a/src/app/credential-internal.ts b/src/app/credential-internal.ts index 8ce61b4edd..e70f3cd5c9 100644 --- a/src/app/credential-internal.ts +++ b/src/app/credential-internal.ts @@ -214,7 +214,6 @@ class ServiceAccount { throw new FirebaseAppError(AppErrorCodes.INVALID_CREDENTIAL, errorMessage); } - // eslint-disable-next-line @typescript-eslint/no-var-requires const forge = require('node-forge'); try { forge.pki.privateKeyFromPem(this.privateKey); diff --git a/src/app/firebase-namespace.ts b/src/app/firebase-namespace.ts index edc022dd62..80daf6867c 100644 --- a/src/app/firebase-namespace.ts +++ b/src/app/firebase-namespace.ts @@ -134,7 +134,6 @@ export class FirebaseNamespace { return this.ensureApp(app).database(); }; - // eslint-disable-next-line @typescript-eslint/no-var-requires return Object.assign(fn, require('@firebase/database-compat/standalone')); } @@ -171,7 +170,6 @@ export class FirebaseNamespace { return this.ensureApp(app).firestore(); }; - // eslint-disable-next-line @typescript-eslint/no-var-requires const firestore = require('@google-cloud/firestore'); fn = Object.assign(fn, firestore.Firestore); diff --git a/src/database/database.ts b/src/database/database.ts index 355c43b33a..091ded02ac 100644 --- a/src/database/database.ts +++ b/src/database/database.ts @@ -124,7 +124,6 @@ export class DatabaseService { let db: Database = this.databases[dbUrl]; if (typeof db === 'undefined') { - // eslint-disable-next-line @typescript-eslint/no-var-requires const rtdb = require('@firebase/database-compat/standalone'); db = rtdb.initStandalone(this.appInternal, dbUrl, getSdkVersion()).instance; @@ -150,7 +149,6 @@ export class DatabaseService { return db; } - // eslint-disable-next-line @typescript-eslint/no-unused-vars private onTokenChange(_: string): void { const token = this.firebaseApp.INTERNAL.getCachedToken(); if (token) { diff --git a/src/firestore/firestore-internal.ts b/src/firestore/firestore-internal.ts index 2fa18114cd..824571c6c0 100644 --- a/src/firestore/firestore-internal.ts +++ b/src/firestore/firestore-internal.ts @@ -114,7 +114,6 @@ export function getFirestoreOptions(app: App, firestoreSettings?: FirestoreSetti const projectId: string | null = utils.getExplicitProjectId(app); const credential = app.options.credential; - // eslint-disable-next-line @typescript-eslint/no-var-requires const sdkVersion = utils.getSdkVersion(); const preferRest = firestoreSettings?.preferRest; if (credential instanceof ServiceAccountCredential) { diff --git a/src/firestore/firestore-namespace.ts b/src/firestore/firestore-namespace.ts index 84ffe51ab5..209d425436 100644 --- a/src/firestore/firestore-namespace.ts +++ b/src/firestore/firestore-namespace.ts @@ -21,7 +21,6 @@ export declare function firestore(app?: App): _firestore.Firestore; /* eslint-disable @typescript-eslint/no-namespace */ export namespace firestore { - /* eslint-disable @typescript-eslint/no-unused-vars */ // See https://github.com/typescript-eslint/typescript-eslint/issues/363 export import v1beta1 = _firestore.v1beta1; export import v1 = _firestore.v1; diff --git a/src/utils/api-request.ts b/src/utils/api-request.ts index 9616b7a39f..c3b07efd79 100644 --- a/src/utils/api-request.ts +++ b/src/utils/api-request.ts @@ -605,7 +605,7 @@ class AsyncRequestCall { protected handleMultipartResponse( response: LowLevelResponse, respStream: Readable, boundary: string): void { - const busboy = require('@fastify/busboy'); // eslint-disable-line @typescript-eslint/no-var-requires + const busboy = require('@fastify/busboy'); const multipartParser = new busboy.Dicer({ boundary }); const responseBuffer: Buffer[] = []; multipartParser.on('part', (part: any) => { @@ -806,7 +806,7 @@ class AsyncHttpCall extends AsyncRequestCall { const encodings = ['gzip', 'compress', 'deflate']; if (res.headers['content-encoding'] && encodings.indexOf(res.headers['content-encoding']) !== -1) { // Add the unzipper to the body stream processing pipeline. - const zlib: typeof zlibmod = require('zlib'); // eslint-disable-line @typescript-eslint/no-var-requires + const zlib: typeof zlibmod = require('zlib'); respStream = respStream.pipe(zlib.createUnzip()); // Remove the content-encoding in order to not confuse downstream operations. delete res.headers['content-encoding']; @@ -914,7 +914,7 @@ class AsyncHttp2Call extends AsyncRequestCall { const encodings = ['gzip', 'compress', 'deflate']; if (headers['content-encoding'] && encodings.indexOf(headers['content-encoding']) !== -1) { // Add the unzipper to the body stream processing pipeline. - const zlib: typeof zlibmod = require('zlib'); // eslint-disable-line @typescript-eslint/no-var-requires + const zlib: typeof zlibmod = require('zlib'); respStream = respStream.pipe(zlib.createUnzip()); // Remove the content-encoding in order to not confuse downstream operations. delete headers['content-encoding']; diff --git a/src/utils/crypto-signer.ts b/src/utils/crypto-signer.ts index a4b1f20be5..3e6a226bae 100644 --- a/src/utils/crypto-signer.ts +++ b/src/utils/crypto-signer.ts @@ -79,7 +79,7 @@ export class ServiceAccountSigner implements CryptoSigner { * @inheritDoc */ public sign(buffer: Buffer): Promise { - const crypto = require('crypto'); // eslint-disable-line @typescript-eslint/no-var-requires + const crypto = require('crypto'); const sign = crypto.createSign('RSA-SHA256'); sign.update(buffer); return Promise.resolve(sign.sign(this.credential.privateKey)); diff --git a/src/utils/index.ts b/src/utils/index.ts index 7754e59b01..5610533912 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -26,7 +26,7 @@ let sdkVersion: string; // TODO: Move to firebase-admin/app as an internal member. export function getSdkVersion(): string { if (!sdkVersion) { - const { version } = require('../../package.json'); // eslint-disable-line @typescript-eslint/no-var-requires + const { version } = require('../../package.json'); sdkVersion = version; } return sdkVersion; diff --git a/test/integration/app-check.spec.ts b/test/integration/app-check.spec.ts index 89a920daea..d613c5cd9f 100644 --- a/test/integration/app-check.spec.ts +++ b/test/integration/app-check.spec.ts @@ -21,7 +21,6 @@ import * as chaiAsPromised from 'chai-as-promised'; import fs = require('fs'); import path = require('path'); -// eslint-disable-next-line @typescript-eslint/no-var-requires const chalk = require('chalk'); chai.should(); diff --git a/test/integration/auth.spec.ts b/test/integration/auth.spec.ts index 3c538d3319..f5810b3476 100644 --- a/test/integration/auth.spec.ts +++ b/test/integration/auth.spec.ts @@ -37,7 +37,7 @@ import { import * as sinon from 'sinon'; import * as sinonChai from 'sinon-chai'; -const chalk = require('chalk'); // eslint-disable-line @typescript-eslint/no-var-requires +const chalk = require('chalk'); chai.should(); chai.use(sinonChai); @@ -908,14 +908,14 @@ describe('admin.auth', () => { const googleFederatedUid = 'google_uid_' + generateRandomString(10); const facebookFederatedUid = 'facebook_uid_' + generateRandomString(10); - let userRecord = await getAuth().updateUser(updateUser.uid, { + await getAuth().updateUser(updateUser.uid, { phoneNumber: '+15555550001', providerToLink: { providerId: 'google.com', uid: googleFederatedUid, }, }); - userRecord = await getAuth().updateUser(updateUser.uid, { + let userRecord = await getAuth().updateUser(updateUser.uid, { providerToLink: { providerId: 'facebook.com', uid: facebookFederatedUid, diff --git a/test/integration/database.spec.ts b/test/integration/database.spec.ts index 7f4dce576f..9b20d63e39 100644 --- a/test/integration/database.spec.ts +++ b/test/integration/database.spec.ts @@ -22,7 +22,6 @@ import { } from '../../lib/database/index'; import { defaultApp, nullApp, nonNullApp, cmdArgs, databaseUrl, isEmulator } from './setup'; -// eslint-disable-next-line @typescript-eslint/no-var-requires const chalk = require('chalk'); chai.should(); diff --git a/test/integration/postcheck/typescript/example-modular.test.ts b/test/integration/postcheck/typescript/example-modular.test.ts index 67332e01af..76e10a9c33 100644 --- a/test/integration/postcheck/typescript/example-modular.test.ts +++ b/test/integration/postcheck/typescript/example-modular.test.ts @@ -33,8 +33,6 @@ import { getStorage, Storage } from 'firebase-admin/storage'; import { Bucket } from '@google-cloud/storage'; - -// eslint-disable-next-line @typescript-eslint/no-var-requires const serviceAccount = require('../mock.key.json'); describe('Modular API', () => { diff --git a/test/integration/postcheck/typescript/example.test.ts b/test/integration/postcheck/typescript/example.test.ts index 5de1eadae0..9f94461e67 100644 --- a/test/integration/postcheck/typescript/example.test.ts +++ b/test/integration/postcheck/typescript/example.test.ts @@ -22,7 +22,6 @@ import { Firestore } from '@google-cloud/firestore'; import * as admin from 'firebase-admin'; -// eslint-disable-next-line @typescript-eslint/no-var-requires const serviceAccount = require('../mock.key.json'); describe('Legacy API', () => { diff --git a/test/integration/setup.ts b/test/integration/setup.ts index 5c23270f3b..954f626e86 100644 --- a/test/integration/setup.ts +++ b/test/integration/setup.ts @@ -22,7 +22,6 @@ import { App, Credential, GoogleOAuthAccessToken, cert, deleteApp, initializeApp, } from '../../lib/app/index' -// eslint-disable-next-line @typescript-eslint/no-var-requires const chalk = require('chalk'); export let databaseUrl: string; diff --git a/test/resources/mocks.ts b/test/resources/mocks.ts index e0f2ed00a9..22cec41fde 100644 --- a/test/resources/mocks.ts +++ b/test/resources/mocks.ts @@ -169,10 +169,8 @@ export const refreshToken = { }; // Randomly generated JSON Web Key Sets that do not correspond to anything related to Firebase. -// eslint-disable-next-line @typescript-eslint/no-var-requires export const jwksResponse = require('./mock.jwks.json'); -// eslint-disable-next-line @typescript-eslint/no-var-requires export const certificateObject = require('./mock.key.json'); // Randomly generated key pairs that don't correspond to anything related to Firebase or GCP @@ -355,7 +353,6 @@ export class Http2Mocker { return (requestHeaders: http2.OutgoingHttpHeaders) => { // Create a mock ClientHttp2Stream to return const mockStream = new stream.Readable({ - // eslint-disable-next-line @typescript-eslint/no-empty-function read() {} }) as http2.ClientHttp2Stream; diff --git a/test/unit/app/index.spec.ts b/test/unit/app/index.spec.ts index af0d0ebf75..08456b837e 100644 --- a/test/unit/app/index.spec.ts +++ b/test/unit/app/index.spec.ts @@ -185,7 +185,7 @@ describe('firebase-admin/app', () => { describe('SDK_VERSION', () => { it('should indicate the current version of the SDK', () => { - const { version } = require('../../../package.json'); // eslint-disable-line @typescript-eslint/no-var-requires + const { version } = require('../../../package.json'); expect(SDK_VERSION).to.equal(version); }); }); diff --git a/test/unit/firestore/firestore.spec.ts b/test/unit/firestore/firestore.spec.ts index 434bba3bef..605b0f8bf6 100644 --- a/test/unit/firestore/firestore.spec.ts +++ b/test/unit/firestore/firestore.spec.ts @@ -43,7 +43,6 @@ describe('Firestore', () => { + 'credentials. Must initialize the SDK with a certificate credential or application default ' + 'credentials to use Cloud Firestore API.'; - // eslint-disable-next-line @typescript-eslint/no-var-requires const sdkVersion = getSdkVersion(); const defaultCredentialApps = [ { diff --git a/test/unit/utils/api-request.spec.ts b/test/unit/utils/api-request.spec.ts index 77d24b20a8..3d1ad8e408 100644 --- a/test/unit/utils/api-request.spec.ts +++ b/test/unit/utils/api-request.spec.ts @@ -403,7 +403,6 @@ describe('HttpClient', () => { const client = new HttpClient(); const httpAgent = new Agent(); - // eslint-disable-next-line @typescript-eslint/no-var-requires const https = require('https'); transportSpy = sinon.spy(https, 'request'); return client.send({ @@ -2650,7 +2649,6 @@ describe('AuthorizedHttpClient', () => { const options = mockApp.options; options.httpAgent = new Agent(); - // eslint-disable-next-line @typescript-eslint/no-var-requires const https = require('https'); transportSpy = sinon.spy(https, 'request'); mockAppWithAgent = mocks.appWithOptions(options); diff --git a/test/unit/utils/crypto-signer.spec.ts b/test/unit/utils/crypto-signer.spec.ts index a964f00f7b..c7f699ac3b 100644 --- a/test/unit/utils/crypto-signer.spec.ts +++ b/test/unit/utils/crypto-signer.spec.ts @@ -56,7 +56,6 @@ describe('CryptoSigner', () => { const payload = Buffer.from('test'); const cert = new ServiceAccountCredential(mocks.certificateObject); - // eslint-disable-next-line @typescript-eslint/no-var-requires const crypto = require('crypto'); const rsa = crypto.createSign('RSA-SHA256'); rsa.update(payload); diff --git a/test/unit/utils/index.spec.ts b/test/unit/utils/index.spec.ts index d6e0ddc06c..ac40584ff0 100644 --- a/test/unit/utils/index.spec.ts +++ b/test/unit/utils/index.spec.ts @@ -35,7 +35,7 @@ interface Obj { describe('SDK_VERSION', () => { it('utils index should retrieve the SDK_VERSION from package.json', () => { - const { version } = require('../../../package.json'); // eslint-disable-line @typescript-eslint/no-var-requires + const { version } = require('../../../package.json'); expect(getSdkVersion()).to.equal(version); }); });