Questions tagged [tslint]

tslint is a static analysis linter for TypeScript.

tslint is a linter for the language, similar to jslint.

Use this tag on questions about:

  • installation
  • command-line options
  • default/built-in rules
  • rule flags
  • Custom formatters
  • creation of custom rules

Github home of tslint
NPM home of tslint

1054 questions
19
votes
3 answers

Angular 11: subscribe is deprecated: Use an observer instead?

My tslint gone crazy? It gives warning for every subscribtion I made in whole app. It doesn't matter if I use old or new syntax it still says that subscribe is deprecated... How to write a subscription that will not be deprecated? That's what was ok…
Smokovsky
  • 569
  • 1
  • 7
  • 21
19
votes
1 answer

ESLint like globals in TSLint

I'm using device plugin from cordova so I have a line like this let model = device.model || ""; which causes Cannot find name 'device'. error. I think with ESLint I would need to do "eslintConfig": { "globals": { "device": true } } but…
apreg
  • 637
  • 8
  • 18
18
votes
6 answers

Visual Studio Code and TSLint: Code wrap to more than 80 characters

I'm using TypeScript with TSLint and Prettier in Visual Studio Code to write a React Native App. I tried to configure my editor to wrap the code in per line automatically to 100 characters. But after saving it's always 80 characters, not 100. Here…
J. Hesters
  • 13,117
  • 31
  • 133
  • 249
18
votes
3 answers

What is the difference between `extends` and `rulesDirectory` in TSLint

The TSLint.json config file (https://github.com/palantir/tslint) supports extends and a rulesDirectory array like so { "extends": [ "tslint-microsoft-contrib", "tslint-config-security" ], "rulesDirectory": [ …
mittens pair
  • 880
  • 1
  • 7
  • 17
18
votes
2 answers

Property 'unsubscribe' does not exist on type 'Observable'

Typescript(tslint in atom editor) is giving me a typescript error, but i cannot figure out how to set the correct type. Error message: chat component: private _chatObserver: Observable otherMethod () { …
17
votes
3 answers

How to update the configuration for eslint after upgrade angular 9 to 10

After upgrading angular from 9 to 10 and run npm run lint, I got this experiment > ng lint --fix Schema validation failed with the following errors: Data path "" should NOT have additional properties(tsConfig). My angular.json is: ..."lint":…
Einsamer
  • 1,069
  • 4
  • 17
  • 34
17
votes
1 answer

void before promise syntax

What is the actual impact of putting void before promise? async function doAsyncStuff(){ ... } function nonAsyncFunction(){ void doAsyncStuff(); } I couldn't find any official documentation for this, but it must be doing something as it resolves…
JeB
  • 11,653
  • 10
  • 58
  • 87
17
votes
1 answer

Make complierOptions generate warnings instead of errors in tsconfig

Is there a way to indicate in the tsconfig.json file the options noUnusedLocals and noUnusedParameters as warnings instead of errors that block the compilation? Currently I use them in the tsconfig.json file like this : "compilerOptions": { …
Brahim LAMJAGUAR
  • 1,254
  • 5
  • 19
  • 28
17
votes
2 answers

How to lint for Typescript compilation issues?

Take the following Typescript arrow function: /** * Returns a probably unique component name. * * @param baseName a suggested name to make unique. * @returns a probably unique name. */ export const getUniqueComponentName = ( baseName ):…
Tom
  • 8,536
  • 31
  • 133
  • 232
17
votes
2 answers

Is it possible to disable TSLint in tslint.json?

I use react-scripts-ts to generate React App and it supplies TSLint. It seems like there's no option to tell react-scripts-ts to exclude TSLint from the build pipeline. Is it possible to disable TSLint via tslint.json? P.S. It's possible to…
Alexey Petrushin
  • 1,311
  • 3
  • 10
  • 24
17
votes
3 answers

tslint-loader with webpack 2.1.0-beta.25

I have an angular2 Project that I compress/compile with webpack. I use tslink loader with webpack so I have tslint related configuration in webpack.config.js. module.exports = { ... tslint: { configuration: { rules: { …
ufk
  • 30,912
  • 70
  • 235
  • 386
17
votes
2 answers

Is there a way to improve linting errors highlight in Visual Studio Code?

Currently eslint/tslint highlighting for issues/errors is super invisible (comparing, for example, to Atom). Its almost impossible to catch the issue - find the small green highlight zone (see screenshot) VSCode: Atom: Question is not relevant…
ValeriiVasin
  • 8,628
  • 11
  • 58
  • 78
17
votes
3 answers

Setup TSLint in Visual Studio 2015

I develop with Typescript in Visual Studio 2013 and always have my error list open on the bottom. TSLint tells me when my code is messy/incorrect as i'm writing it. I don't think I had to do anything other than install the Web Essentials plugin. I…
TrentVB
  • 430
  • 4
  • 16
16
votes
1 answer

TSLint is being deprecated. How does this affect Angular?

The company I work at is on the brink of starting a new enterprise Angular application. While reading up on linting, I read that TSLint is being deprecated. Since TSLint is included in Angular by default, I started looking for any plans the Angular…
Joost Kersjes
  • 301
  • 2
  • 5
16
votes
3 answers

Tslint: Max-line-length not fixed by prettier

I'm using VSCode with prettier plugin and typescript and also tslint. Leaving aside the convenience to use this configuration, I get a [tslint] Exceeds maximum line length of 120 (max-line-length) For a line like this: import { MyComponent } from…
David
  • 3,364
  • 10
  • 41
  • 84