Skip to content

Commit

Permalink
linter & formatter updates (#560)
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az authored May 6, 2023
1 parent 7b11308 commit 767edd8
Show file tree
Hide file tree
Showing 11 changed files with 2,889 additions and 1,470 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@ root = true
[*]
charset = utf-8
end_of_line = lf
max_line_length = 120
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.json]
max_line_length = 120


[*.md]
max_line_length = 80


[*ignore]
insert_final_newline = false
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ coverage
migrations
test/*.json
test/**/*.json
_
_
pnpm-lock.yaml
20 changes: 19 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,26 @@ module.exports = {
},
reportUnusedDisableDirectives: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
extends: [
//
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:security/recommended',
'prettier',
],
plugins: ['@typescript-eslint', 'simple-import-sort', 'unused-imports', 'prettier'],
overrides: [
// Markdown
{
files: ['*.md'],
processor: 'markdown/markdown',
parser: 'eslint-plugin-markdownlint/parser',
extends: ['plugin:markdown/recommended', 'plugin:markdownlint/recommended'],
rules: {
'markdownlint/md041': ['off'],
},
},
],
rules: {
'prettier/prettier': [
'warn',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
# enables verbose logging
ACTIONS_STEP_DEBUG: true
ACTIONS_STEP_DEBUG: true
2 changes: 1 addition & 1 deletion .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
# enables verbose logging
ACTIONS_STEP_DEBUG: true
ACTIONS_STEP_DEBUG: true
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:

- name: 'Lint'
run: |
node_modules/.bin/eslint --fix . --ext js,cjs,mjs,ts,d.ts,json
node_modules/.bin/eslint --fix . --ext js,cjs,mjs,ts,d.ts,json
- name: 'Format'
run: |
Expand Down Expand Up @@ -167,4 +167,4 @@ jobs:
AWS_DEFAULT_OUTPUT: json
TEST_WAIT_TIME: ${{ github.event.inputs.test-timeout || 11000 }}
run: |
node_modules/.bin/vitest --run
node_modules/.bin/vitest --run
8 changes: 8 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://raw.githubusercontent.com/DavidAnson/markdownlint/main/schema/markdownlint-config-schema.json",
"MD041": false,
"MD013": {
// Number of characters
"line_length": 80
}
}
9 changes: 9 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@ module.exports = {
semi: false,
singleQuote: true,
trailingComma: 'all',
overrides: [
{
files: ['*.json', '*.jsonc'],
options: {
parser: 'json',
},
},
],
plugins: ['prettier-plugin-sh', 'prettier-plugin-sql'],
}
29 changes: 23 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
{
"window.title": "🦙 ${rootName} ${separator} ${activeEditorMedium} 🦙",
// git
"git.autofetch": true,
"git.enableCommitSigning": true,
"git.inputValidationSubjectLength": 72,
"editor.linkedEditing": true,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
// eslint
"eslint.enable": true,
"eslint.format.enable": true,
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "json", "markdown"],
"eslint.packageManager": "pnpm",
"npm.packageManager": "pnpm",
// typescript
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.preferences.importModuleSpecifier": "non-relative"
"typescript.preferences.importModuleSpecifier": "non-relative",
// editor
"editor.linkedEditing": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint",
"editor.wordWrap": "on",
"editor.wordWrapColumn": 80
},
"[json][jsonc]": {
"editor.wordWrapColumn": 120
},
"files.associations": {
".markdownlint.json": "jsonc"
}
}
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"update-tokens": "tsx scripts/update-tokens.ts",
"update-yields": "tsx scripts/update-yields.ts",
"update-protocols": "tsx scripts/update-protocols.ts",
"lint": "eslint --fix . --ext js,cjs,mjs,ts,d.ts,json --cache",
"format": "prettier --write --ignore-path='./.eslintignore' '**/*.{md,json,js,cjs,mjs,ts}' --ignore-unknown --cache",
"lint": "eslint --fix . --ext js,cjs,mjs,ts,d.ts,json,md --cache",
"format": "prettier --write . --ignore-path='./.eslintignore' --ignore-unknown --cache",
"typecheck": "tsc --noEmit --skipLibCheck",
"predev-test": "pnpm clean",
"dev-test": "sls offline --httpPort 3034",
Expand Down Expand Up @@ -67,11 +67,16 @@
"@vitest/ui": "^0.30.1",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-markdown": "^3.0.0",
"eslint-plugin-markdownlint": "^0.4.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-security": "^1.7.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"node-pg-migrate": "^6.2.2",
"prettier": "^2.8.8",
"prettier-plugin-sh": "^0.12.8",
"prettier-plugin-sql": "^0.14.0",
"serverless": "^3.30.1",
"serverless-esbuild": "^1.43.1",
"serverless-offline": "^12.0.4",
Expand Down
Loading

0 comments on commit 767edd8

Please sign in to comment.