Skip to content

Commit e830ce9

Browse files
committed
chore(*): Setup flat eslint/prettier rule and workflows
1 parent 35b7d29 commit e830ce9

File tree

81 files changed

+1109
-1365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1109
-1365
lines changed

.github/workflows/lint.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Lint and Format Check
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
pull_request:
8+
branches:
9+
- "**"
10+
11+
jobs:
12+
lint:
13+
name: Lint and Format Check
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
25+
- name: Setup pnpm
26+
uses: pnpm/action-setup@v4
27+
with:
28+
version: 10
29+
30+
- name: Install dependencies
31+
run: pnpm install --frozen-lockfile
32+
33+
- name: Run ESLint
34+
run: pnpm run lint:check
35+
36+
- name: Run Prettier check
37+
run: pnpm run format:check

eslint.config.js

Lines changed: 0 additions & 134 deletions
This file was deleted.

eslint.config.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
3+
import js from "@eslint/js";
4+
import { globalIgnores } from "eslint/config";
5+
import globals from "globals";
6+
import tseslint from "typescript-eslint";
7+
import pluginPrettier from "eslint-plugin-prettier";
8+
import pluginReact from "eslint-plugin-react";
9+
import pluginReactHooks from "eslint-plugin-react-hooks";
10+
11+
const config: any[] = [
12+
globalIgnores([
13+
"**/dist/**",
14+
"**/node_modules/**",
15+
"**/build/**",
16+
"**/.next/**",
17+
"**/.angular/**",
18+
"**/releases/**",
19+
"packages/styles/dist.css",
20+
"packages/angular/**",
21+
]),
22+
...tseslint.configs.recommended,
23+
{
24+
// All TypeScript files
25+
files: ["**/*.ts", "**/*.tsx"],
26+
plugins: { js, prettier: pluginPrettier },
27+
languageOptions: { globals: { ...globals.browser, ...globals.node } },
28+
rules: {
29+
"prettier/prettier": "error",
30+
"arrow-body-style": "off",
31+
"prefer-arrow-callback": "off",
32+
},
33+
},
34+
{
35+
// React package specific rules
36+
files: ["packages/react/src/**/*.{ts,tsx}"],
37+
plugins: { react: pluginReact, "react-hooks": pluginReactHooks },
38+
languageOptions: {
39+
parserOptions: {
40+
ecmaFeatures: {
41+
jsx: true,
42+
},
43+
},
44+
},
45+
settings: {
46+
react: {
47+
version: "detect",
48+
},
49+
},
50+
rules: {
51+
...pluginReact.configs.recommended.rules,
52+
...pluginReactHooks.configs.recommended.rules,
53+
"react/react-in-jsx-scope": "off", // Not needed with React 17+
54+
},
55+
},
56+
{
57+
// Test files - more lenient rules
58+
files: ["**/*.test.{ts,tsx}", "**/*.spec.{ts,tsx}", "**/tests/**/*.{ts,tsx}"],
59+
rules: {
60+
"@typescript-eslint/no-explicit-any": "off",
61+
"@typescript-eslint/no-unused-vars": "off",
62+
},
63+
},
64+
];
65+
66+
export default config;

examples/angular/src/main.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { bootstrapApplication } from "@angular/platform-browser";
17+
import { bootstrapApplication, BootstrapContext } from "@angular/platform-browser";
1818
import { AppComponent } from "./app/app.component";
1919
import { config } from "./app/app.config.server";
2020

21-
const bootstrap = (context: any) => bootstrapApplication(AppComponent, config, context);
21+
const bootstrap = (context: BootstrapContext) => bootstrapApplication(AppComponent, config, context);
2222

2323
export default bootstrap;

examples/angular/src/test-setup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
12
/**
23
* Copyright 2025 Google LLC
34
*

examples/react/src/components/header.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@
1818

1919
import { NavLink } from "react-router";
2020
import { useUser } from "../firebase/hooks";
21-
import { signOut, type User } from "firebase/auth";
21+
import { signOut } from "firebase/auth";
2222
import { auth } from "../firebase/firebase";
2323

2424
export function Header() {
2525
const user = useUser();
2626

2727
async function onSignOut() {
2828
await signOut(auth);
29-
router.push("/sign-in");
29+
// TODO: Use the router instead of window.location.href
30+
window.location.href = "/";
3031
}
3132

3233
return (

examples/react/src/firebase/firebase.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ export const auth = getAuth(firebaseApp);
2727

2828
export const ui = initializeUI({
2929
app: firebaseApp,
30-
behaviors: [autoAnonymousLogin(), oneTapSignIn({
31-
clientId: '200312857118-lscdui98fkaq7ffr81446blafjn5o6r0.apps.googleusercontent.com',
32-
})],
30+
behaviors: [
31+
autoAnonymousLogin(),
32+
oneTapSignIn({
33+
clientId: "200312857118-lscdui98fkaq7ffr81446blafjn5o6r0.apps.googleusercontent.com",
34+
}),
35+
],
3336
});
3437

3538
if (import.meta.env.MODE === "development") {

package.json

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
"build:translations": "pnpm --filter=@firebase-ui/translations run build",
1010
"build:react": "pnpm --filter=@firebase-ui/react run build",
1111
"build:angular": "pnpm --filter=@firebase-ui/angular run build",
12-
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
13-
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
14-
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
15-
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
12+
"lint:check": "eslint",
13+
"format:check": "prettier --check **/{src,tests}/**/*.{ts,tsx}",
14+
"format:write": "prettier --write **/{src,tests}/**/*.{ts,tsx}",
1615
"test": "pnpm run test:core && pnpm run test:react && pnpm run test:angular && pnpm run test:translations && pnpm run test:styles",
1716
"test:core": "pnpm --filter=@firebase-ui/core run test",
1817
"test:react": "pnpm --filter=@firebase-ui/react run test",
@@ -37,19 +36,14 @@
3736
"release:all": "pnpm i && pnpm run release:core && pnpm run release:translations && pnpm run release:react && pnpm run release:styles && pnpm run release:angular"
3837
},
3938
"devDependencies": {
40-
"@eslint/js": "^9.22.0",
41-
"@typescript-eslint/eslint-plugin": "^8.43.0",
42-
"@typescript-eslint/parser": "^8.43.0",
43-
"eslint": "^9.22.0",
44-
"eslint-config-prettier": "^9.1.0",
45-
"eslint-plugin-prettier": "^5.2.1",
39+
"@eslint/css": "^0.11.1",
40+
"@eslint/js": "^9.35.0",
41+
"eslint": "catalog:",
42+
"eslint-plugin-prettier": "^5.5.4",
4643
"eslint-plugin-react": "^7.37.5",
4744
"eslint-plugin-react-hooks": "^5.2.0",
45+
"globals": "^16.4.0",
4846
"prettier": "^3.1.1",
49-
"rimraf": "^6.0.1",
50-
"typescript": "^5.7.3",
51-
"vite": "^6.0.11",
52-
"vite-plugin-dts": "^4.2.3",
53-
"vite-tsconfig-paths": "^5.0.1"
47+
"typescript-eslint": "^8.45.0"
5448
}
5549
}

packages/angular/eslint.config.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

packages/angular/src/lib/auth/forms/email-password-form/email-password-form.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ import { injectForm, TanStackField } from "@tanstack/angular-form";
2020
import { FirebaseUI } from "../../../provider";
2121
import { ButtonComponent } from "../../../components/button/button.component";
2222
import { TermsAndPrivacyComponent } from "../../../components/terms-and-privacy/terms-and-privacy.component";
23-
import { createEmailFormSchema, EmailFormSchema, FirebaseUIConfiguration, FirebaseUIError, signInWithEmailAndPassword } from "@firebase-ui/core";
23+
import {
24+
createEmailFormSchema,
25+
EmailFormSchema,
26+
FirebaseUIConfiguration,
27+
FirebaseUIError,
28+
signInWithEmailAndPassword,
29+
} from "@firebase-ui/core";
2430
import { firstValueFrom } from "rxjs";
2531
import { Router } from "@angular/router";
2632

0 commit comments

Comments
 (0)