Skip to content

Commit

Permalink
chore: linting fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowplay1 committed Nov 16, 2024
1 parent 34acb6a commit 5602a8a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ cleanup() {

cleanup

npm run build
bun run build
bun run lint:fix

git add .
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"main": "dist/src/index.js",
"scripts": {
"prep": "npx husky install && npm run commitlint:install",
"lint": "eslint ./src",
"lint:fix": "eslint ./src --fix",
"lint": "bash scripts/lint.sh",
"lint:fix": "bash scripts/lint.sh --fix",
"build": "tsc -p tsconfig.json",
"docs:generate": "bash ./scripts/docgen.sh",
"commitlint:install": "npm i -g @commitlint/cli @commitlint/config-conventional -f"
Expand Down
29 changes: 29 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

output=""


lint() {
if [[ $1 == '--fix' ]]; then
echo 'Fixing all fixable linting issues...'
echo

eslint ./src --fix & output=$(eslint ./src --fix)
else
echo 'Checking code for linting issues...'
echo

eslint ./src & output=$(eslint ./src)
fi
}


lint $1

if [ -n "$output" ]; then
echo 'Linting check failed.'
exit 1
else
echo 'Linting check passed!'
exit 0
fi
4 changes: 3 additions & 1 deletion src/lib/Giveaway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,9 @@ export class Giveaway<
private async _fetchUncached(): Promise<void> {
const { guildID, hostMemberID, channelID } = this.raw

const printErrorAndDeleteGiveaway = async (dataFailedToFetch: 'guild' | 'host member' | 'channel'): Promise<void> => {
const printErrorAndDeleteGiveaway = async (
dataFailedToFetch: 'guild' | 'host member' | 'channel'
): Promise<void> => {
this._giveaways.logger.error(
`Unable to fetch the giveaway ${dataFailedToFetch} info. Cannot proceed with operation!!`
)
Expand Down
2 changes: 1 addition & 1 deletion src/types/misc/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export type Maybe<T> = Exclude<T | null, undefined>
* @template T - The type to attach.
* @typedef {any} MaybeUndefined<T>
*/
export type MaybeUndefined<T> = Exclude<T | undefined, null>
export type MaybeUndefined<T> = Exclude<T | undefined, null>

/**
* Adds a prefix at the beginning of a string literal type.
Expand Down

0 comments on commit 5602a8a

Please sign in to comment.