1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 23:33:31 +00:00

[PM-17496] Migrate eslint to flat config (#12806)

The legacy config is deprecated and will be removed in eslint 10. The flat config also allows us to write js functions which will assist in handling limitations with multiple identical rules.
This commit is contained in:
Oscar Hinton
2025-01-28 16:40:52 +01:00
committed by GitHub
parent 08c42a8a27
commit 70ea75d8f7
29 changed files with 469 additions and 447 deletions

View File

@@ -1,26 +0,0 @@
{
"env": {
"browser": true,
"webextensions": true
},
"overrides": [
{
"files": ["src/**/*.ts"],
"excludedFiles": [
"src/**/{content,popup,spec}/**/*.ts",
"src/**/autofill/{notification,overlay}/**/*.ts",
"src/**/autofill/**/{autofill-overlay-content,collect-autofill-content,dom-element-visibility,insert-autofill-content}.service.ts",
"src/**/*.spec.ts"
],
"rules": {
"no-restricted-globals": [
"error",
{
"name": "window",
"message": "The `window` object is not available in service workers and may not be available within the background script. Consider using `self`, `globalThis`, or another global property instead."
}
]
}
}
]
}

View File

@@ -1,8 +1,8 @@
import { dirname, join } from "path";
import path from "path";
import path, { dirname, join } from "path";
import type { StorybookConfig } from "@storybook/web-components-webpack5";
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
import remarkGfm from "remark-gfm";
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
const getAbsolutePath = (value: string): string =>
dirname(require.resolve(join(value, "package.json")));

View File

@@ -1,4 +1,4 @@
/* eslint-disable no-undef, @typescript-eslint/no-var-requires */
/* eslint-disable no-undef, @typescript-eslint/no-require-imports */
const config = require("../../libs/components/tailwind.config.base");
config.content = [

View File

@@ -1,5 +0,0 @@
{
"env": {
"node": true
}
}

View File

@@ -1,3 +0,0 @@
{
"extends": "../../../../libs/admin-console/.eslintrc.json"
}

View File

@@ -1,6 +0,0 @@
{
"env": {
"browser": true,
"node": true
}
}

View File

@@ -1,5 +0,0 @@
{
"rules": {
"no-console": "off"
}
}

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-console */
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { homedir } from "os";

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import "module-alias/register";
import { v4 as uuidv4 } from "uuid";

View File

@@ -1,4 +1,4 @@
/* eslint-disable no-undef, @typescript-eslint/no-var-requires */
/* eslint-disable no-undef, @typescript-eslint/no-require-imports */
const config = require("../../libs/components/tailwind.config.base");
config.content = [

View File

@@ -1,22 +0,0 @@
{
"env": {
"browser": true
},
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
"**/app/core/*",
"**/reports/*",
"**/app/shared/*",
"**/organizations/settings/*",
"**/organizations/policies/*",
"@bitwarden/web-vault/*",
"src/**/*",
"bitwarden_license"
]
}
]
}
}

View File

@@ -1,3 +0,0 @@
{
"extends": "../../../../../libs/admin-console/.eslintrc.json"
}

View File

@@ -11,6 +11,8 @@ import { AccountService } from "@bitwarden/common/auth/abstractions/account.serv
import { CipherId } from "@bitwarden/common/types/guid";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
// FIXME: remove `src` and fix import
// eslint-disable-next-line no-restricted-imports
import { Account } from "../../../../../../../libs/importer/src/importers/lastpass/access/models";
import { RoutedVaultFilterService } from "../../individual-vault/vault-filter/services/routed-vault-filter.service";