Skip to content

Commit

Permalink
Enhance linting (#95)
Browse files Browse the repository at this point in the history
Following problems are addressed here:
- Lint-Staged should match actual lint config
- Linting project root did not take into account subfolders (i.e.
.gitlab ci) due to misconfigured glob pattern
- Yaml files did not get linted (e.g. helm files) due to missing
extension
- Files outside of folder "src" from microservices (api/admin/site) did
not get linted as eslint did only get executed on "src" folder (e.g.
next-config or readme)
- Harmonize lint calls with run-p

However, this has bad IDE support as we have a prettierignore with
(api/admin/site/create-app). This can be resolved by either copying the
.gitignore into .prettierignore and removing the ignore patterns or by
updating to prettier 3 (which ignores all files from .gitignore by
default, https://prettier.io/blog/2023/07/05/3.0.0.html#cli)
  • Loading branch information
dkarnutsch authored Feb 14, 2024
1 parent 2abe799 commit 5f76a4b
Show file tree
Hide file tree
Showing 18 changed files with 558 additions and 45 deletions.
9 changes: 2 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
.docker-sync
*.unison.node_modules.*
.idea

node_modules
.yarn
.npm
.babelCache
schema.graphql
comet-lang
/api/uploads

.env.local
.env.secrets
lang
14 changes: 12 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# Copy from .gitignore, remove once prettier v3 is in use
.idea

.npm
.babelCache

.env.local
.env.secrets

# Go Templates can not be formatted with prettier (https://github.com/prettier/prettier/issues/6517)
chart/*/templates/*

# Microservices are checked by each microservice on its own
admin/
api/
site/
schema.graphql
lang/
create-app/
6 changes: 6 additions & 0 deletions admin/.gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
.env
.env.local
.env.secrets

/node_modules

/build

/lang/
/lang-compiled/
/lang-extracted/

fragmentTypes.json
/schema.*

**/*.generated.ts
/block-meta.json
src/comet-config.json
22 changes: 20 additions & 2 deletions admin/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
# Copy from .gitignore until prettier v3 is in use
.env
.env.local
.env.secrets

/node_modules

/build

/lang/
/lang-compiled/
/lang-extracted/

fragmentTypes.json
/schema.*

**/*.generated.ts
/block-meta.json
/comet-config.json

package-lock.json
.gitignore
*.lock
*.gql
*.dist
src/fragmentTypes.json
src/graphql.generated.ts
3 changes: 2 additions & 1 deletion admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
"serve": "cd server && npm run serve",
"gql:types": "graphql-codegen",
"gql:watch": "graphql-codegen --watch",
"lint": "npm run intl:compile && run-p gql:types generate-block-types && run-p lint:eslint lint:tsc",
"lint": "npm run intl:compile && run-p gql:types generate-block-types && run-p lint:prettier lint:eslint lint:tsc",
"lint:eslint": "eslint --max-warnings 0 --ext .ts,.tsx,.js,.jsx,.json,.md src/ package.json",
"lint:tsc": "tsc --project .",
"lint:prettier": "npx prettier --check './**/*.{js,json,md,yml,yaml}'",
"intl:extract": "formatjs extract \"src/**/*.ts*\" --ignore ./**.d.ts --out-file lang-extracted/en.json --format simple",
"intl:compile:comet": "formatjs compile-folder --format simple --ast lang/comet-lang lang-compiled/comet-lang",
"intl:compile:starter-admin": "formatjs compile-folder --format simple --ast lang/starter-lang/admin lang-compiled/starter-admin",
Expand Down
4 changes: 4 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# compiled output
/dist

/node_modules
.env
.env.local
Expand Down Expand Up @@ -36,3 +37,6 @@ junit.xml
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# Uploads
/uploads
46 changes: 45 additions & 1 deletion api/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,50 @@
# Copy from .gitignore until prettier v3 is in use
# compiled output
/dist

/node_modules
.env
.env.local
.env.secrets

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# Tests
/coverage
/.nyc_output
junit.xml

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# Uploads
/uploads

package-lock.json
.gitignore
*.lock
*.gql
*.dist
uploads/
block-meta.json
Loading

0 comments on commit 5f76a4b

Please sign in to comment.