Configuration files including:
- TypeScript:
tsconfig.json
. TS Config Reference - ESLint:
.eslintrc.js
. Configuring ESLint - Jest:
jest.config.js
. Jest Configuration
-
Add this package inside
package.json
{ "devDependencies": { "@bitgaming/reinv-js-config": "git+https://github.com/bitgaming/reinv-js-config.git#semver:^1.5.0", } }
semver is the same as git tag of this repo
-
Make sure you have resolve all the
peerDependencies
, you can check the warning messages once you havenpm
/yarn
install -
Extend local config files in your repo
Replace {category} with the folder of project category
module.exports = require('@bitgaming/reinv-js-config/{category}/eslintrc')( { "parserOptions": { "ecmaVersion": 6, }, "rules": { '@typescript-eslint/no-explicit-any': 'off', }, } )
Replace {category} with the folder of project category
{ "extends": "@bitgaming/reinv-js-config/{category}/.tsconfig", "exclude": [ "cdk.out" ] }
-
(Optional for prettier) In order to auto-format with
eslint-prettier
, add the following config inside your VSCode preference (JSON):{ "[typescript]": { "editor.formatOnSave": false, "editor.codeActionsOnSave": { // For ESLint "source.fixAll.eslint": true }, }, ... }
This will override the default formatter from VSCode, please make sure you already setup eslint prettier in the project. Application config with prettier:
/serverless/prettier
/cdk
This repo itself uses eslint
as well. Run yarn test
to test the linting.
Make sure git tag is consistent with version
in package.json