Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup TypeScript on the backend #3403

Closed
wants to merge 13 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/automated_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
api_unit_tests:
name: API Unit Tests
runs-on: ubuntu-20.04
container: node:16.15.0
container: node:20.17.0
services:
postgres:
image: postgres:13
Expand Down
2 changes: 0 additions & 2 deletions packages/api/.eslintignore

This file was deleted.

29 changes: 0 additions & 29 deletions packages/api/.eslintrc.cjs

This file was deleted.

3 changes: 2 additions & 1 deletion packages/api/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
src/jobs/locales/*/crop.json
src/jobs/locales/*/*_old.json
/exports/temp
**/logs
**/logs
dist
12 changes: 7 additions & 5 deletions packages/api/.knex/knexfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
// import path from 'path';
// import { fileURLToPath } from 'url';

const dotenv = require('dotenv');
const path = require('path');
import * as dotenv from 'dotenv';
import path from 'node:path';

dotenv.config({ path: path.resolve(__dirname, '../.env') });
const dirname = import.meta.dirname;

const root = path.resolve(__dirname, '../');
dotenv.config({ path: path.resolve(dirname, '../.env') });

module.exports = {
const root = path.resolve(dirname, '../');

export default {
development: {
client: 'postgresql',
connection: {
Expand Down
4 changes: 2 additions & 2 deletions packages/api/.knex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"version": "1.0.0",
"description": "",
"main": "knexfile.js",
"type": "commonjs",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
}
22 changes: 22 additions & 0 deletions packages/api/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';

export default [
{
files: ['**/*.{js,mjs,cjs,ts}'],
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
},
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
5 changes: 5 additions & 0 deletions packages/api/lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
'*.{js,ts}': ['eslint --quiet --fix'],
'*.{md,yml,json,js,ts}': 'prettier --write',
'*.{ts,js}': () => 'tsc -p tsconfig.json --noEmit',
};
Loading
Loading