2.0.0 • Published 4 years ago

@equisoft/tslint-config v2.0.0

Weekly downloads
87
License
MIT
Repository
github
Last release
4 years ago

Equisoft's TSLint configuration

This project hosts Equisoft's TSLint configuration. It is versatile enough to be used with NodeJS or Web projects.

When using frameworks or libraries, you can augment it with the use of flavors, such as @equisoft/tslint-config-react.

Versioning

The versioning of this project respects semver. That means your project's package.json can caret (^) import it.

Installation

Install the libraries in your project:

yarn add --dev @equisoft/tslint-config tslint

Then create a tslint.json file that uses Equisoft's configuration:

{
  "extends": ["@equisoft/tslint-config"]
}

Finally create a script in your package.json to easily run TSLint:

{
  "scripts": {
    "tslint": "tslint -p tsconfig.json 'src/**/*.ts'",
    "tslint:ci": "yarn tslint --format junit -o build/tests/tslint/junit.xml"
  }
}

Now you can use yarn tslint to validate the code style of your TypeScript files!

TypeScript compiler checks

This repository additionally exports a tsconfig.standards.json file that you should extend in your tsconfig.json configuration:

{
  "extends": "./node_modules/@equisoft/tslint-config/tsconfig.standards.json"
}

Continuous Integration

We strongly suggest that you enforce code style checks on your CI. For example, on CircleCI you can add a configuration similar to this one to your .circleci/config.yml:

tslint:
  executor: 'node'
  steps:
    - run: 'mkdir -p build/tests/tslint/'
    - run: 'yarn tslint:ci'
    - store_test_results:
        path: 'build/tests'

Migrating an existing codebase

TSLint supports exclusion of globs in tsconfig.json. One way to gradually migrate a legacy code base to this configuration is to exclude all source files and add conforming files one at a time. To achieve this, add this key to your tsconfig.json:

{
  "linterOptions": {
    "ecxlude": [
      "src/**/*.ts",
      "!src/contacts/**/*.ts"
    ]
  }
}

Note how an entry prefixed by ! is added to re-include some source files.

2.0.0

4 years ago

2.0.0-alpha.1

4 years ago

2.0.0-alpha.0

4 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago