Skip to content

Commit

Permalink
feat: add eslint (#8)
Browse files Browse the repository at this point in the history
* ci: add separate tsc config for ci/release builds

skip building src/util since it requires dev dependencies installed

* fix: remove unused imports

* feat (tsc): extend@tsconfig/node-lts

* style: drop prettier for eslint

* style (eslint): use airbnb and strict-type-checked

* style: re-add prettier

* pre-commit: clean up config
  • Loading branch information
RalphORama authored Dec 23, 2023
1 parent c8ec3d1 commit 016ade3
Show file tree
Hide file tree
Showing 24 changed files with 3,028 additions and 168 deletions.
24 changes: 24 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/strict-type-checked',
'airbnb-typescript/base'
],
plugins: [
'import',
'@typescript-eslint'
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json'
},
root: true,
ignorePatterns: [
'*.js',
'*.cjs',
'dist/**'
],
rules: {
'@typescript-eslint/quotes': 'off',
}
};
28 changes: 0 additions & 28 deletions .github/workflows/_lint.yml

This file was deleted.

File renamed without changes.
24 changes: 24 additions & 0 deletions .github/workflows/callable/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint

on:
workflow_call:

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "lts/*"

- uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-

- run: npm ci --ignore-scripts

- run: npm run lint
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:

jobs:
lint:
uses: "./.github/workflows/_lint.yml"
uses: "./.github/workflows/callable/lint.yml"

build:
uses: "./.github/workflows/_build.yml"
uses: "./.github/workflows/callable/build.yml"
needs: ["lint"]
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ on:

jobs:
lint:
uses: "./.github/workflows/_lint.yml"
uses: "./.github/workflows/callable/lint.yml"

build:
uses: "./.github/workflows/_build.yml"
uses: "./.github/workflows/callable/build.yml"
needs: ["lint"]

publish:
publish-to-ghcr:
needs: ["build"]
runs-on: ubuntu-latest
permissions:
Expand Down
31 changes: 30 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
repos:
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.56.0
hooks:
- id: eslint
files: '^src/.*\.ts$'
additional_dependencies:
- "[email protected]"
- "@typescript-eslint/[email protected]"
- "@typescript-eslint/[email protected]"

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.3"
rev: v3.1.0
hooks:
- id: prettier
files: '^src/.*\.ts$'

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml

- repo: https://github.com/AleksaC/hadolint-py
rev: v2.12.0.3
hooks:
- id: hadolint
name: check dockerfile

- repo: https://github.com/iamthefij/docker-pre-commit
rev: v3.0.1
hooks:
- id: docker-compose-check
name: check docker-compose
files: (docker-)?compose(\..*)?\.ya?ml$
3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

1 change: 0 additions & 1 deletion .prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN [ "npm", "ci", "--omit=dev" ]

# Compile TypeScript
COPY . .
RUN [ "npm", "run", "build" ]
RUN [ "npm", "run", "build-prod" ]

# Fire 'er up!
CMD [ "node", "dist/index.js" ]
Loading

0 comments on commit 016ade3

Please sign in to comment.