Skip to content

Commit

Permalink
ci(ci): fix ci issues
Browse files Browse the repository at this point in the history
  • Loading branch information
snobbee committed Feb 6, 2025
1 parent bd1f7cb commit d3274f3
Show file tree
Hide file tree
Showing 8 changed files with 353 additions and 236 deletions.
48 changes: 4 additions & 44 deletions .github/workflows/block-mini.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,8 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Detect potential minified code
shell: bash
run: |
echo "Scanning for potential minified JS/TS code..."
# We'll look in .ts, .tsx, .js, .jsx files, skipping common build dirs.
FILES=$(find . \
\( -name 'node_modules' -prune \) -o \
\( -name 'dist' -prune \) -o \
\( -name 'build' -prune \) -o \
-type f \( -name '*.ts' -o -name '*.tsx' -o -name '*.js' -o -name '*.jsx' \) \
-print)
if [ -z "$FILES" ]; then
echo "No relevant JS/TS files found."
exit 0
fi
THRESHOLD=1000
VIOLATIONS=0
- name: Make script executable
run: chmod +x ./scripts/detect-minified-code.sh

for file in $FILES; do
# Use grep -En to capture line number and text
# If any line is ≥ THRESHOLD chars, we store those lines in RESULTS
RESULTS=$(grep -En ".{${THRESHOLD},}" "$file" || true)
if [ -n "$RESULTS" ]; then
# We have potential minified lines
while IFS= read -r match; do
# 'match' will be something like "1234:the entire matched line"
LINENUM=$(echo "$match" | cut -d: -f1)
# If you want the text, you can do:
# MATCHED_LINE=$(echo "$match" | cut -d: -f2-)
echo "::error file=$file,line=$LINENUM::Detected potential minified code (≥ $THRESHOLD chars)."
done <<< "$RESULTS"
VIOLATIONS=1
fi
done
if [ "$VIOLATIONS" -eq 1 ]; then
echo "ERROR: Minified code detected. Please remove or exclude it."
exit 1
else
echo "No minified code detected."
fi
- name: Detect potential minified code
run: ./scripts/detect-minified-code.sh
96 changes: 96 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "warn",
"noArrayIndexKey": "warn",
"noPrototypeBuiltins": "warn",
"noDuplicateObjectKeys": "warn",
"noGlobalIsNan": "warn",
"noDuplicateFontNames": "warn",
"noSelfCompare": "warn",
"noDoubleEquals": "warn",
"noImplicitAnyLet": "warn",
"noAssignInExpressions": "warn",
"noExportsInTest": "warn",
"noConstEnum": "warn",
"noEmptyInterface": "warn"
},
"correctness": {
"noUnusedVariables": "warn",
"noUnreachable": "warn",
"useExhaustiveDependencies": "warn",
"noSwitchDeclarations": "warn",
"noUnnecessaryContinue": "warn",
"noInnerDeclarations": "warn"
},
"style": {
"useConst": "warn",
"useTemplate": "warn",
"useImportType": "warn",
"useNodejsImportProtocol": "warn",
"noUselessElse": "warn",
"useSelfClosingElements": "warn",
"useNumberNamespace": "warn",
"noUnusedTemplateLiteral": "warn",
"noInferrableTypes": "warn",
"noNonNullAssertion": "warn",
"noParameterAssign": "warn",
"useDefaultParameterLast": "warn",
"useExponentiationOperator": "warn",
"noVar": "warn",
"useSingleVarDeclarator": "warn",
"useExportType": "warn"
},
"a11y": {
"useAltText": "warn",
"useFocusableInteractive": "warn",
"useMediaCaption": "warn",
"noSvgWithoutTitle": "warn",
"useKeyWithClickEvents": "warn"
},
"complexity": {
"noForEach": "warn",
"useOptionalChain": "warn",
"useArrowFunction": "warn",
"useFlatMap": "warn",
"useLiteralKeys": "warn",
"noBannedTypes": "warn",
"noStaticOnlyClass": "warn",
"noThisInStatic": "warn",
"noUselessConstructor": "warn",
"noUselessTernary": "warn",
"noUselessSwitchCase": "warn",
"noUselessCatch": "warn"
},
"performance": {
"noDelete": "warn",
"noAccumulatingSpread": "warn"
}
},
"ignore": [
"**/dist/**",
"**/node_modules/**",
"**/coverage/**",
"**/*.json"
]
},
"formatter": {
"enabled": true
},
"javascript": {
"parser": {
"unsafeParameterDecoratorsEnabled": true
},
"formatter": {
"quoteStyle": "double",
"semicolons": "always"
}
}
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
"build": "turbo build",
"dev": "turbo --concurrency 100 dev",
"lint": "turbo lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"smokeTests": "bash ./scripts/smokeTests.sh",
"detectMinifiedCode": "bash ./scripts/detect-minified-code.sh"
},
"dependencies": {
"@biomejs/biome": "^1.9.4",
"csv-parse": "5.6.0",
"csv-writer": "1.6.0",
"sharp": "0.33.5",
Expand Down
Loading

0 comments on commit d3274f3

Please sign in to comment.