tslint

Disable TSLint in VSCode

a 夏天 提交于 2020-03-17 04:17:12
问题 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 with my own configured rules, nothing else. Is it built in TS? I have disabled TSLint extension (even uninstalled it). I have set the following rules: "typescript.format.enable": false, "typescript.validate.enable": false, Still gives me error. How do I turn this off? 回答1: It seems that the error is

Disable TSLint in VSCode

十年热恋 提交于 2020-03-17 04:16:33
问题 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 with my own configured rules, nothing else. Is it built in TS? I have disabled TSLint extension (even uninstalled it). I have set the following rules: "typescript.format.enable": false, "typescript.validate.enable": false, Still gives me error. How do I turn this off? 回答1: It seems that the error is

Typescript : require statement not part of an import statement

和自甴很熟 提交于 2020-02-27 04:31:04
问题 Typescript version 2.2.2 I wrote this require in my UserRoutzr.ts const users = <IUser[]> require(path.join(process.cwd() + "/data")); TSLint is raising the following warning: require statement not part of an import statement if I changed it to : import users = <IUser[]> require(path.join(process.cwd() + "/data")); Then it's raising an error : TS1003 Identifier expected How should I rewrite this require ? thanks for feedback 回答1: TypeScript modules are an implementation of ES6 modules. ES6

React, Typescript, and a setState({ [name]: value }) error

做~自己de王妃 提交于 2020-02-02 13:16:39
问题 I have a couple create-react-app + TypeScript apps that I've been working on over the past few months. At some point (I probably upgraded the lib) tslint started throwing errors on this.setState({ [name]: value }) when state is given a type. It used to let it slide (unless I'm going crazy... not out of the question). The only way to get tslint to shut up about it, is to change the state type to any , which I don't want to do. If I save the file and let yarn start pick up the change, it runs

WebEssentials tslint custom rules

有些话、适合烂在心里 提交于 2020-01-25 07:03:24
问题 I have a tslint.json file in my solution directory and I'm trying to create a custom rule following the guidelines on https://www.npmjs.com/package/tslint I have created a "nonImportsRule.ts", have copied the code from the link and have added "no-imports": true to my tslint.json file however the rule is not being picked up. The guide says that a rulesDirectory needs to be specified, but I have no idea where this should be configured? Also - is it possible to setup Web Essentials to break the

Is there any way to get warnings (not errors) for noImplicitAny noncompliance?

只谈情不闲聊 提交于 2020-01-24 00:59:13
问题 I have a lot of code that I'm porting to Typescript with missing types. For now, I'd like my IDE (WebStorm) to just highlight places that need typing, and I'll slowly get them fixed up. If tsconfig.json had a warning setting for noImplicitAny , that would be ideal. Another alternative would be a tslint rule, but I don't know if the tslint engine is up to this job. Does anyone know of a way to achieve this? 回答1: The Typescript ESLint plugin can do this. Since this question was posted, TSLint

How to disable tslint rule for Angular style guide: “The selector should be prefixed by <prefix>”?

本小妞迷上赌 提交于 2020-01-07 09:25:28
问题 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 prefixed by "<prefix>" (https://angular.io/guide/styleguide#style-02-07) (component-selector) @Component({ template: ``, selector: 'ngb-pagination' }) class DummyNgPagination { // some data here, not relevant in to the question } In the line where it is placed the @Component annotation I get a tslint

UNMET PEER DEPENDENCY @angular/compiler@2.4.5

て烟熏妆下的殇ゞ 提交于 2020-01-06 06:43:06
问题 I am getting that error while doing npm install tslint-sonarts I know the error says I need Compiler version for 2.4.5 I am using "@angular/compiler": "^2.1.0" . I don't want upgrade the version because of i need to change all other dependency version. So i need the correct compatible version of sonarts for "@angular": "^2.1.0", I have checked the release log for that package. I have also tried very old version (SonarTS 1.2.0) of that package. But it still throwing that error. Is any lower

TSLint get rid of missing-whitespace

蓝咒 提交于 2020-01-01 07:38:32
问题 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/content/content.controller.ts [4, 13]: missing whitespace [5, 21]: missing whitespace I want to get rid of the warning Here's an example of the code.... basically anywhere I have a colon for declaring type is where the error is happening. I don't want to put a space between it so I'd like the linter to

TSLint in Visual Studio 2015/2017?

徘徊边缘 提交于 2020-01-01 04:19:10
问题 My organization uses TSLint pretty heavily for quality-checking our Typescript code, and it provides a valuable service to us! However, we use Visual Studio 2015 & 2017 as our main IDE and the only way to get the linting results it to run a gulp/grunt task which prints the output to the Task Runner Explorer console. It works, but it's slow and not the best development experience. In smaller projects on my own I've used VSCode, which has a fantastic TSLint plugin that highlights linting