tslint

tslint-loader with webpack 2.1.0-beta.25

旧街凉风 提交于 2019-12-03 11:14:45
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: { quotemark: [true, "double"] } }, // tslint errors are displayed by default as warnings // set emitErrors to true to display them as errors emitErrors: false, // tslint does not interrupt the compilation by default // if you want any file with tslint errors to fail // set failOnHint to true failOnHint: true, // name of your formatter (optional) formatter: "", // path to directory

How to order imports with tslint's import-ordering rule

蹲街弑〆低调 提交于 2019-12-03 01:03:06
On my project tslint's "import-ordering" rule is used import CopyLensModal from './CopyLensModal'; import FetchStatus from '../../../../../state/generic/models/FetchStatus'; import FlexRow from '../../../../generic/components/FlexRow'; import Geofilter from '../../../../../state/geofilter/models/Geofilter'; import Input from '../../../../generic/components/Input'; import * as React from 'react'; import * as salert from 'sweetalert'; import { func } from '../../../../../types/func'; import { Iterable } from 'immutable'; import { Button } from 'react-bootstrap'; tslint is not happy with this

Angular2 - HTTP RequestOptions HEADERS

偶尔善良 提交于 2019-12-02 21:32:43
I currently have an issue with tslint and was hoping someone could point me in the right direction. I'm trying to send an HTTP GET request using HTTP provided by the Angular2 framework. With this request, I must specify the content-type and the bearer authentication token. Example of my code: let headers = new Headers(); let authToken = this._user.getUser().JWT; headers.append('Content-Type', 'application/json'); headers.append('Authorization', `Bearer ${authToken}`); let options = new RequestOptions({ headers: headers }); this._http.get('http://' + url '/', options) .timeout(3000) .subscribe(

Proper explanation for NodeJS/Typescript Export / Import?

帅比萌擦擦* 提交于 2019-12-02 17:40:36
Could someone please explain exactly how exports and imports work in NodeJS using Typescript? My setup is: NodeJS Everything in Typescript TSLint Typings I am messing about with exports/imports instead of doing some proper coding, its driving me nuts, and cannot find any proper explanation of how it works. Import Can you please explain following: var module = require ("module"); import module = require("module"); import module from "module"; import {something} from "module"; import * as module from "module"; Export Can you please explain following export = something; export default something;

Tslint and node-modules errors

半城伤御伤魂 提交于 2019-12-02 04:27:54
I am having problems with running tests of angular using jasmine or cucumber or whatever framework. The app is written in angular 5 that uses typescript and generated by JHipster. The result of running tests is this and it seems to last hours and hours in cmd without any change: C:\Users\67563478\new_workspace\onconsup123\src\test\javascript\spec>yarn test yarn run v1.5.1 $ npm run lint && karma start src/test/javascript/karma.conf.js > oncosup@0.0.0 lint C:\Users\67563478\new_workspace\onconsup123 > tslint --project tsconfig.json -e 'node_modules/**' Hash: e0bdc8cc97632b01d813 Version:

Configure tslint with VS 2015 Update 2

自闭症网瘾萝莉.ら 提交于 2019-12-02 03:22:52
问题 I can't get tslint to work properly in Visual Studio 2015. I should precise that: I have Update 2 installed. I have Web Essentials, but it claims that it doesn't includre linters anymore. I do NOT have Web Analyzers. This is an ASP.NET Core xproj, if that matters. The linter runs: I can see warnings in my error pane and when I right-click a TS file I have a command "Run Web Code Analysis". Now I want to configure the rules by adding a tslint.json file in my project (I tried various places).

Angular 6 ng lint combineLatest is deprecated

廉价感情. 提交于 2019-12-01 15:45:30
I recently updated from Angular 5 to Angular 6. I'm getting this warning combineLatest is deprecated: resultSelector no longer supported, pipe to map instead . Rxjs is version 6.1.0, tslint is 5.10.0, Angular CLI is 6.0.0 and Typescript 2.7.2. I'm using it like this: const a$ = combineLatest( this.aStore.select(b.getAuth), this.cStore.select(b.getUrl), (auth, url) => ({auth, url}), ); I've tried it also like this: empty().pipe( combineLatest(...), ... ) But this gives me: combineLatest is deprecated: Deprecated in favor of static combineLatest and empty is also deprecated in favor of its

Angular 6 ng lint combineLatest is deprecated

99封情书 提交于 2019-12-01 13:46:12
问题 I recently updated from Angular 5 to Angular 6. I'm getting this warning combineLatest is deprecated: resultSelector no longer supported, pipe to map instead . Rxjs is version 6.1.0, tslint is 5.10.0, Angular CLI is 6.0.0 and Typescript 2.7.2. I'm using it like this: const a$ = combineLatest( this.aStore.select(b.getAuth), this.cStore.select(b.getUrl), (auth, url) => ({auth, url}), ); I've tried it also like this: empty().pipe( combineLatest(...), ... ) But this gives me: combineLatest is

How do I determine the result type of a TypeScript.Expression object?

家住魔仙堡 提交于 2019-12-01 12:51:21
When working with the TypeScript abstract syntax tree, how do I determine the result type of a TypeScript.Expression object? I am using TSLint and attempting to find invocations of setTimeout that do not pass an object of type Function as the first parameter. For example, in the following code, I want to know that setTimeout was invoked and that the first parameter is a function. // function that produces a function var createFunction : () => (() => void) = () => {}; // result of createFunction() should be of type function setTimeout(createFunction()); The AST lines up like this: setTimeout ->

What is the preferred declaration convention for objects or arrays: const or let?

谁说我不能喝 提交于 2019-12-01 12:42:05
I'm not asking what's technically possible; I know you can do const a = []; const b = {}; a.push['sup']; b.test = 'earth'; What I'm wondering is whether there's any convention for preferring let over const when it comes to arrays and objects that will have their internals modified. If you see an object declared with const , do you assume the intention was for the object to be immutable, and would you have preferred to see let instead, or, since some linters (like tslint) have a problem with that, is it better just to declare it with const and trust that anyone else reading the code knows that