npm init -y
npm i -D git-commit-msg-linter
Link do Conventional Commits
npm i -D typescript @types/node
{
"compilerOptions": {
"outDir": "./dist",
"module": "commonjs",
"target": "es2021",
"esModuleInterop": true,
"allowJs": true
}
}
npm install --save-dev \
typescript@\* \
eslint@^7.12.1 \
eslint-plugin-promise@^5.0.0 \
eslint-plugin-import@^2.22.1 \
eslint-plugin-node@^11.1.0 \
@typescript-eslint/eslint-plugin@^4.0.1 \
eslint-config-standard-with-typescript@latest
Observação instalar o plugins do ESLint
{
"extends": "standard-with-typescript",
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/comma-spacing": "off",
"@typescript-eslint/return-await": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-namespace": "off",
"import/export": "off"
}
}
node_modules
dist
babel
npm i -D husky && npm i -D lint-staged
Criar o arquivo .huskyrc.json
{
"hooks": {
"pre-commit": "line-staged"
}
}
Criar o arquivo .lintstagedrc.json
{
"*.ts": [
"eslint . --fix",
"npm run test:staged"
]
}