Skip to content

Commit 7fe6cb5

Browse files
committed
chore: add commitlint, husky, eslint, prettier and lint-staged
1 parent be0f6bd commit 7fe6cb5

21 files changed

+8486
-2649
lines changed

.eslintrc.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"env": {
3+
"browser": false,
4+
"es2021": true,
5+
"node": true
6+
},
7+
"plugins": ["@typescript-eslint", "simple-import-sort", "unused-imports", "prettier"],
8+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
9+
"rules": {
10+
"max-len": ["error", { "code": 120, "ignoreComments": true, "ignoreUrls": true }], // This is '100' by default, but we can be a bit less restrictive.
11+
"prettier/prettier": "error"
12+
}
13+
}

.github/workflows/node.js.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ name: connect-typeorm CI
55

66
on:
77
push:
8-
branches: [ master ]
8+
branches: [master]
99
pull_request:
10-
branches: [ master ]
10+
branches: [master]
1111

1212
jobs:
1313
build:
14-
1514
runs-on: ubuntu-latest
1615

1716
strategy:
@@ -20,11 +19,11 @@ jobs:
2019
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2120

2221
steps:
23-
- uses: actions/checkout@v3
24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v3
26-
with:
27-
node-version: ${{ matrix.node-version }}
28-
cache: 'npm'
29-
- run: npm install
30-
- run: npm run test
22+
- uses: actions/checkout@v3
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: 'npm'
28+
- run: npm install
29+
- run: npm run test

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run pre-commit

.husky/pre-push

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run lint

.lintstagedrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const path = require('path');
2+
3+
const buildEslintCommand = (filenames) =>
4+
`npm run lint:fix --max-warnings=0 --file ${filenames.map((f) => path.relative(process.cwd(), f)).join(' --file ')}`;
5+
6+
module.exports = {
7+
'src/**/*.{js,jsx,ts,tsx}': [buildEslintCommand],
8+
'*.{json,css,scss,md}': ['npm run prettify'],
9+
};

.prettierignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# private folders
4+
.vscode
5+
.github
6+
7+
# dependencies
8+
/node_modules
9+
/.pnp
10+
.pnp.js
11+
package-lock.json
12+
package-lock.json
13+
14+
# testing
15+
/coverage
16+
17+
# nyc test coverage
18+
.nyc_output
19+
20+
# production
21+
/build
22+
/out
23+
24+
# misc
25+
.DS_Store
26+
*.pem
27+
28+
29+
# debug
30+
npm-debug.log*
31+
yarn-debug.log*
32+
yarn-error.log*
33+
34+
# local env files
35+
.env.local
36+
.env.development.local
37+
.env.test.local
38+
.env.production.local
39+
40+
# changelog
41+
CHANGELOG.md

.prettierrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"arrowParens": "always",
3+
"singleQuote": true,
4+
"jsxSingleQuote": true,
5+
"printWidth": 120,
6+
"tabWidth": 2,
7+
"semi": true
8+
}

.vscode/settings.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Place your settings in this file to overwrite default and user settings.
22
{
33
"editor.tabSize": 2,
4-
"typescript.tsdk": "node_modules/typescript/lib"
5-
}
4+
"typescript.tsdk": "node_modules/typescript/lib",
5+
"docwriter.style": "Auto-detect",
6+
"docwriter.progress.trackClasses": true,
7+
"docwriter.progress.trackTypes": false,
8+
"docwriter.progress.trackFunctions": false
9+
}

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
}
1717
}
1818
]
19-
}
19+
}

0 commit comments

Comments
 (0)