Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TECH] Ne pas permettre de créer de nouveau usecase dans api/lib (PIX-10667) #7865

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/lint-api-lib.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: lint api/lib/domain/usecases new files
on: push
jobs:
lint-api-lib-staged:
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: npm

- name: Lint api/lib/domain/usecases
working-directory: ./api
run: |
npm ci
npm run lint:staged:api-lib
20 changes: 20 additions & 0 deletions api/.eslint-new-files-in-lib-config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

module.exports = {
parserOptions: {
ecmaVersion: 2020,
requireConfigFile: false,
babelOptions: {
parserOpts: {
plugins: ['importAssertions'],
},
},
},
parser: '@babel/eslint-parser',
globals: {
include: true,
},
rules: {
'max-lines': ['error', 0],
},
};
3 changes: 3 additions & 0 deletions api/lib/domain/usecases/fake-usecase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const findAllTags = ({ tagRepository }) => tagRepository.findAll();

export { findAllTags };
1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
"lint:js": "eslint . --ext js --cache --cache-strategy content",
"lint:js:fix": "npm run lint:js -- --fix",
"lint:js:uncached": "eslint . --ext js",
"lint:staged:api-lib": "eslint --config .eslint-new-files-in-lib-config.cjs --no-eslintrc $(git log --name-only --format='' --diff-filter=A dev..HEAD | grep 'api/lib/domain/usecases/' | sed -e 's|api/||g')",
"lint:translations": "eslint --ext .json --format node_modules/eslint-plugin-i18n-json/formatter.js translations",
"lint:translations:fix": "npm run lint:translations -- --fix",
"postdeploy": "DEBUG=knex:* npm run db:migrate",
Expand Down
Loading