mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-21934] Upgrade to eslint 9 (#14754)
Upgrades to Eslint v9. Since this is a major version there were breaking changes, but since we've previously migrated to flat configs in #12806 those were minimal.
This commit is contained in:
2
.github/renovate.json5
vendored
2
.github/renovate.json5
vendored
@@ -59,6 +59,7 @@
|
||||
{
|
||||
matchPackageNames: [
|
||||
"@angular-eslint/schematics",
|
||||
"@eslint/compat",
|
||||
"@typescript-eslint/rule-tester",
|
||||
"@typescript-eslint/utils",
|
||||
"angular-eslint",
|
||||
@@ -81,6 +82,7 @@
|
||||
{
|
||||
matchPackageNames: [
|
||||
"@angular-eslint/schematics",
|
||||
"@eslint/compat",
|
||||
"@typescript-eslint/rule-tester",
|
||||
"@typescript-eslint/utils",
|
||||
"angular-eslint",
|
||||
|
||||
@@ -17,7 +17,6 @@ export default class VaultTimeoutService extends BaseVaultTimeoutService {
|
||||
// setIntervals. It works by calling the native extension which sleeps for 10s,
|
||||
// efficiently replicating setInterval.
|
||||
async checkSafari() {
|
||||
// eslint-disable-next-line
|
||||
while (true) {
|
||||
try {
|
||||
await SafariApp.sendMessageToApp("sleep");
|
||||
|
||||
@@ -21,6 +21,8 @@ export class BrowserRouterService {
|
||||
child = child.firstChild;
|
||||
}
|
||||
|
||||
// TODO: Eslint upgrade. Please resolve this since the ?? does nothing
|
||||
// eslint-disable-next-line no-constant-binary-expression
|
||||
const updateUrl = !child?.data?.doNotSaveUrl ?? true;
|
||||
|
||||
if (updateUrl) {
|
||||
|
||||
@@ -62,6 +62,8 @@ export class PopupRouterCacheService {
|
||||
child = child.firstChild;
|
||||
}
|
||||
|
||||
// TODO: Eslint upgrade. Please resolve this since the ?? does nothing
|
||||
// eslint-disable-next-line no-constant-binary-expression
|
||||
return !child?.data?.doNotSaveUrl ?? true;
|
||||
}),
|
||||
switchMap((event) => this.push(event.url)),
|
||||
|
||||
@@ -161,7 +161,6 @@ export class CliUtils {
|
||||
|
||||
process.stdin.setEncoding("utf8");
|
||||
process.stdin.on("readable", () => {
|
||||
// eslint-disable-next-line
|
||||
while (true) {
|
||||
const chunk = process.stdin.read();
|
||||
if (chunk == null) {
|
||||
|
||||
@@ -9,12 +9,16 @@ import { Organization } from "@bitwarden/common/admin-console/models/domain/orga
|
||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { ExposedPasswordsReportComponent } from "../../../dirt/reports/pages/organizations/exposed-passwords-report.component";
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { InactiveTwoFactorReportComponent } from "../../../dirt/reports/pages/organizations/inactive-two-factor-report.component";
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { ReusedPasswordsReportComponent } from "../../../dirt/reports/pages/organizations/reused-passwords-report.component";
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { UnsecuredWebsitesReportComponent } from "../../../dirt/reports/pages/organizations/unsecured-websites-report.component";
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { WeakPasswordsReportComponent } from "../../../dirt/reports/pages/organizations/weak-passwords-report.component";
|
||||
/* eslint no-restricted-imports: "error" */
|
||||
import { isPaidOrgGuard } from "../guards/is-paid-org.guard";
|
||||
import { organizationPermissionsGuard } from "../guards/org-permissions.guard";
|
||||
import { organizationRedirectGuard } from "../guards/org-redirect.guard";
|
||||
|
||||
@@ -607,6 +607,8 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
|
||||
|
||||
return (
|
||||
plan.PasswordManager.additionalStoragePricePerGb *
|
||||
// TODO: Eslint upgrade. Please resolve this since the null check does nothing
|
||||
// eslint-disable-next-line no-constant-binary-expression
|
||||
Math.abs(this.sub?.maxStorageGb ? this.sub?.maxStorageGb - 1 : 0 || 0)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -148,6 +148,8 @@ export class OrganizationPaymentMethodComponent implements OnDestroy {
|
||||
paymentSource,
|
||||
);
|
||||
}
|
||||
// TODO: Eslint upgrade. Please resolve this since the ?? does nothing
|
||||
// eslint-disable-next-line no-constant-binary-expression
|
||||
this.isUnpaid = this.subscriptionStatus === "unpaid" ?? false;
|
||||
// If the flag `launchPaymentModalAutomatically` is set to true,
|
||||
// we schedule a timeout (delay of 800ms) to automatically launch the payment modal.
|
||||
|
||||
@@ -143,6 +143,8 @@ export class PaymentMethodComponent implements OnInit, OnDestroy {
|
||||
|
||||
[this.billing, this.sub] = await Promise.all([billingPromise, subPromise]);
|
||||
}
|
||||
// TODO: Eslint upgrade. Please resolve this since the ?? does nothing
|
||||
// eslint-disable-next-line no-constant-binary-expression
|
||||
this.isUnpaid = this.subscription?.status === "unpaid" ?? false;
|
||||
this.loading = false;
|
||||
// If the flag `launchPaymentModalAutomatically` is set to true,
|
||||
|
||||
@@ -74,6 +74,9 @@ export class RouterService {
|
||||
|
||||
const titleId: string = child?.snapshot?.data?.titleId;
|
||||
const rawTitle: string = child?.snapshot?.data?.title;
|
||||
|
||||
// TODO: Eslint upgrade. Please resolve this since the ?? does nothing
|
||||
// eslint-disable-next-line no-constant-binary-expression
|
||||
const updateUrl = !child?.snapshot?.data?.doNotSaveUrl ?? true;
|
||||
|
||||
if (titleId != null || rawTitle != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
import { fixupPluginRules } from "@eslint/compat";
|
||||
import eslint from "@eslint/js";
|
||||
import tseslint from "typescript-eslint";
|
||||
import angular from "angular-eslint";
|
||||
@@ -31,8 +31,8 @@ export default tseslint.config(
|
||||
reportUnusedDisableDirectives: "error",
|
||||
},
|
||||
plugins: {
|
||||
rxjs: rxjs,
|
||||
"rxjs-angular": angularRxjs,
|
||||
rxjs: fixupPluginRules(rxjs),
|
||||
"rxjs-angular": fixupPluginRules(angularRxjs),
|
||||
"@bitwarden/platform": platformPlugins,
|
||||
},
|
||||
languageOptions: {
|
||||
|
||||
@@ -89,6 +89,8 @@ export class DeviceTrustService implements DeviceTrustServiceAbstraction {
|
||||
) {
|
||||
this.supportsDeviceTrust$ = this.userDecryptionOptionsService.userDecryptionOptions$.pipe(
|
||||
map((options) => {
|
||||
// TODO: Eslint upgrade. Please resolve this since the ?? does nothing
|
||||
// eslint-disable-next-line no-constant-binary-expression
|
||||
return options?.trustedDeviceOption != null ?? false;
|
||||
}),
|
||||
);
|
||||
@@ -97,6 +99,8 @@ export class DeviceTrustService implements DeviceTrustServiceAbstraction {
|
||||
supportsDeviceTrustByUserId$(userId: UserId): Observable<boolean> {
|
||||
return this.userDecryptionOptionsService.userDecryptionOptionsById$(userId).pipe(
|
||||
map((options) => {
|
||||
// TODO: Eslint upgrade. Please resolve this since the ?? does nothing
|
||||
// eslint-disable-next-line no-constant-binary-expression
|
||||
return options?.trustedDeviceOption != null ?? false;
|
||||
}),
|
||||
);
|
||||
|
||||
10
libs/eslint/fix-jsdom.ts
Normal file
10
libs/eslint/fix-jsdom.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import JSDOMEnvironment from "jest-environment-jsdom";
|
||||
|
||||
export default class FixJSDOMEnvironment extends JSDOMEnvironment {
|
||||
constructor(...args: ConstructorParameters<typeof JSDOMEnvironment>) {
|
||||
super(...args);
|
||||
|
||||
// FIXME https://github.com/jsdom/jsdom/issues/3363
|
||||
this.global.structuredClone = structuredClone;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ const sharedConfig = require("../../libs/shared/jest.config.angular");
|
||||
/** @type {import('jest').Config} */
|
||||
module.exports = {
|
||||
...sharedConfig,
|
||||
testEnvironment: "./fix-jsdom.ts",
|
||||
testMatch: ["**/+(*.)+(spec).+(mjs)"],
|
||||
displayName: "libs/eslint tests",
|
||||
preset: "jest-preset-angular",
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
import { clearImmediate, setImmediate } from "node:timers";
|
||||
|
||||
Object.defineProperties(globalThis, {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"extends": "../shared/tsconfig",
|
||||
"compilerOptions": {},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
"exclude": ["node_modules", "dist"],
|
||||
"files": ["empty.ts"]
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ export class DashlaneCsvImporter extends BaseImporter implements Importer {
|
||||
this.parseIdRecord(cipher, row);
|
||||
}
|
||||
|
||||
if ((rowKeys[0] === "type") != null && rowKeys[1] === "title") {
|
||||
if (rowKeys[0] === "type" && rowKeys[1] === "title") {
|
||||
this.parsePersonalInformationRecord(cipher, row);
|
||||
}
|
||||
|
||||
|
||||
2758
package-lock.json
generated
2758
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -47,6 +47,7 @@
|
||||
"@compodoc/compodoc": "1.1.26",
|
||||
"@electron/notarize": "2.5.0",
|
||||
"@electron/rebuild": "3.7.2",
|
||||
"@eslint/compat": "1.2.9",
|
||||
"@lit-labs/signals": "0.1.2",
|
||||
"@ngtools/webpack": "18.2.19",
|
||||
"@storybook/addon-a11y": "8.6.12",
|
||||
@@ -102,7 +103,7 @@
|
||||
"electron-reload": "2.0.0-alpha.1",
|
||||
"electron-store": "8.2.0",
|
||||
"electron-updater": "6.6.4",
|
||||
"eslint": "8.57.1",
|
||||
"eslint": "9.26.0",
|
||||
"eslint-config-prettier": "10.1.2",
|
||||
"eslint-import-resolver-typescript": "4.3.4",
|
||||
"eslint-plugin-import": "2.31.0",
|
||||
@@ -207,6 +208,12 @@
|
||||
"zxcvbn": "4.4.2"
|
||||
},
|
||||
"overrides": {
|
||||
"eslint-plugin-rxjs": {
|
||||
"eslint": "$eslint"
|
||||
},
|
||||
"eslint-plugin-rxjs-angular": {
|
||||
"eslint": "$eslint"
|
||||
},
|
||||
"tailwindcss": "$tailwindcss",
|
||||
"@storybook/angular": {
|
||||
"zone.js": "$zone.js"
|
||||
|
||||
Reference in New Issue
Block a user