fix lint workflow, add setup script for lint, update readme with lint instructions

This commit is contained in:
austinkelsay 2025-04-03 10:55:08 -05:00
parent a090898fad
commit 2eed15e714
No known key found for this signature in database
GPG Key ID: 5A763922E5BA08EE
4 changed files with 11 additions and 11 deletions

View File

@ -17,6 +17,6 @@ jobs:
node-version: 18 node-version: 18
cache: 'npm' cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm install
- name: Run lint - name: Run lint
run: npm run lint run: npm run lint

View File

@ -129,10 +129,11 @@ You can now run locally.
### Linting and Code Formatting ### Linting and Code Formatting
We use ESLint with Next.js configuration and Prettier for code formatting. We've kept the linting process simple with just two commands: We use ESLint with Next.js configuration and Prettier for code formatting:
- `npm run lint` - Run ESLint to check for issues 1. First-time setup: `npm run setup-lint`
- `npm run lint:fix` - Fix both ESLint and Prettier formatting issues in one command 2. Check code: `npm run lint`
3. Fix issues: `npm run lint:fix`
Before submitting a PR, please run `npm run lint:fix` to ensure your code follows our standards. Before submitting a PR, please run `npm run lint:fix` to ensure your code follows our standards.

View File

@ -7,7 +7,8 @@
"build": "npx prisma generate && next build && npx prisma migrate deploy", "build": "npx prisma generate && next build && npx prisma migrate deploy",
"start": "next start", "start": "next start",
"lint": "next lint", "lint": "next lint",
"lint:fix": "next lint --fix && prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"", "lint:fix": "next lint --fix && npx prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
"setup-lint": "npm install --save-dev prettier@3.5.3",
"postinstall": "npx prisma generate" "postinstall": "npx prisma generate"
}, },
"dependencies": { "dependencies": {

View File

@ -81,12 +81,10 @@ export default async function handler(req, res) {
}, },
} }
); );
res res.status(200).json({
.status(200) pr: response.data.invoice,
.json({ verify: `${BACKEND_URL}/api/lightning-address/verify/${slug}/${response.data.payment_hash}`,
pr: response.data.invoice, });
verify: `${BACKEND_URL}/api/lightning-address/verify/${slug}/${response.data.payment_hash}`,
});
} catch (error) { } catch (error) {
console.error(error); console.error(error);
res.status(500).json({ error: 'Failed to generate invoice' }); res.status(500).json({ error: 'Failed to generate invoice' });