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

feat(sage-monorepo): configure Prettier as the default formatter #2793

Merged
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 2 additions & 16 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,13 @@
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript", "standard", "eslint-config-prettier"],
"plugins": ["@typescript-eslint", "eslint-plugin-prettier"],
"extends": ["plugin:@nx/typescript"],
"plugins": ["@typescript-eslint"],
"rules": {
"dot-notation": "off",
"no-useless-constructor": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "error",
"prettier/prettier": [
"error",
{
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"printWidth": 80
}
],
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
Expand All @@ -36,11 +27,6 @@
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
},
{
"files": "*.json",
"parser": "jsonc-eslint-parser",
"rules": {}
}
]
}
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE/default.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Description

<!-- Please include a brief summary of the changes and the related issue. Itemize
<!-- Please include a brief summary of the changes and the related issue. Itemize
the changes in the section Changelog (see below). -->

## Related Issue
Expand All @@ -23,4 +23,4 @@ Fixes #(issue)

<!-- Demonstrate the feature or bug fix implemented in this PR. For example, -->
<!-- - a screencast that illustrates a new UI feature (e.g. using https://gifcap.dev) -->
<!-- - a request example and its response from a new/updated REST API endpoint -->
<!-- - a request example and its response from a new/updated REST API endpoint -->
10 changes: 3 additions & 7 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"automergeType": "pr",
"prHourlyLimit": 2,
"prConcurrentLimit": 5,
"ignorePaths": [
"apps/api"
],
"ignorePaths": ["apps/api"],
"baseBranches": ["main"],
"labels": ["bot", "dependencies"],
"packageRules": [
Expand Down Expand Up @@ -56,7 +54,5 @@
}
],
"timezone": "America/Los_Angeles",
"schedule": [
"every weekend"
]
}
"schedule": ["every weekend"]
}
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ jobs:
# against.
fetch-depth: 0

- name: Switch from the detached HEAD of the merge commit to a new branch
- name:
Switch from the detached HEAD of the merge commit to a new branch
# Buildx does not work on a detached HEAD
run: git switch -c new-branch

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-dockerfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
- name: Lint Dockerfiles
uses: hadolint/[email protected]
with:
recursive: true
recursive: true
2 changes: 1 addition & 1 deletion .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
requireScope: false
# Configure additional validation for the subject based on a regex.
# This example ensures the subject doesn't start with an uppercase character.
subjectPattern: ^(?![A-Z]).+$
subjectPattern: ^(?![A-Z]).+$
2 changes: 1 addition & 1 deletion .github/workflows/schematic-api-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ jobs:
&& nx affected --target=test-all"

- name: Remove the dev container
run: docker rm -f sage_devcontainer
run: docker rm -f sage_devcontainer
5 changes: 2 additions & 3 deletions .github/workflows/sonar-scan-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ on:

jobs:
sonar:
environment:
${{ github.event_name == 'pull_request_target' &&
environment: ${{ github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository && 'sonar' || 'none' }}
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -38,4 +37,4 @@ jobs:
- name: Scan the affected projects with Sonar
run: |
devcontainer exec --workspace-folder ../sage-monorepo bash -c ". ./dev-env.sh \
&& nx affected --target=sonar"
&& nx affected --target=sonar"
2 changes: 1 addition & 1 deletion .github/workflows/sonar-scan-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
- name: Scan the affected projects with Sonar
run: |
devcontainer exec --workspace-folder ../sage-monorepo bash -c ". ./dev-env.sh \
&& nx affected --target=sonar"
&& nx affected --target=sonar"
13 changes: 6 additions & 7 deletions .github/workflows/update-oc-db-csv-files.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
name: Update OpenChallenges DB files
on:
schedule:
- cron: "0 0 * * *" # daily at 00:00 UTC
- cron: '0 0 * * *' # daily at 00:00 UTC
workflow_dispatch:

jobs:
update:
runs-on: ubuntu-latest

steps:

# schematic only supports Python 3.9 and 3.10, so we will need
# to specifically use one of these versions.
- name: Install system dependencies
Expand All @@ -27,7 +26,7 @@ jobs:
- name: Create Google Client credentials file
uses: jsdaniell/[email protected]
with:
name: "service_account.json"
name: 'service_account.json'
json: ${{ secrets.GOOGLE_CLIENT_JSON }}

- name: Update dump files
Expand All @@ -47,11 +46,11 @@ jobs:
- name: Get current date
run: |
echo "TODAY=$(date +"%Y-%m-%d")" >> $GITHUB_ENV

- name: Push changes, then create or update pull request
uses: peter-evans/create-pull-request@v6
with:
title: "chore(openchallenges): ${{ env.TODAY }} DB update"
with:
title: 'chore(openchallenges): ${{ env.TODAY }} DB update'
body: Daily OC database update(s)
commit-message: "${{ env.TODAY }}: add latest CSV dump files"
commit-message: '${{ env.TODAY }}: add latest CSV dump files'
branch: openchallenges/db-update
16 changes: 15 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,19 @@ build
# Angular
.angular

# Node.js
.pnpm-store
node_modules
pnpm-lock.yaml

# Python
.mypy_cache
.venv
great_expectations

# Nx
/.nx/cache
/.nx/workspace-data
/.nx/workspace-data

# Mist
tmp
5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

5 changes: 5 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Prettier configuration
printWidth: 100
singleQuote: true
plugins:
- prettier-plugin-java
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
// Extensions should be defined in `.devcontainer/devcontainer.json` instead of here.
"recommendations": []
}
}
91 changes: 29 additions & 62 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,45 @@
"java.checkstyle.configuration": "checkstyle.xml",
"java.checkstyle.version": "10.3",
"java.jdt.ls.java.home": "/usr/lib/jvm/java-17-openjdk-amd64",
"java.format.enabled": false,
"java.compile.nullAnalysis.mode": "disabled",
"java.configuration.updateBuildConfiguration": "disabled",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.tabSize": 2,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
"source.fixAll": "explicit"
},
"editor.rulers": [100],
"editor.inlayHints.enabled": "off",
"eslint.workingDirectories": ["."],
// We need to explicitly set Prettier as the format for JSON formats, otherwise the formatter
// provided with VS Code will set itself as the default one, despite us specifying that Prettier
// is the default formatter (editor.defaultFormatter).
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json5]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.validate": ["json"],
"typescript.tsdk": "node_modules/typescript/lib",
"black-formatter.importStrategy": "fromEnvironment",
"python.analysis.autoImportCompletions": true,
"python.analysis.typeCheckingMode": "basic",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.tabSize": 4
// This settings still works even if VS Code does not recognize it.
// "notebook.formatOnSave.enabled": true
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
// "[typescript]": {
// "editor.defaultFormatter": "dbaeumer.vscode-eslint",
// "editor.formatOnSave": false
// },
// "[javascript]": {
// "editor.defaultFormatter": "dbaeumer.vscode-eslint",
// "editor.formatOnSave": true
// },
"java.format.enabled": false,
"[java]": {
"editor.formatOnSave": false
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[xml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
// "emeraldwalk.runonsave": {
// "commands": [
// {
// "match": "\\.(java|sql)$",
// "cmd": "node_modules/.bin/nx affected --base=HEAD --target=format"
// }
// ]
// },
"eslint.workingDirectories": [
"."
],
"sqltools.autoOpenSessionFiles": false,
"sqltools.connections": [
{
Expand Down Expand Up @@ -98,18 +77,6 @@
}
],
"terminal.integrated.showExitAlert": false,
"java.configuration.updateBuildConfiguration": "disabled",
"editor.inlayHints.enabled": "off",
"rewrap.wrappingColumn": 100,
"editor.rulers": [
100
],
"eslint.validate": [
"json"
],
"java.compile.nullAnalysis.mode": "disabled",
"typescript.tsdk": "node_modules/typescript/lib",
"python.analysis.autoImportCompletions": true,
"python.analysis.typeCheckingMode": "basic",
"jest.runMode": "on-demand"
}
}
Loading
Loading