-
Notifications
You must be signed in to change notification settings - Fork 0
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
Bc-7808 - Adjust eslint config in tldraw-server #17
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e2cff88
BC-7808 - Adjust eslint config in tldraw-server
SevenWaysDP f00ae4d
BC-7808 - fix eslint issues
SevenWaysDP f9a39ce
BC-7808 - add test workflow
SevenWaysDP 6236432
rename entryFiles
SevenWaysDP 11d8ebe
BC-7808 - add SonarCloud configuration for tldraw-server
SevenWaysDP d644bd9
add new eslint rule "newline-before-return"
SevenWaysDP 9bb9793
fix sonar cloud issues
SevenWaysDP dec8867
Merge branch 'main' into bc-7808
SevenWaysDP 4e2eaf8
Refactor getDoc method to use function expression instead of arrow fu…
SevenWaysDP 2c23ba1
code review
SevenWaysDP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,63 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.cjs'], | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin', 'jest'], | ||
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/stylistic-type-checked.ts | ||
extends: ['plugin:@typescript-eslint/stylistic-type-checked', 'plugin:prettier/recommended'], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.cjs'], | ||
rules: { | ||
'newline-before-return': 'error', | ||
'require-await': 'error', | ||
'no-return-assign': 'error', | ||
'max-classes-per-file': 'error', | ||
'@typescript-eslint/explicit-member-accessibility': 'error', | ||
'@typescript-eslint/explicit-function-return-type': 'error', | ||
'@typescript-eslint/explicit-module-boundary-types': 'error', | ||
'@typescript-eslint/no-explicit-any': 'error', | ||
'@typescript-eslint/unbound-method': 'error', | ||
'@typescript-eslint/no-unused-vars': 'error', | ||
'@typescript-eslint/no-non-null-assertion': 'error', | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
selector: 'interface', | ||
format: ['PascalCase'], | ||
custom: { | ||
regex: '^I[A-Z]', | ||
match: false, | ||
}, | ||
}, | ||
], | ||
'@typescript-eslint/no-empty-interface': [ | ||
'error', | ||
{ | ||
allowSingleExtends: true, | ||
}, | ||
], | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['**/*spec.ts'], | ||
plugins: ['jest'], | ||
env: { | ||
jest: true, | ||
}, | ||
rules: { | ||
// you should turn the original rule off *only* for test files | ||
'@typescript-eslint/unbound-method': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'jest/unbound-method': 'error', | ||
'jest/prefer-spy-on': 'error', | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
NODE_VERSION: '20' | ||
jobs: | ||
tests_cov: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
shard: [1] | ||
services: | ||
rabbitmq: | ||
image: rabbitmq:3 | ||
ports: | ||
- 5672:5672 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: npm ci | ||
run: npm ci --prefer-offline --no-audit | ||
- name: test:cov - test all with coverage | ||
timeout-minutes: 15 | ||
run: export RUN_WITHOUT_JEST_COVERAGE='true' && export NODE_OPTIONS='--max_old_space_size=4096' && ./node_modules/.bin/jest --shard=${{ matrix.shard }}/${{ strategy.job-total }} --coverage --force-exit | ||
- name: save-coverage | ||
run: mv coverage/lcov.info coverage/${{matrix.shard}}.info | ||
- name: "upload-artifacts" | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-artifacts-${{ matrix.shard }} | ||
path: coverage/ | ||
sonarcloud: | ||
name: SonarCloud coverage | ||
runs-on: ubuntu-latest | ||
needs: [tests_cov] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: coverage-artifacts-* | ||
path: coverage | ||
merge-multiple: true | ||
- name: Merge Code Coverage | ||
run: | | ||
sudo apt-get install -y lcov | ||
find coverage -name *.info -exec echo -a {} \; | xargs lcov -o merged-lcov.info | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
- name: SonarCloud upload coverage | ||
uses: SonarSource/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} | ||
lint: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 6 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: npm ci | ||
run: npm ci --prefer-offline --no-audit | ||
- name: lint | ||
run: npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
sonar.organization=schulcloud-verbund | ||
sonar.projectKey=hpi-schul-cloud_tldraw-server | ||
sonar.sources=. | ||
sonar.tests=. | ||
sonar.test.inclusions=**/*.spec.ts | ||
sonar.exclusions=**/*.app.ts, | ||
sonar.coverage.exclusions=**/*.factory.ts | ||
sonar.cpd.exclusions=**/controller/dto/*.ts | ||
sonar.javascript.lcov.reportPaths=merged-lcov.info | ||
sonar.typescript.tsconfigPaths=tsconfig.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wo wird eigentlich angegeben, dass Jobs required sind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bei Github