- Date: 2019-01-01
JavaScript / TypeScript code should be well formatted and follow agreed on coding guidelines. There should a defined set of coding guidelines the developers involved in the project agree on in project initialization phase. The coding guidelines are never to be considered final and can be fine-tuned if necessary in any project phase.
Use tslint for linting
Reasons
- linting is a well established standard in the developer community
- TSLint seems to be the most mature linting tool available at this point and is compatible with pure JavaScript projects as well
- Allows to automates the code formatting process (check to --fix option)
- manual determination of next version possible through
--release-as <major|minor|patch>
command line option is possible
Notes
- should be either integrated into either git-commit cycle (
commit
orpush
) or automated in the build stage of the CI - Manual linting is made available via package script, i.e.:
yarn lint
and by default includes the --fix
option.
- The default configuration follows the tslint:recommended rule set with those extensions:
Rule Name | Setting |
---|---|
quotemark | [true, "single"] |
indent | [true, "spaces", 2] |
interface-name | false |
ordered-imports | false |
object-literal-sort-keys | false |
no-consecutive-blank-lines | false |
arrow-parens | [true, "ban-single-arg-parens"] |
- tslint
- based on conventional commits (which in turn is based on semantic versioning standard)