Skip to content

Commit 29a6499

Browse files
committed
chore: update lint workflow to include permissions and improve branch checkout logic
2 parents 2afcacf + 719f373 commit 29a6499

File tree

6 files changed

+31
-10
lines changed

6 files changed

+31
-10
lines changed

.github/workflows/lint.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ on:
1313
jobs:
1414
lint:
1515
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: write
1619
env:
1720
THUMBNAIL_URL: ${{ vars.THUMBNAIL_URL }}
1821

@@ -21,6 +24,7 @@ jobs:
2124
uses: actions/checkout@v4
2225
with:
2326
token: ${{ secrets.GITHUB_TOKEN }}
27+
fetch-depth: 0
2428

2529
- name: Install bun
2630
uses: oven-sh/setup-bun@v2
@@ -45,6 +49,14 @@ jobs:
4549
run: |
4650
git config --local user.email "[email protected]"
4751
git config --local user.name "GitHub Action"
52+
# Ensure we're on the correct branch
53+
if [ "${{ github.event_name }}" = "pull_request" ]; then
54+
BRANCH_NAME="${{ github.head_ref }}"
55+
git checkout $BRANCH_NAME || git checkout -b $BRANCH_NAME
56+
else
57+
BRANCH_NAME="${{ github.ref_name }}"
58+
git checkout $BRANCH_NAME || git checkout -b $BRANCH_NAME
59+
fi
4860
git add .
4961
git commit -m "🔧 Auto-fix: ESLint formatting and fixes"
50-
git push
62+
git push origin $BRANCH_NAME

apps/frontend/public/adasync.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-env browser */
12
var e = document.createElement('div');
23
e.id = 'F4uONjE2hMik';
34
e.style.display = 'none';

apps/frontend/src/modules/shared/components/client/ads/AdSlots.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ const HideAdButton = ({
1818
<button
1919
className='h-6 w-3'
2020
onClick={() => {
21-
setIsHidden(true),
22-
setTimeout(() => {
23-
setIsHidden(false);
24-
}, 1000 * 60 * 5); // Reappers after 5 minutes
21+
setIsHidden(true);
22+
setTimeout(() => {
23+
setIsHidden(false);
24+
}, 1000 * 60 * 5); // Reappears after 5 minutes
2525
}}
2626
>
2727
<FontAwesomeIcon
@@ -59,7 +59,7 @@ const AdTemplate = ({
5959
try {
6060
(window.adsbygoogle = window.adsbygoogle || []).push({});
6161
} catch (e) {
62-
console.error(e);
62+
// Silently handle ad loading errors
6363
}
6464
}
6565
}, []);

apps/frontend/src/modules/song-edit/components/client/context/EditSong.context.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
useForm,
1111
} from 'react-hook-form';
1212
import toaster from 'react-hot-toast';
13-
import { undefined } from 'zod';
13+
import { undefined as zodUndefined } from 'zod';
1414

1515
import type { UploadSongDto } from '@nbw/database';
1616
import { parseSongFromBuffer } from '@nbw/song';
@@ -144,7 +144,7 @@ export const EditSongProvider = ({
144144
customInstruments: formMethods.getValues().customInstruments,
145145
license: formMethods.getValues().license as UploadSongDto['license'],
146146
category: formMethods.getValues().category as UploadSongDto['category'],
147-
file: undefined,
147+
file: zodUndefined,
148148
};
149149

150150
// TODO: this comparison is not needed. Use isDirty field from react-hook-form

apps/frontend/src/modules/song-upload/components/client/context/UploadSong.context.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import {
1111
import { toast } from 'react-hot-toast';
1212

1313
import { BG_COLORS, THUMBNAIL_CONSTANTS } from '@nbw/config';
14-
import { parseSongFromBuffer } from '@nbw/song';
15-
import { SongFileType } from '@nbw/song';
14+
import { parseSongFromBuffer, SongFileType } from '@nbw/song';
1615
import axiosInstance from '@web/lib/axios';
1716
import { InvalidTokenError, getTokenLocal } from '@web/lib/axios/token.utils';
1817

eslint.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export default defineConfig(
6464
varsIgnorePattern: '^_',
6565
args: 'after-used',
6666
argsIgnorePattern: '^_',
67+
caughtErrors: 'none', // Allow unused error variables in catch blocks
6768
},
6869
],
6970
'lines-between-class-members': [
@@ -100,6 +101,14 @@ export default defineConfig(
100101
},
101102
},
102103

104+
// Browser-specific configuration for public files
105+
{
106+
files: ['**/public/**/*.{js,jsx,mjs,cjs}'],
107+
languageOptions: {
108+
globals: { ...globals.browser, ...globals.es2021 },
109+
},
110+
},
111+
103112
// React specific configuration
104113
{
105114
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],

0 commit comments

Comments
 (0)