Skip to content

Commit 4c578a7

Browse files
authored
Split eslint and prettier (#1315)
* 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
1 parent 2733348 commit 4c578a7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+677
-808
lines changed

.eslintrc.cjs

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ module.exports = {
66
},
77
extends: [
88
'@nuxtjs/eslint-config-typescript',
9-
// Enable recommended rules for typescript
9+
// Enable typescript-specific recommended rules
1010
'plugin:@typescript-eslint/recommended',
11-
'prettier',
12-
'plugin:prettier/recommended',
1311
'plugin:nuxt/recommended',
12+
// Turns off all rules that are unnecessary or might conflict with Prettier (needs to be last)
13+
'prettier',
1414
],
1515
plugins: ['unused-imports'],
1616
rules: {
@@ -23,8 +23,8 @@ module.exports = {
2323
'ts-ignore': 'allow-with-description',
2424
},
2525
],
26-
// Report unused imports
27-
'unused-imports/no-unused-imports': 'error',
26+
// Don't report unused imports (this is handled by prettier)
27+
'unused-imports/no-unused-imports': 'off',
2828
// Report unused variables (except the ones prefixed with an underscore)
2929
'unused-imports/no-unused-vars': [
3030
'warn',
@@ -35,18 +35,12 @@ module.exports = {
3535
argsIgnorePattern: '^_',
3636
},
3737
],
38-
'prettier/prettier': [
39-
'error',
40-
{
41-
endOfLine: 'lf',
42-
},
43-
],
4438
// Ensure void operator is not used, except for variable assignment or function return (might be handy for promises)
4539
'no-void': ['error', { allowAsStatement: true }],
4640
// Demote this to warning as long as we are still using cjs modules
4741
'import/named': 'warn',
48-
// Import order is normally handled by prettier, but sometimes there are conflicts: https://github.com/simonhaenisch/prettier-plugin-organize-imports/issues/65
49-
'import/order': 'warn',
42+
// Import order is handled by prettier (which is incompatible with this rule: https://github.com/simonhaenisch/prettier-plugin-organize-imports/issues/65)
43+
'import/order': 'off',
5044
},
5145
overrides: [
5246
{
@@ -75,27 +69,27 @@ module.exports = {
7569
'@graphql-eslint/no-hashtag-description': 'warn',
7670
// Requires sname for your GraphQL operations.
7771
'@graphql-eslint/no-anonymous-operations': 'error',
78-
"@graphql-eslint/naming-convention": [
79-
"error",
72+
'@graphql-eslint/naming-convention': [
73+
'error',
8074
{
81-
"OperationDefinition": {
82-
"style": "PascalCase",
75+
OperationDefinition: {
76+
style: 'PascalCase',
8377
// Make sure to not add the operation type to the name of the operation, e.g. 'user' instead of 'userQuery'.
84-
"forbiddenPrefixes": ["Query", "Mutation", "Subscription", "Get"],
85-
"forbiddenSuffixes": ["Query", "Mutation", "Subscription"]
86-
}
87-
}
78+
forbiddenPrefixes: ['Query', 'Mutation', 'Subscription', 'Get'],
79+
forbiddenSuffixes: ['Query', 'Mutation', 'Subscription'],
80+
},
81+
},
8882
],
8983
// Requires all deprecation directives to specify a reason
9084
'@graphql-eslint/require-deprecation-reason': ['error'],
9185
// Enforces descriptions in your type definitions
9286
'@graphql-eslint/require-description': [
9387
'warn',
9488
{
95-
"types": true,
96-
"FieldDefinition": true,
97-
"ObjectTypeDefinition": true,
98-
}
89+
types: true,
90+
FieldDefinition: true,
91+
ObjectTypeDefinition: true,
92+
},
9993
],
10094
// Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.
10195
'@graphql-eslint/no-duplicate-fields': ['error'],
@@ -109,17 +103,13 @@ module.exports = {
109103
{
110104
files: ['*.tsx', '*.ts', '*.jsx', '*.js'],
111105
processor: '@graphql-eslint/graphql',
112-
rules: {
113-
// Workaround for for bug in prettier, can be removed after https://github.com/prettier/eslint-plugin-prettier/pull/415
114-
'prettier/prettier': 0,
115-
},
116106
},
117107
{
118108
files: ['*.ts', '*.vue'],
119109
// Parser supporting vue files
120110
parser: 'vue-eslint-parser',
121111
parserOptions: {
122-
// Parser used for non-vue files and for the script tag in vue files
112+
// Use ts parser for ts files and for the script tag in vue files
123113
parser: '@typescript-eslint/parser',
124114
// Correct root
125115
tsconfigRootDir: __dirname,

.github/dependabot.yml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
version: 2
22
updates:
3-
43
# Fetch and update latest `npm` packages
5-
- package-ecosystem: npm
6-
directory: '/'
7-
open-pull-requests-limit: 20
8-
schedule:
9-
interval: "monthly"
10-
labels:
11-
- "type: dependencies"
12-
- "status: safe to test"
4+
- package-ecosystem: npm
5+
directory: '/'
6+
open-pull-requests-limit: 20
7+
schedule:
8+
interval: 'monthly'
9+
labels:
10+
- 'type: dependencies'
11+
- 'status: safe to test'
1312

14-
# Fetch and update latest `github-actions` pkgs
15-
- package-ecosystem: github-actions
16-
directory: '/'
17-
open-pull-requests-limit: 20
18-
schedule:
19-
interval: "monthly"
20-
labels:
21-
- "type: dependencies"
22-
- "status: safe to test"
13+
# Fetch and update latest `github-actions` pkgs
14+
- package-ecosystem: github-actions
15+
directory: '/'
16+
open-pull-requests-limit: 20
17+
schedule:
18+
interval: 'monthly'
19+
labels:
20+
- 'type: dependencies'
21+
- 'status: safe to test'

.github/workflows/deploy.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ jobs:
4141
with:
4242
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PEBBLE_0224C3803 }}
4343
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
44-
action: "upload"
44+
action: 'upload'
4545
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
4646
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
47-
app_location: "/" # App source code path
48-
api_location: ".output/server" # Api source code path - optional
49-
output_location: ".output/public" # Built app content directory - optional
47+
app_location: '/' # App source code path
48+
api_location: '.output/server' # Api source code path - optional
49+
output_location: '.output/public' # Built app content directory - optional
5050
###### End of Repository/Build Configurations ######
5151
env:
5252
DATABASE_URL: ${{ secrets.AZURE_TEST_DATABASE_URL }}
@@ -60,7 +60,7 @@ jobs:
6060
runs-on: ubuntu-latest
6161

6262
if: github.event_name == 'push'
63-
63+
6464
strategy:
6565
matrix:
6666
include:
@@ -115,29 +115,28 @@ jobs:
115115
with:
116116
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PEBBLE_0224C3803 }}
117117
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
118-
action: "upload"
118+
action: 'upload'
119119
deployment_environment: ${{ matrix.deployment_environment }}
120120
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
121121
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
122-
app_location: "/" # App source code path
123-
api_location: ".output/server" # Api source code path - optional
124-
output_location: ".output/public" # Built app content directory - optional
122+
app_location: '/' # App source code path
123+
api_location: '.output/server' # Api source code path - optional
124+
output_location: '.output/public' # Built app content directory - optional
125125
###### End of Repository/Build Configurations ######
126126

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

130130
close_pr_preview:
131131
name: Close PR preview
132-
132+
133133
if: github.event_name == 'pull_request_target' && github.event.action == 'closed'
134-
134+
135135
runs-on: ubuntu-latest
136136

137137
steps:
138138
- name: Close Pull Request
139139
uses: Azure/static-web-apps-deploy@v1
140140
with:
141141
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PEBBLE_0224C3803 }}
142-
action: "close"
143-
142+
action: 'close'

.github/workflows/release.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,35 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v3
18-
19-
- name: Login to Azure
20-
uses: Azure/login@v1
21-
with:
22-
creds: ${{secrets.AZURE_CREDENTIALS}}
23-
24-
- name: Start deployment (Staging server)
25-
uses: bobheadxi/[email protected]
26-
id: deployment
27-
with:
28-
step: start
29-
token: ${{ secrets.GITHUB_TOKEN }}
30-
env: Production
31-
32-
- name: Swap staging > production slot
33-
uses: azure/CLI@v1
34-
with:
35-
inlineScript: |
36-
az webapp deployment slot swap --name JabRef --resource-group JabRefOnline --slot staging --target-slot production --action swap
37-
38-
- name: Update deployment status
39-
uses: bobheadxi/[email protected]
40-
if: always()
41-
with:
42-
step: finish
43-
token: ${{ secrets.GITHUB_TOKEN }}
44-
status: ${{ job.status }}
45-
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
46-
env: ${{ steps.deployment.outputs.env }}
47-
env_url: https://jabref.azurewebsites.net/
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
19+
- name: Login to Azure
20+
uses: Azure/login@v1
21+
with:
22+
creds: ${{secrets.AZURE_CREDENTIALS}}
23+
24+
- name: Start deployment (Staging server)
25+
uses: bobheadxi/[email protected]
26+
id: deployment
27+
with:
28+
step: start
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
env: Production
31+
32+
- name: Swap staging > production slot
33+
uses: azure/CLI@v1
34+
with:
35+
inlineScript: |
36+
az webapp deployment slot swap --name JabRef --resource-group JabRefOnline --slot staging --target-slot production --action swap
37+
38+
- name: Update deployment status
39+
uses: bobheadxi/[email protected]
40+
if: always()
41+
with:
42+
step: finish
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
status: ${{ job.status }}
45+
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
46+
env: ${{ steps.deployment.outputs.env }}
47+
env_url: https://jabref.azurewebsites.net/

.gitpod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ ports:
6767
onOpen: open-preview
6868
# HMR websocket https://github.com/nuxt/framework/issues/1796#issuecomment-1111618663
6969
# Still needs to be configured manually :(
70-
- port: 24678
70+
- port: 24678
7171
onOpen: ignore

.storybook/main.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module.exports = {
33
// Disable telemetry collection
44
disableTelemetry: true,
55
// Use vite as builder
6-
builder: "@storybook/builder-vite"
6+
builder: '@storybook/builder-vite',
77
},
8-
};
8+
}

.vscode/extensions.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"recommendations": [
3-
"dbaeumer.vscode-eslint",
4-
"github.copilot",
5-
"streetsidesoftware.code-spell-checker",
6-
"github.vscode-pull-request-github",
7-
"eamodio.gitlens",
8-
"graphql.vscode-graphql",
9-
"orta.vscode-jest",
10-
"esbenp.prettier-vscode",
11-
"prisma.prisma",
12-
"bradlc.vscode-tailwindcss",
13-
"vue.volar",
14-
"antfu.goto-alias"
15-
]
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"github.copilot",
5+
"streetsidesoftware.code-spell-checker",
6+
"github.vscode-pull-request-github",
7+
"eamodio.gitlens",
8+
"graphql.vscode-graphql",
9+
"orta.vscode-jest",
10+
"esbenp.prettier-vscode",
11+
"prisma.prisma",
12+
"bradlc.vscode-tailwindcss",
13+
"vue.volar",
14+
"antfu.goto-alias"
15+
]
1616
}

.vscode/launch.json

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
"name": "vscode-jest-tests",
77
"request": "launch",
88
"program": "${workspaceFolder}/node_modules/.bin/jest",
9-
"args": [
10-
"--runInBand",
11-
"--watchAll=false"
12-
],
9+
"args": ["--runInBand", "--watchAll=false"],
1310
"cwd": "${workspaceFolder}",
1411
"console": "integratedTerminal",
1512
"internalConsoleOptions": "neverOpen",
@@ -38,7 +35,7 @@
3835
{
3936
"url": "webpack:///ignore/",
4037
"path": null
41-
},
38+
}
4239
]
4340
},
4441
{
@@ -59,9 +56,7 @@
5956
"${workspaceFolder}/**",
6057
"!**/node_modules/**"
6158
],
62-
"args": [
63-
"dev"
64-
],
59+
"args": ["dev"],
6560
"osx": {
6661
"program": "${workspaceFolder}/node_modules/.bin/nuxt"
6762
},
@@ -76,10 +71,7 @@
7671
"compounds": [
7772
{
7873
"name": "Fullstack: nuxt",
79-
"configurations": [
80-
"Server: nuxt",
81-
"Client: Firefox"
82-
]
74+
"configurations": ["Server: nuxt", "Client: Firefox"]
8375
}
8476
]
8577
}

0 commit comments

Comments
 (0)