Skip to content

Commit

Permalink
fresh typescript project
Browse files Browse the repository at this point in the history
  • Loading branch information
ksaifullah committed Nov 27, 2023
1 parent 5ba6cf1 commit 325d48c
Show file tree
Hide file tree
Showing 13 changed files with 5,011 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# /node_modules/* in the project root is ignored by default
# build artefacts
dist/*
coverage/*
# data definition files
**/*.d.ts
# 3rd party libs
/src/public/
# custom definition files
/src/types/
38 changes: 38 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["plugin:@typescript-eslint/recommended"],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"comma-dangle": ["error", "only-multiline"],
"eol-last": ["error", "always"],
"indent": ["error", 2],
"max-len": [
"error",
{
"code": 140,
"tabWidth": 2
}
],
"no-cond-assign": ["error", "always"],
"no-duplicate-case": "error",
"no-param-reassign": "error",
"no-redeclare": "off",
"@typescript-eslint/no-redeclare": ["error"],
"no-this-before-super": "error",
"no-trailing-spaces": "error",
"semi": ["error", "always"],
"quotes": ["error", "single", { "avoidEscape": true }],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": 1,
"@typescript-eslint/no-inferrable-types": [
"warn",
{
"ignoreParameters": true
}
],
"@typescript-eslint/no-unused-vars": "warn"
}
}
26 changes: 26 additions & 0 deletions .github/workflows/health.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Health Check

on: push

jobs:
health-check:
name: Health Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install nodejs
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install Packages
run: npm install

- name: Check linting
run: npm run lint

- name: Run unit tests
run: npm run test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
coverage/
20 changes: 20 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"javascript.autoClosingTags": true,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
"javascript.format.semicolons": "insert",
"javascript.preferences.quoteStyle": "single",
"javascript.suggest.autoImports": true,
"javascript.suggestionActions.enabled": true,
"javascript.updateImportsOnFileMove.enabled": "prompt",
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.trimAutoWhitespace": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"editor.formatOnSave": true,
"prettier.singleQuote": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"yaml.format.singleQuote": true
}
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3.9'
services:
sh: &base
image: node:lts-alpine
volumes:
- .:/opt/code
working_dir: /opt/code
command: sh

install:
<<: *base
command: npm install

lint:
<<: *base
command: npm run lint

test:
<<: *base
command: npm test
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
verbose: true,
collectCoverage: true,
roots: ['src'],
};
Loading

0 comments on commit 325d48c

Please sign in to comment.