Only yarn is officially considered on development environment.
Some scripts in package.json explicitly call yarn as well.
Therefore, this project only maintains yarn.lock, which yarn generates. Do not commit package-lock.json, which npm generates.
The version of yarn should satisfy the condition specified on package.json's engines.yarn field.
Module alias is only used for tests to load source modules. Every source modules under src directory do only use relative paths each other. So, compiled js files doesn't depend on module alias resolution.
Thus, module aliases should be consistent between configurations of typescript, jest, and eslint.
For typescript, corresponding configuration is done by baseUrl and paths fields in tsconfig.json.
See moduleNameMapper field for corresponding configuration on jest.config.js.
For example,
{
// A map from regular expressions to module names that allow to stub out resources with a single module
"moduleNameMapper": {
"^#/(.*)$": "<rootDir>/src/$1"
}
}means #/ will be matched to src/.
eslint-plugin-import and eslint-import-resolver-typescript respect tsconfig.json by the configuration below in .eslintrc.js.
{
"settings": {
"import/resolver": {
"typescript": {} // this loads <rootdir>/tsconfig.json to eslint
}
}
}This makes it not complaining about module aliases.
Note that # is used instead of more conventional @ due to an issue of link-module-alias.
jest is used as test runner.
yarn dev and yarn dev:build are only for development iteration.
There are git hooks, you can see them in package.json under husky field. To ignore hooks registered by husky, run HUSKY_SKIP_HOOKS=1 <command-you-want> or yarn husky-skip <command-you-want>. Note that shell specific configuration (e.g. aliases) might be only avaliable with the former one, as yarn could use a different shell (e.g. /bin/sh) from your default one.
lint-staged is used to format staged files, and stage them again (as obviously they become 'changed' after formatted).
This repo is "commitizen-friendly". Commitizen is executed when git commit(prepare-commit-msg hook).
Commitlint lints commit message. commitlint.config.js is its configuration file.