tslint

tslint error: Asterik in jsdoc must be aligned

半腔热情 提交于 2019-12-23 18:04:29
问题 I keep getting this tslint error and don't see what's wrong with the code. Does anybody see an issues with the jsdoc asteriks below not being aligned correctly: /** * @ngdoc directive * @module ers.components.button * @scope * @transclude * @data * @binding * @name ersButton * @restrict E * @constructor * * @description * * A button performs the defined action when the user clicks it. * * - Buttons can only consist of text and/or an icon. * - Buttons must contain either a click event, an href

tslint how to disable error “someVariable is declared but its value is never read ”

家住魔仙堡 提交于 2019-12-21 03:08:31
问题 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 for the string is declared but its value is never read but didn't find that text. While I can and did look for settings that might be tied to this error, it shouldn't be a guessing game. What is the configuration change needed to suppress/stop this error? Just as importantly, when I get an error in

How to ignore/exclude some files/directory from linting in angular cli

不想你离开。 提交于 2019-12-20 11:09:40
问题 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 "src/app/quote/services/generated/**/*") should not get included at the time of lining. I know this can be done with tslint command as follows (Reference Here) tslint \"src/**/*.ts\" -e \"**/__test__/**\" But in angular cli what will be the parameter? How to exclude some files from tslint? Note: My Angular

Why is tslint:recommended not allowing modules?

≯℡__Kan透↙ 提交于 2019-12-18 12:47:19
问题 We are using typescript v2.3.2 and TSLint v4.5.1 with VS Code to create a SPA. Codebase is growing and we need to modularize it someway. I tried to do the modularization using typescript modules but found the following lint error when transpiling the app. [tslint] 'namespace' and 'module' are disallowed (no-namespace) I'm using this configuration for the linter: { "extends": "tslint:recommended", "rules": { "no-var-requires": false, "no-console": ["error", false], "max-line-length": [false] }

How to ignore a particular directory or file for tslint?

天大地大妈咪最大 提交于 2019-12-17 16:30:14
问题 The IDE being used is WebStorm 11.0.3, the tslint is configured and works, but, it hangs because it tries to parse large *.d.ts library files. Is there a way to ignore a particular file or directory? 回答1: Update for tslint v5.8.0 As mentioned by Saugat Acharya, you can now update tslint.json CLI Options: { "extends": "tslint:latest", "linterOptions": { "exclude": [ "bin", "lib/*generated.js" ] } } More information in this pull request. This feature has been introduced with tslint 3.6 tslint \

What does “No valid rules have been specified for JavaScript files” mean?

让人想犯罪 __ 提交于 2019-12-12 13:20:35
问题 I have a React - Typescript created with: create-react-app my-app --scripts-version=react-scripts-ts It compiles fine, but every time I see this message or warning: No valid rules have been specified for JavaScript files Any ideas how to get rid of it? > react-scripts-ts build Creating an optimized production build... Starting type checking and linting service... Using 1 worker with 2048MB memory limit ts-loader: Using typescript@2.8.3 and /Users/julian/my-app/tsconfig.json No valid rules

How do you ensure there are no non-ASCII characters in TypeScript files?

末鹿安然 提交于 2019-12-11 07:36:02
问题 What is the best way to ensure that there are only ASCII characters in my TypeScript and corresponding JavaScript files? 回答1: There isn't a rule for it yet. Custom rule From : https://github.com/palantir/tslint/#writing-custom-rules The following is one idea: import * as ts from "typescript"; import * as Lint from "tslint/lib/lint"; export class Rule extends Lint.Rules.AbstractRule { public static FAILURE_STRING = "unicode forbidden"; public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[

TSLint: how to disable all style/readability rules

让人想犯罪 __ 提交于 2019-12-11 07:01:13
问题 TL;DR: Is there a way to turn off all TSLint rules that have to do with code style/readability? Barring that, is there a way to turn off all TSLint rules that don't pertain to whether my code will compile properly? Details: I'm using the WebStorm IDE for an Angular project, and it uses TSLint. I like TSLint's real-time warnings/errors, as I am fairly new to JavaScript and the instant feedback streamlines my learning process. However, I don't like how TSLint gives me warnings about style

Why does TFS 2017 Sonar Build Definition gives No valid rules have been specified error?

懵懂的女人 提交于 2019-12-11 04:08:29
问题 I have a TFS 2017 Build definition created for HTML (TypeScript,Javascript) which executes the sonar task and after executing the sonar build definition, i get the Error: No valid rules have been specified message displayed in my build summary. This error get created during Run Code Analysis task in build definition. I did tried googling for the error and found this link enter link description here on Stack Overflow enter link description here on GitHub Where they have advice to add jsRules

How to disable 'Unused import'-warnings on Ionic2 / Angular2

大城市里の小女人 提交于 2019-12-11 01:29:14
问题 I know there is an option to disable those 'Unused Import' warnings give by tslint when running ionic serve or ionic build . But I have no idea where to put it. Does anyone know? Thanks [1] https://palantir.github.io/tslint/rules/no-unused-variable/ 回答1: Ok, that was quick.. Like often. I'm looking for days for a solution, but immediately after I post my question here, I find the solution on my own. So, for all having the same problems during developing, you can set no-unused-variable to