Socket
Book a DemoInstallSign in
Socket

@n4bb12/config-tslint

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@n4bb12/config-tslint

Shareable TSLint configuration for my projects

latest
Source
npmnpm
Version
1.4.1
Version published
Maintainers
1
Created
Source

@n4bb12/config-tslint

TSLint configuration focusing on productivity and readability.

Version License

Install

yarn add --dev @n4bb12/config-tslint

Usage

Add the following to your TSLint config:

{
  "extends": "@n4bb12/config-tslint"
}

Thoughts

If the mere goal is consistency, any randomly chosen ruleset is equally good.

From a productivity and readability standpoint, however, different rule configurations can have varyling levels of potential positive and negative impact.

trailing-comma

{ "multiline": "always", "singleline": "never" }
  • Allows cloning the last line.
  • Allows exchanging the last line.
  • Allows deleting the last line.
  • Is auto-fixable, while a missing semicolon, after performing one of the above actions, is not.

semicolon

"never"
  • Semicolons are noise and don't add any value.
  • Non-semicolon snippets work both as statements and as parameters:
console.log()
events.subscribe(e => console.log(e)/* no disturbing semicolon here */)

quotemark

"double"
  • Double quotes are valid and commonly used in way more languages than single quotes.
  • Double quotes are easier to type on German keyboards.

linebreak-style

["LF"]
  • LF works well on all platforms.
  • CRLF in bash scripts will fail on non-Windows systems.

max-line-length

[80]
  • Easier to work with two columns / files side by side
  • Leaves enough space for tool windows like file tree, outline
  • Horizontal scrolling is tedious when you don't have a horizontal scroll wheel

object-literal-key-quotes

"consistent-as-needed"
  • Less typing is needed when keys are not quoted.
  • When quoting is however needed, consistency improves readability.

eofline

true
  • An extra empty line speeds up adding new code at the end.
  • When hitting Ctrl + End, the page in most cases only scrolls vertically.

indent

["spaces", 2]
  • Spaces look better on the Web.
  • Editor support is good enough to compete with tabs.
  • Two spaces seem to be the most common choice.

interface-name

"never-prefix"
  • Modern tools make it easy to determine the accurate type quickly, when needed. This makes type prefixes are a thing of the past.
  • Interfaces in TypeScript have a different semantic than in other languages, where the I prefix is commonly used on interfaces.
  • class, interface and type are often intersected or exchanged, depending on what needs to be achieved, so type names would need to be changed quite often, when they are prefixed with C, I or T.
  • Prefixes don't play well with acronyms.

Keywords

codestyle

FAQs

Package last updated on 20 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.