Skip to content

Commit

Permalink
Add linting
Browse files Browse the repository at this point in the history
ESLint
  • Loading branch information
aelithron committed Dec 9, 2024
1 parent f7e3ee9 commit b669c12
Show file tree
Hide file tree
Showing 5 changed files with 1,445 additions and 295 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Lint code (ESLint)
run: npm run lint

- name: Test code (Jest)
run: npm run test
2 changes: 1 addition & 1 deletion __tests__/getplayer.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, test } from '@jest/globals';
import { describe, expect } from '@jest/globals';
import supertest from 'supertest';
import { app, server } from '../src/app.ts';

Expand Down
27 changes: 27 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginJest from "eslint-plugin-jest";

/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{languageOptions: { globals: globals.browser }},
{
// update this to match your test files
files: ['**/*.spec.js', '**/*.test.js'],
plugins: { jest: pluginJest },
languageOptions: {
globals: pluginJest.environments.globals.globals,
},
rules: {
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error',
},
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
Loading

0 comments on commit b669c12

Please sign in to comment.