npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tslint-config-valorsoft

v2.2.1

Published

TSLint config, applies angular 2 style guide

Downloads

219

Readme

Welcome to the most strict tslint config ever

npm version npm downloads Build Status Dependency Status devDependency Status

Follow me twitter to be notified about new releases.

Philosophy

  • contains all rules explicitly
  • almost all rules enabled

Before install

Check version of your code editor, highly recommended to use latest version.

If you use angular-cli:

  • check that you have latest version, at least 1.0.2, and local and global versions of cli are the same.
  • disable ts lint for polyfill.ts and test.ts(in src folder). Add /* tslint:disable */ at the beginning. For more info: https://palantir.github.io/tslint/usage/rule-flags/

Install

  1. Install package
npm install -D tslint-config-valorsoft
  • check install log for errors and warnings about wrong versions of required packages (tslint, codelyzer etc.)
  • if needed install or update required packages
  • Example. You can have this situation in the end of log after installing:
npm WARN [email protected] requires a peer of codelyzer@^3.0.0 but none was installed.
npm WARN [email protected] requires a peer of tslint@^5.1.0 but none was installed.

It means that you have to update codelyzer and tslint to ^3.0.0 and ^5.1.0 versions (or higher).

  1. Edit your tslint.json:
  • add "extends": "tslint-config-valorsoft" or "extends": ["tslint-config-valorsoft", "tslint-config-valorsoft/tslint-angular.json"], for angular projects at the beginning, before rulesDirectory
  • remove all rules inside "rules" object
  • add your custom rules
  • add rules with editable shortname of your project.
"component-selector": [true, "element", "MP", "kebab-case"],
"directive-selector": [true, "attribute", "MP", "camelCase"],
"pipe-naming": [true, "camelCase", "MP"]

Note: MP is a placeholder, it is your prefix for components. If you don't need it you should change MP to empty string - [true, "camelCase", ""]

Example:

// tslint.json
{
  "extends": ["tslint-config-valorsoft", "tslint-config-valorsoft/tslint-angular.json"],
  "rulesDirectory": "node_modules/codelyzer",

  "rules": {
    // your customization
    // THIS IS IMPORTANT
    // ADD THIS RULES TO YOUR `tslint.json`
    // AND CHANGE `MP` with short name of your project
    "directive-selector": [true, "attribute", "MP", "camelCase"],
    "component-selector": [true, "element", "MP", "kebab-case"],
    "pipe-naming": [true, "camelCase", "MP"]
  }
}

After install

Setup lint command:

  • add --type-check parameter to lint command in package.json. Example: "lint": "ng lint --type-check";

Note: If you have warning Warning: Cannot read property 'some' of undefined after running tslint, update codelyzer and tslint to latest versions. For now they are codelyzer@^3.0.1 and tslint@^5.2.0

You could configure:

  • ban-types - https://palantir.github.io/tslint/rules/ban-types/
  • ban - https://palantir.github.io/tslint/rules/ban/
  • import-blacklist - https://palantir.github.io/tslint/rules/import-blacklist/

Disabled:

  • no-parameter-properties because it is very convenient to use constructor(private inject:Service)
  • no-null-keyword null should be used to clean references
  • no-require-imports - require is sometimes useful
  • object-literal-sort-keys not really useful
  • completed-docs forcing writing a docs, usually leads to low or harmful copy paste style documentation
  • file-header up to you
  • no-parameter-properties reading the docs is the best way to avoid confusion
  • prefer-for-of bad performance
  • prefer-object-spread bad performance
  • no-magic-numbers up to you

TBD:

  • promise-function-async https://palantir.github.io/tslint/rules/promise-function-async/
  • strict-boolean-expressions https://palantir.github.io/tslint/rules/strict-boolean-expressions/
  • no-boolean-literal-compare https://palantir.github.io/tslint/rules/no-boolean-literal-compare/

Contribution

  • what I really appreciate is configs for IDEs
  • to change any rule you should have strong arguments and not only opinion

LICENSE

MIT