Skip to content

Commit

Permalink
feat: add eslint jest plugin for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tdislay committed Sep 6, 2023
1 parent 088f736 commit 96b1ee8
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
28 changes: 27 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion packages/backend/lib/configs/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,18 @@ module.exports = {
},
overrides: [
{
files: ['test/**/*.js', 'features*/**/*.js'],
files: ['tests/**/*.js', 'features*/**/*.js'],
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
rules: {
'sort-keys': 'off',
},
},
{
files: ['tests/**/*.ts'],
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
parserOptions: {
parser: '@typescript-eslint/parser',
},
rules: {
'sort-keys': 'off',
},
Expand Down
1 change: 1 addition & 0 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"eslint": "^8.45.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-prettier": "^5.0.0",
"prettier": "^3.0.0"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/frontend/lib/configs/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ module.exports = {
parser: '@typescript-eslint/parser',
},
},
{
files: ['tests/**/*.ts'],
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
parserOptions: {
parser: '@typescript-eslint/parser',
},
},
{
// Apply vue and typescript rules only on Vue SFC and typescript files
files: ['src/**/*.{vue,ts}'],
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"@vue/eslint-config-prettier": "8.0.*",
"@vue/eslint-config-standard": "8.0.*",
"@vue/eslint-config-standard-with-typescript": "8.0.*",
"@vue/eslint-config-typescript": "11.0.*"
"@vue/eslint-config-typescript": "11.0.*",
"eslint-plugin-jest": "^27.2.3"
},
"devDependencies": {
"eslint-plugin-eslint-plugin": "^5.0.6"
Expand Down

0 comments on commit 96b1ee8

Please sign in to comment.