Skip to content

Commit

Permalink
[backend] chore: eslint + Prettier (#39)
Browse files Browse the repository at this point in the history
* [backend] chore: eslint + Prettier
  • Loading branch information
helloitsdave authored May 5, 2024
1 parent f612ea4 commit 896499a
Show file tree
Hide file tree
Showing 22 changed files with 2,498 additions and 794 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/backend-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Backend Linting

on:
pull_request:
branches: ["main"]
paths:
- "backend/**"

defaults:
run:
working-directory: ./backend

jobs:
eslint:
name: Run eslint scanning
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install packages
run: npm ci

- name: Run ESLint
run: npm run lint
3 changes: 3 additions & 0 deletions .github/workflows/frontend-service-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Frontend Service Tests - Playwright
on:
pull_request:
branches: [ "main" ]
paths:
- "playwright/**"
- "frontend/**"

jobs:
build:
Expand Down
13 changes: 13 additions & 0 deletions backend/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxSingleQuote": false,
"arrowParens": "always",
"htmlWhitespaceSensitivity": "strict",
"endOfLine": "lf"
}
30 changes: 30 additions & 0 deletions backend/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';

export default [
{
files: ['**/*.js'],
languageOptions: { sourceType: 'script' },
},
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
{
rules: {
"no-empty-pattern": ["error", { allowObjectPatternsAsParameters: true }],
},
},
...tseslint.configs.recommended,
{
ignores: [
'**config**',
'scripts/*',
'dist/*',
'build/*',
'coverage/*',
'node_modules/*',
],
},
eslintPluginPrettierRecommended,
];
Loading

1 comment on commit 896499a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

98.00%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   authenticateToken.ts100%100%100%
   hash.ts100%100%100%
   index.ts50%50%83.33%31–33
   prisma.ts100%100%100%
src/__mocks__
   prisma.ts100%100%100%
src/routes
   loginRoutes.ts100%100%100%
   noteRoutes.ts100%100%100%
   userRoutes.ts100%100%100%

Please sign in to comment.