tslint Questions

3

I'm trying to forward a ref to a Typescript component that does not take any props. When I use React.forwardRef it takes two parameters: props and ref. My component does not use props. How can I de...
Unchurch asked 20/10, 2020 at 16:35

7

Solved

When looking at the source code for a tslint rule, I came across the following statement: if (node.parent!.kind === ts.SyntaxKind.ObjectLiteralExpression) { return; } Notice the ! operator after ...
Indiscreet asked 16/2, 2017 at 12:22

2

What causes VS code editor to decide my typescript symbol cannot be renamed? I'm trying to change the symbol with the f2 key and run into the error message "This element cannot be renamed&quot...

9

I see this warning thrown in VSCode: This is the line that throws the ts warning: import packageJson from "../package.json"; Weirdly, building and linting the project works fine: $ tsc --pro...
Martguerita asked 2/2, 2020 at 18:7

3

I am trying Prettier out in a project using React and Typescript. However I am having a problem configuring multi-line if / else statements. When I write: if (x >=0) { // Do something } else ...
Monandry asked 8/8, 2019 at 0:38

0

I got an error when deploying firebase functions in GitLab. I understand that package.json and firebase.json has to have Unix EOL, which I converted with Notepad++, however that didn't solve any pr...

3

Solved

I just using tslint but this block of code throws me a error. const MemberNumber = 'MBR' + pinCode + sliceNumber Operands of '+' operation must either be both strings or both numbers. Consider us...
Styracaceous asked 8/1, 2021 at 5:54

10

Solved

When I run the linter it says: subscribe is deprecated: Use an observer instead of an error callback Code from this angular app: this.userService.updateUser(data).pipe( tap(() => {bla bla bla...
Discretional asked 2/4, 2019 at 10:8

6

Solved

My configurations currently show the same red squiggly line for Typescript errors and TSLint warnings. I am using TSLint extension for Visual Studio Code but the configuration I believe is a gener...
Duppy asked 8/8, 2017 at 22:11

11

Solved

The // @ts-ignore comment enables the TypeScript compiler to ignore the line below it. How can one ignore a whole block of code with TypeScript?
Choker asked 3/7, 2018 at 0:24

5

I'm trying to switch an Angular project from TSLint to ESLint, following the instructions in angular-eslint Github repo. I ran ng add @angular-eslint/schematics which added the following dependenci...
Genna asked 19/4, 2021 at 15:36

10

Solved

I have an error in the code that I am trying to resolve. I think it needs a return statement but I have that already outside of the forEach loop but it still throws the error: not all the code pat...
Marney asked 20/7, 2018 at 15:51

12

Solved

I'm using tslint, and got the error. 'myVariable' is declared but its value is never read. I went to the website that documents the rules https://palantir.github.io/tslint/rules/ and searched f...
Vespucci asked 24/4, 2018 at 22:15

6

Solved

From time to time, I get TSLint errors "block is empty". This happens e.g. when I pass a no-op callback to a function: doSomething(() => {}); From what I read, JSLint apparently does the same...
Burnard asked 24/7, 2015 at 8:34

8

Solved

So this feels like this should be such an easy task but it's starting to drive me insane. I can't seem to turn off TSLint or TS or whatever it is that gives me these errors. I just want the ESLint ...
Raper asked 12/6, 2018 at 18:38

6

Solved

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 af...
Elisabethelisabethville asked 15/10, 2018 at 10:50

4

Solved

Similar to this question I am running the following command to linting my angular2 typeScript code. ng lint It is proving all the linting error nicely. But I want my vendor folder (let say "s...
Cupriferous asked 28/2, 2017 at 11:40

3

How can I run ng lint without showing warnings? TSLint CLI provides a --quiet flag, but there doesn't appear to be one for Angular or a way to pass through CLI flags. I still want warnings in my ts...
Manger asked 22/1, 2019 at 21:37

4

Solved

I've been trying to scour the internet to solve this but to no avail. Perhaps you can help me. I am getting tslint 'missing whitespace' warnings that say something like: WARNING in ./src/app/conte...
Vatican asked 18/2, 2016 at 18:3

3

On my project written in Typescript I want to start enforcing type annotations for returned types and parameter types of all functions. For that I created a separate tslint config that extends my m...
Jermayne asked 28/2, 2019 at 9:0

1

I have a tslint alert that I want to skip, but as you can see in the image, I use a lot of flags and don't works I also try to exclude the folder in the tslint conf but also don't works. The messa...
Arlin asked 4/8, 2022 at 9:5

3

I have this file in a react native project: import styled, { withTheme } from 'styled-components'; import { BaseText } from '../BaseText'; export interface BodyProps { textAlign?: string; fontSi...

3

Solved

I have an Angular test for some component which uses the directive ngb-pagination from ng-bootstrap. Now, in my test I mock this component as follow: // on next line I get: The selector should be...
Phthalein asked 13/6, 2019 at 20:4

12

Solved

I just started using create-react-app with typescript create-react-app my-app --scripts-version=react-scripts-ts and the default tslint.json configuration does not allow console.log(). How can...
Cornellcornelle asked 23/4, 2018 at 21:54

1

I have a large project with many files. Now I want to use strictTemplates, so I added the following lines in: tsconfig.json ... "angularCompilerOptions": { "fullTemplateTypeCheck...
Cline asked 5/11, 2020 at 14:47

© 2022 - 2024 — McMap. All rights reserved.