Skip to content

Commit

Permalink
Split eslint and prettier (#1315)
Browse files Browse the repository at this point in the history
* Split eslint and prettier

As recommended at https://prettier.io/docs/en/integrating-with-linters.html

* Fix vs config

* Fix linter issues

* Run prettier on everything

* Fix lint cmd

* Don't check git ignored files with prettier
  • Loading branch information
tobiasdiez committed Aug 18, 2022
1 parent 2733348 commit 4c578a7
Show file tree
Hide file tree
Showing 65 changed files with 677 additions and 808 deletions.
50 changes: 20 additions & 30 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ module.exports = {
},
extends: [
'@nuxtjs/eslint-config-typescript',
// Enable recommended rules for typescript
// Enable typescript-specific recommended rules
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
'plugin:nuxt/recommended',
// Turns off all rules that are unnecessary or might conflict with Prettier (needs to be last)
'prettier',
],
plugins: ['unused-imports'],
rules: {
Expand All @@ -23,8 +23,8 @@ module.exports = {
'ts-ignore': 'allow-with-description',
},
],
// Report unused imports
'unused-imports/no-unused-imports': 'error',
// Don't report unused imports (this is handled by prettier)
'unused-imports/no-unused-imports': 'off',
// Report unused variables (except the ones prefixed with an underscore)
'unused-imports/no-unused-vars': [
'warn',
Expand All @@ -35,18 +35,12 @@ module.exports = {
argsIgnorePattern: '^_',
},
],
'prettier/prettier': [
'error',
{
endOfLine: 'lf',
},
],
// Ensure void operator is not used, except for variable assignment or function return (might be handy for promises)
'no-void': ['error', { allowAsStatement: true }],
// Demote this to warning as long as we are still using cjs modules
'import/named': 'warn',
// Import order is normally handled by prettier, but sometimes there are conflicts: https://github.com/simonhaenisch/prettier-plugin-organize-imports/issues/65
'import/order': 'warn',
// Import order is handled by prettier (which is incompatible with this rule: https://github.com/simonhaenisch/prettier-plugin-organize-imports/issues/65)
'import/order': 'off',
},
overrides: [
{
Expand Down Expand Up @@ -75,27 +69,27 @@ module.exports = {
'@graphql-eslint/no-hashtag-description': 'warn',
// Requires sname for your GraphQL operations.
'@graphql-eslint/no-anonymous-operations': 'error',
"@graphql-eslint/naming-convention": [
"error",
'@graphql-eslint/naming-convention': [
'error',
{
"OperationDefinition": {
"style": "PascalCase",
OperationDefinition: {
style: 'PascalCase',
// Make sure to not add the operation type to the name of the operation, e.g. 'user' instead of 'userQuery'.
"forbiddenPrefixes": ["Query", "Mutation", "Subscription", "Get"],
"forbiddenSuffixes": ["Query", "Mutation", "Subscription"]
}
}
forbiddenPrefixes: ['Query', 'Mutation', 'Subscription', 'Get'],
forbiddenSuffixes: ['Query', 'Mutation', 'Subscription'],
},
},
],
// Requires all deprecation directives to specify a reason
'@graphql-eslint/require-deprecation-reason': ['error'],
// Enforces descriptions in your type definitions
'@graphql-eslint/require-description': [
'warn',
{
"types": true,
"FieldDefinition": true,
"ObjectTypeDefinition": true,
}
types: true,
FieldDefinition: true,
ObjectTypeDefinition: true,
},
],
// Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.
'@graphql-eslint/no-duplicate-fields': ['error'],
Expand All @@ -109,17 +103,13 @@ module.exports = {
{
files: ['*.tsx', '*.ts', '*.jsx', '*.js'],
processor: '@graphql-eslint/graphql',
rules: {
// Workaround for for bug in prettier, can be removed after https://github.com/prettier/eslint-plugin-prettier/pull/415
'prettier/prettier': 0,
},
},
{
files: ['*.ts', '*.vue'],
// Parser supporting vue files
parser: 'vue-eslint-parser',
parserOptions: {
// Parser used for non-vue files and for the script tag in vue files
// Use ts parser for ts files and for the script tag in vue files
parser: '@typescript-eslint/parser',
// Correct root
tsconfigRootDir: __dirname,
Expand Down
35 changes: 17 additions & 18 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
version: 2
updates:

# Fetch and update latest `npm` packages
- package-ecosystem: npm
directory: '/'
open-pull-requests-limit: 20
schedule:
interval: "monthly"
labels:
- "type: dependencies"
- "status: safe to test"
- package-ecosystem: npm
directory: '/'
open-pull-requests-limit: 20
schedule:
interval: 'monthly'
labels:
- 'type: dependencies'
- 'status: safe to test'

# Fetch and update latest `github-actions` pkgs
- package-ecosystem: github-actions
directory: '/'
open-pull-requests-limit: 20
schedule:
interval: "monthly"
labels:
- "type: dependencies"
- "status: safe to test"
# Fetch and update latest `github-actions` pkgs
- package-ecosystem: github-actions
directory: '/'
open-pull-requests-limit: 20
schedule:
interval: 'monthly'
labels:
- 'type: dependencies'
- 'status: safe to test'
25 changes: 12 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ jobs:
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PEBBLE_0224C3803 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
action: 'upload'
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/" # App source code path
api_location: ".output/server" # Api source code path - optional
output_location: ".output/public" # Built app content directory - optional
app_location: '/' # App source code path
api_location: '.output/server' # Api source code path - optional
output_location: '.output/public' # Built app content directory - optional
###### End of Repository/Build Configurations ######
env:
DATABASE_URL: ${{ secrets.AZURE_TEST_DATABASE_URL }}
Expand All @@ -60,7 +60,7 @@ jobs:
runs-on: ubuntu-latest

if: github.event_name == 'push'

strategy:
matrix:
include:
Expand Down Expand Up @@ -115,29 +115,28 @@ jobs:
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PEBBLE_0224C3803 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
action: 'upload'
deployment_environment: ${{ matrix.deployment_environment }}
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/" # App source code path
api_location: ".output/server" # Api source code path - optional
output_location: ".output/public" # Built app content directory - optional
app_location: '/' # App source code path
api_location: '.output/server' # Api source code path - optional
output_location: '.output/public' # Built app content directory - optional
###### End of Repository/Build Configurations ######

- name: Run API tests
run: yarn test:api --env-var='base_url=${{ matrix.url }}/api'

close_pr_preview:
name: Close PR preview

if: github.event_name == 'pull_request_target' && github.event.action == 'closed'

runs-on: ubuntu-latest

steps:
- name: Close Pull Request
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PEBBLE_0224C3803 }}
action: "close"

action: 'close'
64 changes: 32 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,35 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Login to Azure
uses: Azure/login@v1
with:
creds: ${{secrets.AZURE_CREDENTIALS}}

- name: Start deployment (Staging server)
uses: bobheadxi/deployments@v1.3.0
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: Production

- name: Swap staging > production slot
uses: azure/CLI@v1
with:
inlineScript: |
az webapp deployment slot swap --name JabRef --resource-group JabRefOnline --slot staging --target-slot production --action swap
- name: Update deployment status
uses: bobheadxi/deployments@v1.3.0
if: always()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env: ${{ steps.deployment.outputs.env }}
env_url: https://jabref.azurewebsites.net/
- name: Checkout
uses: actions/checkout@v3

- name: Login to Azure
uses: Azure/login@v1
with:
creds: ${{secrets.AZURE_CREDENTIALS}}

- name: Start deployment (Staging server)
uses: bobheadxi/deployments@v1.3.0
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: Production

- name: Swap staging > production slot
uses: azure/CLI@v1
with:
inlineScript: |
az webapp deployment slot swap --name JabRef --resource-group JabRefOnline --slot staging --target-slot production --action swap
- name: Update deployment status
uses: bobheadxi/deployments@v1.3.0
if: always()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env: ${{ steps.deployment.outputs.env }}
env_url: https://jabref.azurewebsites.net/
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ ports:
onOpen: open-preview
# HMR websocket https://github.com/nuxt/framework/issues/1796#issuecomment-1111618663
# Still needs to be configured manually :(
- port: 24678
- port: 24678
onOpen: ignore
4 changes: 2 additions & 2 deletions .storybook/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module.exports = {
// Disable telemetry collection
disableTelemetry: true,
// Use vite as builder
builder: "@storybook/builder-vite"
builder: '@storybook/builder-vite',
},
};
}
28 changes: 14 additions & 14 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"github.copilot",
"streetsidesoftware.code-spell-checker",
"github.vscode-pull-request-github",
"eamodio.gitlens",
"graphql.vscode-graphql",
"orta.vscode-jest",
"esbenp.prettier-vscode",
"prisma.prisma",
"bradlc.vscode-tailwindcss",
"vue.volar",
"antfu.goto-alias"
]
"recommendations": [
"dbaeumer.vscode-eslint",
"github.copilot",
"streetsidesoftware.code-spell-checker",
"github.vscode-pull-request-github",
"eamodio.gitlens",
"graphql.vscode-graphql",
"orta.vscode-jest",
"esbenp.prettier-vscode",
"prisma.prisma",
"bradlc.vscode-tailwindcss",
"vue.volar",
"antfu.goto-alias"
]
}
16 changes: 4 additions & 12 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"name": "vscode-jest-tests",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"--runInBand",
"--watchAll=false"
],
"args": ["--runInBand", "--watchAll=false"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
Expand Down Expand Up @@ -38,7 +35,7 @@
{
"url": "webpack:///ignore/",
"path": null
},
}
]
},
{
Expand All @@ -59,9 +56,7 @@
"${workspaceFolder}/**",
"!**/node_modules/**"
],
"args": [
"dev"
],
"args": ["dev"],
"osx": {
"program": "${workspaceFolder}/node_modules/.bin/nuxt"
},
Expand All @@ -76,10 +71,7 @@
"compounds": [
{
"name": "Fullstack: nuxt",
"configurations": [
"Server: nuxt",
"Client: Firefox"
]
"configurations": ["Server: nuxt", "Client: Firefox"]
}
]
}

0 comments on commit 4c578a7

Please sign in to comment.