Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 2.65 KB

0006-use-linter.md

File metadata and controls

54 lines (37 loc) · 2.65 KB

Use linter for keeping code well formatted

  • Date: 2019-01-01

Context and Problem Statement

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.

Considered Options

Choosen Option

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 or push) 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"]

Background information

standard-version