mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
chore: add a script that validates that we don't use prohibited mui material-icons import (#6516)
This PR adds a check that should fail the build if we use disallowed imports from `@mui/icons-material`
This commit is contained in:
parent
2a57acca41
commit
9c29461ee5
1
.github/workflows/build_frontend_prs.yml
vendored
1
.github/workflows/build_frontend_prs.yml
vendored
@ -20,6 +20,7 @@ jobs:
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: yarn run lint:material:icons
|
||||
- run: yarn --frozen-lockfile
|
||||
- run: yarn run lint:check
|
||||
- run: yarn run test
|
||||
|
7
frontend/check-imports.rc
Executable file
7
frontend/check-imports.rc
Executable file
@ -0,0 +1,7 @@
|
||||
if grep -R --include="*.js" --include="*.jsx" --include="*.ts" --include="*.tsx" "from '@mui/icons-material'" src; then
|
||||
echo "Prohibited import from '@mui/icons-material' found. Use default imports referencing the file instead of the
|
||||
global package. Example: import Delete from '@mui/icons-material/Delete';'"
|
||||
exit 1
|
||||
else
|
||||
echo "No prohibited imports from '@mui/icons-material' found."
|
||||
fi
|
@ -2,12 +2,15 @@
|
||||
"name": "unleash-frontend-local",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"files": ["index.js", "build"],
|
||||
"files": [
|
||||
"index.js",
|
||||
"build"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"build": "yarn run lint:material:icons && vite build",
|
||||
"dev": "vite",
|
||||
"start": "vite",
|
||||
"start:prod": "vite build && vite preview",
|
||||
@ -19,6 +22,7 @@
|
||||
"test": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" vitest run",
|
||||
"test:snapshot": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" yarn test -u",
|
||||
"test:watch": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" vitest watch",
|
||||
"lint:material:icons": "./check-imports.rc",
|
||||
"lint": "biome lint src --apply",
|
||||
"lint:check": "biome check src",
|
||||
"fmt": "biome format src --write",
|
||||
@ -142,7 +146,11 @@
|
||||
}
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [">0.2%", "not dead", "not op_mini all"],
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
|
Loading…
Reference in New Issue
Block a user