Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
node_modules

8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"singleQuote": true,
"semi": true,
"tabWidth": 2,
"printWidth": 80,
"trailingComma": "es5"
}

19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,20 @@ API gateway, usage metering, and billing services for the Callora API marketplac

## Scripts

| Command | Description |
|----------------|--------------------------------|
| `npm run dev` | Run with tsx watch (no build) |
| `npm run build`| Compile TypeScript to `dist/` |
| `npm start` | Run compiled `dist/index.js` |
| Command | Description |
| ------------------ | ------------------------------------ |
| `npm run dev` | Run with tsx watch (no build) |
| `npm run build` | Compile TypeScript to `dist/` |
| `npm start` | Run compiled `dist/index.js` |
| `npm run lint` | Run ESLint on `src/` |
| `npm run lint:fix` | Auto-fix ESLint issues |
| `npm run format` | Format `src/` + README with Prettier |

## Linting and formatting

- `npm run lint` runs ESLint on `src/`
- `npm run lint:fix` applies ESLint auto-fixes
- `npm run format` formats files with Prettier

## Project layout

Expand Down
57 changes: 57 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import tsParser from '@typescript-eslint/parser';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import prettierPlugin from 'eslint-plugin-prettier';
import prettierConfig from 'eslint-config-prettier';
import eslintJs from '@eslint/js';

const globals = {
console: 'readonly',
process: 'readonly',
Buffer: 'readonly',
setImmediate: 'readonly',
clearImmediate: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
describe: 'readonly',
it: 'readonly',
test: 'readonly',
expect: 'readonly',
beforeAll: 'readonly',
afterAll: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
jest: 'readonly',
};

export default [
{
ignores: ['dist/**', 'node_modules/**'],
},
eslintJs.configs.recommended,
{
files: ['src/**/*.ts'],
languageOptions: {
parser: tsParser,
ecmaVersion: 2022,
sourceType: 'module',
globals,
},
plugins: {
'@typescript-eslint': tsPlugin,
prettier: prettierPlugin,
},
rules: {
...tsPlugin.configs.recommended.rules,
...prettierConfig.rules,
'prettier/prettier': [
'error',
{
singleQuote: true,
semi: true,
},
],
},
},
];
17 changes: 0 additions & 17 deletions eslintrc.json

This file was deleted.

File renamed without changes.
107 changes: 100 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,28 @@
"build": "tsc",
"start": "node dist/index.js",
"dev": "tsx watch src/index.ts",
"lint": "eslint . --ext .ts",
"lint": "eslint \"src/**/*.ts\"",
"lint:fix": "npm run lint -- --fix",
"format": "prettier --write \"src/**/*.ts\" \"README.md\"",
"typecheck": "tsc --noEmit",
"test": "jest --runInBand"
},
"dependencies": {
"express": "^4.18.2"
},
"devDependencies": {
"@eslint/js": "^9.0.0",
"@types/express": "^4.17.21",
"@types/jest": "^30.0.0",
"@types/node": "^20.10.0",
"@types/supertest": "^6.0.3",
"@typescript-eslint/eslint-plugin": "^8.56.1",
"@typescript-eslint/parser": "^8.56.1",
"eslint": "^10.0.2",
"eslint-config-prettier": "^10.0.0",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^30.2.0",
"prettier": "^3.5.0",
"supertest": "^7.2.2",
"ts-jest": "^29.4.6",
"tsx": "^4.7.0",
Expand Down
3 changes: 1 addition & 2 deletions src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import request from 'supertest';
import express from 'express';
import app from './index';

describe('Health API', () => {
Expand All @@ -8,4 +7,4 @@ describe('Health API', () => {
expect(response.status).toBe(200);
expect(response.body.status).toBe('ok');
});
});
});
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ if (process.env.NODE_ENV !== 'test') {
});
}

export default app;
export default app;