Skip to content

Commit 032215b

Browse files
RobPruzanpivanovNisargIOaidenybai
authored
React scan v1 (#192)
* refactor: migrate from eslint to biome and improve architecture - Replace ESLint with Biome for linting and formatting - Configure Biome with strict rules for: - Type checking and type safety - Code correctness (unused imports, variables, parameters) - Security (noExplicitAny, noConsole, dangerouslySetInnerHTML) - Improve VSCode integration: - Set up Biome formatters for TypeScript, JavaScript, and JSON - Configure Prettier for Markdown and HTML - Add automatic code actions and formatting - Improve React internals: - Remove react-reconciler dependency - Use bippy for Fiber/FiberRoot types - Use installRDTHook for React DevTools hook to avoid side effects - Update package dependencies and development tooling - General improvements and code cleanup BREAKING CHANGE: ESLint configuration removed in favor of Biome * bump extension with [email protected] * improve build-extension workflow * improve extension * fix getChangedState issue and create getCompositeFiberFromElement for overlay * resolve comments + fix flushes * resolve comments * resolve comments * improvements and small bug fixes * fix: overlay cursor + fadeout canvas instead of flick * fix: prevent inspecting the toolbar widget * fix: handle missing fiber when inspecting elements * ui/ux/dx, fixed animations, fixed what changed calculations * fix: circular refsm, perf improvements * feat(scan): implement new whats-changed, offscreen outline impl, bug fixes, ux improvements" * fix: react component names + turbopack loader (#189) * fix: react component names + turbopack loader * fix: tests for ReactComponentNames * fix: typesVersions for ReactComponentNames loader * fix: map return for filtered * docs: No changes in the text * chore: cleanup * chore: add back scan in kitchen sink example * chore: remove unsupported apis --------- Co-authored-by: Pavel Ivanov <[email protected]> Co-authored-by: Nisarg Patel <[email protected]> Co-authored-by: Aiden Bai <[email protected]>
1 parent 90c7216 commit 032215b

Some content is hidden

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

94 files changed

+7895
-3855
lines changed

.eslintrc.js

-89
This file was deleted.

.github/workflows/build-extension.yml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
run: |
4343
pnpm build
4444
cd packages/extension
45+
rm -rf build
4546
pnpm pack:all
4647
4748
- name: Commit changes

.vscode/settings.json

+21-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
{
2-
"editor.formatOnSave": true,
32
"editor.defaultFormatter": "biomejs.biome",
4-
"typescript.tsdk": "node_modules/typescript/lib",
5-
"typescript.enablePromptUseWorkspaceTsdk": true,
6-
"typescript.preferences.importModuleSpecifier": "non-relative",
7-
"typescript.preferences.includePackageJsonAutoImports": "on",
8-
"files.associations": {
9-
"*.css": "css"
3+
"editor.formatOnSave": true,
4+
"editor.codeActionsOnSave": {
5+
"source.organizeImports.biome": "always",
6+
"quickfix.biome": "always"
7+
},
8+
"css.lint.unknownAtRules": "ignore",
9+
"[typescript]": {
10+
"editor.defaultFormatter": "biomejs.biome"
1011
},
11-
"editor.quickSuggestions": {
12-
"strings": true
12+
"[javascript]": {
13+
"editor.defaultFormatter": "biomejs.biome"
1314
},
14-
"css.validate": false,
15-
"tailwindCSS.validate": true,
16-
"editor.colorDecorators": true,
15+
"[json]": {
16+
"editor.defaultFormatter": "biomejs.biome"
17+
},
18+
"[markdown]": {
19+
"editor.defaultFormatter": "esbenp.prettier-vscode"
20+
},
21+
"[html]": {
22+
"editor.defaultFormatter": "esbenp.prettier-vscode"
23+
},
24+
"typescript.tsdk": "node_modules/typescript/lib",
1725
"[css]": {
18-
"editor.formatOnSave": false
26+
"editor.defaultFormatter": "biomejs.biome"
1927
}
2028
}

CHROME_EXTENSION_GUIDE.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,26 @@
55
66
## Chrome
77

8-
1. Download the [`chrome-react-scanner-extension-v1.0.1.zip`](https://github.com/aidenybai/react-scan/tree/main/packages/extension/build) file.
8+
1. Download the [`chrome-react-scanner-extension-v1.0.2.zip`](https://github.com/aidenybai/react-scan/tree/main/packages/extension/build) file.
99
2. Unzip the file.
1010
3. Open Chrome and navigate to `chrome://extensions/`.
1111
4. Enable "Developer mode" if it is not already enabled.
1212
5. Click "Load unpacked" and select the unzipped folder (or drag the folder into the page).
1313

1414
## Firefox
1515

16-
1. Download the [`firefox-react-scanner-extension-v1.0.1.zip`](https://github.com/aidenybai/react-scan/tree/main/packages/extension/build) file.
16+
1. Download the [`firefox-react-scanner-extension-v1.0.2.zip`](https://github.com/aidenybai/react-scan/tree/main/packages/extension/build) file.
1717
2. Unzip the file.
1818
3. Open Firefox and navigate to `about:debugging#/runtime/this-firefox`.
1919
4. Click "Load Temporary Add-on..."
2020
5. Select `manifest.json` from the unzipped folder
2121

2222
## Brave
2323

24-
1. Download the [`brave-react-scanner-extension-v1.0.1.zip`](https://github.com/aidenybai/react-scan/tree/main/packages/extension/build) file.
24+
1. Download the [`brave-react-scanner-extension-v1.0.2.zip`](https://github.com/aidenybai/react-scan/tree/main/packages/extension/build) file.
2525
2. Unzip the file.
2626
3. Open Brave and navigate to `brave://extensions`.
2727
4. Click "Load unpacked" and select the unzipped folder (or drag the folder into the page).
28+
29+
> [!NOTE]
30+
> The React Scan browser extension currently uses `[email protected]`

biome.json

+52-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,57 @@
77
},
88
"files": {
99
"ignoreUnknown": false,
10-
"ignore": []
10+
"ignore": [
11+
"examples/**",
12+
"**/dist/**",
13+
"**/build/**",
14+
"node_modules",
15+
"**/node_modules/**",
16+
"**/*.css",
17+
"**/*.astro",
18+
"packages/website",
19+
"kitchen-sink"
20+
]
21+
},
22+
"organizeImports": {
23+
"enabled": true
24+
},
25+
"linter": {
26+
"enabled": false,
27+
"rules": {
28+
"recommended": true,
29+
"correctness": {
30+
"noUnusedFunctionParameters": {
31+
"level": "warn",
32+
"fix": "unsafe"
33+
},
34+
"noUnusedImports": {
35+
"level": "warn",
36+
"fix": "unsafe"
37+
},
38+
"noUnusedLabels": {
39+
"level": "warn",
40+
"fix": "unsafe"
41+
},
42+
"noUnusedPrivateClassMembers": {
43+
"level": "warn",
44+
"fix": "unsafe"
45+
},
46+
"noUnusedVariables": {
47+
"level": "warn",
48+
"fix": "unsafe"
49+
}
50+
},
51+
"suspicious": {
52+
"noExplicitAny": "error"
53+
},
54+
"security": {
55+
"noDangerouslySetInnerHtml": "error"
56+
},
57+
"style": {
58+
"noNonNullAssertion": "error"
59+
}
60+
}
1161
},
1262
"formatter": {
1363
"enabled": true,
@@ -16,19 +66,10 @@
1666
"lineWidth": 80,
1767
"lineEnding": "lf"
1868
},
19-
"organizeImports": {
20-
"enabled": true
21-
},
22-
"linter": {
23-
"enabled": false
24-
},
2569
"javascript": {
2670
"formatter": {
2771
"quoteStyle": "single",
28-
"indentStyle": "space",
29-
"indentWidth": 2,
30-
"lineWidth": 80,
31-
"lineEnding": "lf"
72+
"trailingCommas": "all"
3273
}
3374
}
3475
}

examples/sierpinski/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"vite-plugin-inspect": "^0.8.7"
1616
},
1717
"devDependencies": {
18-
"@vitejs/plugin-react": "^4.3.1",
18+
"@vitejs/plugin-react": "^4.3.4",
1919
"vite": "^5.4.3"
2020
}
2121
}

package.json

+5-9
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,24 @@
44
"scripts": {
55
"build": "WORKSPACE_BUILD=true node scripts/workspace.mjs build",
66
"postbuild": "node scripts/version-warning.mjs",
7+
"postinstall": "pnpm build",
78
"dev": "node scripts/workspace.mjs dev",
89
"pack": "node scripts/workspace.mjs pack",
910
"pack:bump": "pnpm --filter scan pack:bump",
10-
"lint": "pnpm --parallel lint",
11-
"eslint:fix": "eslint --fix packages/*"
11+
"lint": "biome lint .",
12+
"format": "biome format . --write",
13+
"check": "biome check . --write"
1214
},
1315
"devDependencies": {
1416
"@biomejs/biome": "^1.9.4",
1517
"@types/node": "^22.10.2",
16-
"@typescript-eslint/eslint-plugin": "^6.0.0",
17-
"@typescript-eslint/parser": "^6.0.0",
1818
"@vercel/style-guide": "^6.0.0",
1919
"autoprefixer": "^10.4.20",
2020
"boxen": "^8.0.1",
2121
"chalk": "^5.3.0",
22-
"eslint": "^8.57.1",
23-
"eslint-import-resolver-typescript": "^3.7.0",
24-
"eslint-plugin-jsonc": "^2.18.2",
25-
"eslint-plugin-tailwindcss": "^3.17.5",
2622
"postcss": "^8.4.49",
2723
"tailwindcss": "^3.4.17",
28-
"typescript": "5.4.5",
24+
"typescript": "latest",
2925
"vite-tsconfig-paths": "^5.1.4"
3026
},
3127
"packageManager": "[email protected]",

packages/extension/.env.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# You only need to set these if the browsers are not in standard locations
33

44
# For macOS, use paths like:
5-
BRAVE_BINARY="/Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser"
5+
BRAVE_BINARY="/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
66
CHROME_BINARY="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
77
FIREFOX_BINARY="/Applications/Firefox.app/Contents/MacOS/firefox-bin"
88

packages/extension/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ pnpm pack:all
6464
```
6565

6666
This will create:
67-
- `chrome-react-scanner-extension-v1.0.1.zip`
68-
- `firefox-react-scanner-extension-v1.0.1.zip`
69-
- `brave-react-scanner-extension-v1.0.1.zip`
67+
- `chrome-react-scanner-extension-v1.0.2.zip`
68+
- `firefox-react-scanner-extension-v1.0.2.zip`
69+
- `brave-react-scanner-extension-v1.0.2.zip`
7070

7171
in the `build` directory.

packages/extension/package.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-scan/extension",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"private": true,
55
"type": "module",
66
"scripts": {
@@ -18,19 +18,23 @@
1818
"pack:all": "rm -rf build && pnpm pack:chrome && pnpm pack:firefox && pnpm pack:brave"
1919
},
2020
"dependencies": {
21+
"@pivanov/utils": "^0.0.1",
22+
"react": "^18.2.0",
23+
"react-dom": "^18.2.0",
2124
"react-scan": "workspace:*",
2225
"zod": "^3.23.8"
2326
},
2427
"devDependencies": {
25-
"@pivanov/utils": "^0.0.1",
2628
"@types/chrome": "^0.0.281",
2729
"@types/react": "^18.0.26",
2830
"@types/react-dom": "^18.0.9",
2931
"@types/webextension-polyfill": "^0.10.0",
32+
"@vitejs/plugin-react": "^4.2.1",
3033
"bestzip": "^2.2.1",
3134
"cross-env": "^7.0.3",
32-
"vite": "^5.4.3",
33-
"vite-plugin-web-extension": "^4.3.1",
35+
"vite": "^6.0.7",
36+
"vite-plugin-web-extension": "^4.4.3",
37+
"vite-tsconfig-paths": "^5.1.4",
3438
"webextension-polyfill": "^0.10.0"
3539
}
3640
}

packages/extension/public/rules.json

-20
This file was deleted.

packages/extension/src/assets/css/no-react.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ html.freeze #react-scan-toast {
4949
}
5050

5151
#react-scan-toast .icon {
52-
font-size: 16px;
52+
font-size: .75rem;
5353
}
5454

5555
@media (max-width: 320px) {

packages/extension/src/background/icon.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const ANIMATION_CONFIG = {
1717
stopFrame: 6,
1818
} as const;
1919

20-
let animationInterval: number | null = null;
20+
let animationInterval: TTimer | null = null;
2121
const preRenderedFrames: Array<Record<string, {
2222
width: number;
2323
height: number;
@@ -208,7 +208,7 @@ browser.tabs.onUpdated.addListener((_, changeInfo) => {
208208
}
209209
});
210210

211-
browser.runtime.onMessage.addListener((message, _sender, sendResponse) => {
211+
browser.runtime.onMessage.addListener((message, _sender, _sendResponse) => {
212212
if (message.type === 'react-scan:is-focused') {
213213
debouncedUpdateIcon(message.data.state);
214214
}

0 commit comments

Comments
 (0)