npm install tslint-config-standard --save-dev
In tslint.json
:
{
"extends": "tslint-config-standard"
}
P.S. Some TSLint rules require the use of --project
to run.
Many TSLint ESLint Rules are incomplete and can use your help!
Apache 2.0
A TSLint config for JavaScript Standard Style
License: Other
npm install tslint-config-standard --save-dev
In tslint.json
:
{
"extends": "tslint-config-standard"
}
P.S. Some TSLint rules require the use of --project
to run.
Many TSLint ESLint Rules are incomplete and can use your help!
Apache 2.0
Great work, thank you. This is more a general question than an issue, still I would appreciate some input:
We currently have a mixture of ts/js files in our project and I'd like to lint the js files with tslint as well.
When using the tslint:recommended
rules, there are jsRules
. tslint-config-standard
and tslint-eslint-rules
provide no jsRules
however.
Is there any package or setting which I could use to have the 'JS Standard Style' linting for js files with tslint?
This rule is now available in tslint: https://palantir.github.io/tslint/rules/space-before-function-paren/
This is only needed as a development dependency, right? README.md is confusing.
Current versions of tslint emit the following deprecation warning:
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
In standard there is an autofix option, any chance we could get this here?
Branch | Build failing π¨ |
---|---|
Dependency | @types/node |
Current Version | 8.0.7 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As @types/node is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Ran into an issue where multiple spaces in a template literal will falsely reports no-multi-spaces. Here is an example:
const test = `${'test'} ` // Note the two spaces after ${'test'}
I traced it down to an issue with the tslint-eslint-rules dependency which has been fixed by the latest version of the package. This should be able to be fixed by updating the tslint-eslint-rules package.
e.g. if (...) return
Currently it throws a warning
standardjs allows spaces or no spaces for object-curlies (https://github.com/standard/eslint-config-standard/blob/master/eslintrc.json#L202). Would it be possible to follow suit for this, too?
Tslint 4 introduced a few breaking changes: https://github.com/palantir/tslint/releases/tag/4.0.0
It would be nice if this package would reflect the same changes in a new version.
Alternately, make tslint-eslint-rules a peer dependency so we can upgrade it independently.
Also, please allow [email protected] as a peer dependency.
And I'm getting this:
Warning: The 'no-use-before-declare' rule requires type checking
There is something in the release notes about it.
Branch | Build failing π¨ |
---|---|
Dependency | @types/node |
Current Version | 8.0.46 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
yr tslint
yarn run v0.28.4
warning package.json: No license field
$ tslint --fix -c tslint.json -p tsconfig.json
WARNING: 'no-unused-variable' lint rule does not need to be set if the 'no-unused-locals' and 'no-unused-parameters' compiler options are enabled.
WARNING: 'no-unused-variable' lint rule does not need to be set if the 'no-unused-locals' and 'no-unused-parameters' compiler options are enabled.
WARNING: 'no-unused-variable' lint rule does not need to be set if the 'no-unused-locals' and 'no-unused-parameters' compiler options are enabled.
Done in 2.31s.
Branch | Build failing π¨ |
---|---|
Dependency | @types/node |
Current Version | 7.0.22 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As @types/node is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
If I use finally
, tslint will throw a warning at compile time: "Promises must be handled proper".
19:5 Promises must be handled appropriately
17 | export default class Home extends Vue {
18 | created () {
> 19 | this.$axios.get('/')
| ^
20 | .then((res: any) => console.log(res))
21 | .catch((error: any) => console.warn(error))
22 | .finally(() => console.log('finally'))
No type errors found
Version: typescript 3.1.6, tslint 5.11.0
Time: 815ms
Everything works fine without finally
.
Please fix it.
I think this rule should be removed. It's not really necessary because no-var-keyword
and also it's very slow to compute
Taken from TSlint docs:
Since most modern TypeScript doesnβt use var, this rule is generally discouraged and is kept around for legacy purposes. It is slow to compute, is not enabled in the built-in configuration presets, and should not be used to inform TSLint design decisions.
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
Should we just disable the rule?
Personally, I'm not a fan of moving lint checks into the compiler, I think... Oh well π€·ββοΈ
Branch | Build failing π¨ |
---|---|
Dependency | typescript |
Current Version | 2.3.2 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As typescript is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
This release include a set of bug fixes reported against TypeScript 2.3.2. For the complete list of fixed issues, check out the fixed issues query for TypeScript 2.3.3.
Download:
The new version differs by 84 commits.
e2cc27b
Update LKG
6b64fee
Add name property to Declaration temporarily
367e072
Merge pull request #15941 from RyanCavanaugh/release-2.3
e01ea0e
Merge branch 'release-2.3' of https://github.com/Microsoft/TypeScript into release-2.3
930e4c5
Add flag to allow local plugin loading
4dc00a2
Update LKG
1788478
Merge branch 'release-2.3' of https://github.com/Microsoft/TypeScript into release-2.3
507dc76
Fix issue with throw in async delegator.
2dd4c8a
Update LKG
9d2656f
Fix #15463: use intersection types to emulate spread in generic react components (#15851)
a0db9ad
Fix issue with throw in async delegator.
8534a5a
Update LKG
6976dda
Address PR
dbae5d2
Add more tests and update baselines
5eb9fd0
getApparentType of the propsType
There are 84 commits in total.
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | tslint |
Current Version | 5.4.3 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As tslint is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
Editor's note: This release features an important bugfix for overlapping fixes when using --project
and --fix
(#2864).
completed-docs
: Add enum-members
option (#2911)no-this-reassignment
(#2931)encoding
closes files correctly (#2958)whitespace
fix whitespace "check-module"
to properly lint and fix errors (#2401) (#2825)whitespace
: now correctly handles dynamic imports introduced in [email protected] (#2924)switch-final-break
: don't fail if break jumps to a label outside of the switch (#2914)no-shadowed-variable
: exempt this
parameter (#2598)prefer-for-of
correctly handles variable scopes and other unrelated identifiers (#2984)no-unused-variable
autofix removes whole import (#2901)-v
option (#2926)no-empty
(#2886)prefer-const
: handle destructuring in for-of loop initializer as if {"destructuring": "all"}
was specified (#2904)no-shadowed-variable
: added checks for other shadowing declarations, e.g. interfaces, classes, type parameters, imports, etc. (#2598)no-shadowed-variable
no longer fails for declarations in the same scope, e.g. var foo; var foo;
. Use the rule no-duplicate-variable
to find such errors. (#2598)Thanks to our contributors!
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Just noticed the configuration points to the one provided by tslint. If you have some rules about indentation you can try the one in the tslint-eslint-rules project: https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terIndentRule.md
It is a port of the one from eslint so I would look at their docs to see the examples of usage.
Since I updated tslint to the newest version (v4.4.2), i got the following errors:
no-unused-variable is deprecated. Use the tsc compiler options --noUnusedParameters and --noUnusedLocals instead.
Could not find implementations for the following rules specified in the configuration:
no-duplicate-key
no-unreachable
Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.
If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.
You should update the rules accordingly...
I have some warnings when I lint my source files:
Warning: The 'await-promise' rule requires type information.
Warning: The 'deprecation' rule requires type information.
Warning: The 'no-floating-promises' rule requires type information.
Warning: The 'no-unnecessary-qualifier' rule requires type information.
Warning: The 'no-unnecessary-type-assertion' rule requires type information.
Warning: The 'strict-type-predicates' rule requires type information.
I does not append with tslint:recommended
.
My environment:
node
version 10.15.0
typescript
version 3.2.4
tslint-config-standard
version 8.0.1
Is it possible to import from both a node_module and type in a single import statement?
import * as React from 'react'; // import from module
import { StatelessComponent } from 'react'; // import from type
Not sure if I should raise here or https://github.com/palantir/tslint/issues
export interface ICodeGenerator {
description: string
elementAdded: (id: string) => string
elementRemoved: (id: string) => string
clickHappened: (queryPath: string) => string
inputTextEdited: (queryPath: string, newValue: string) => string
selectChange: (queryPath: string, event: Event) => string
}
gives error:
Using tslint 5.0.0
Edit closed, I was looking at the d.ts file(
Branch | Build failing π¨ |
---|---|
Dependency | tslint |
Current Version | 5.2.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As tslint is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
prefer-switch
: Change default min-cases
to 3. (#2669)outputAbsolutePaths
option (#2667)prefer-object-spread
(#2624)encoding
(#2368)prefer-conditional-expression
(#2363)indent
support indent size (#2723)object-literal-sort-keys
adds ignore-case
(#2592)quotemark
: Add avoid-template
option (#2766)await-promise
: What's considered a "Promise" is now configurable. (#2661)indent
(#2723)typedef-whitespace
(#2718)variable-name
(#2672)typedef
: Use name or parameters for error location (#2460)object-literal-sort-keys
: check shorthand properties (#2592)space-before-function-paren
: Handle get
/set
accessor (#2700)typedef-whitespace
added checks for arrow function, call and construct signature (#2718)no-object-literal-type-assertion
: Allow cast to any
(#2671)-p
option handles directories (#2756)tsconfig.json
is found next to tslint.json
(#2769)return-undefined
: Treat a return type void | undefined
same as void
(#2731)no-unnecessary-initializer
: Handle BindingElement
anywhere, not just in a VariableDeclaration
. (#2707)jsdoc-format
: correctly handle alignment in files with BOM (#2619)jsdoc-format
: don't treat empty comments (/**/
) as jsdoc (#2619)typedef-whitespace
don't warn for leading whitespace if token is preceded by line break (#2718)jsdoc-format
: fixed error position if line ends with \r\n
(#2619)prefer-switch
: add missing checks for some expressions (#2686)prefer-template
: Allow "a" + "b" + "c"
. (#2741)prefer-const
: fix false positive with variable declared outside of for-of or for-in (#2760)--project
: fix file matching with relative path to tsconfig.json
(#2688)no-default-export
: correctly handle export default abstract class {...}
(#2630)no-mergeable-namespace
: display correct line in error message (#2656)object-literal-sort-keys
: handle object spread correctly (#2592)await-promise
: Consider types derived from a Promise in union types too. (#2661)no-unsafe-any
: Fix bug where number literal in type position was flagged as an unsafe any
. (#2712)Lint.Utils.objectify
(#2764)Thanks to our contributors!
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Hello, as an avid user of this ruleset, how can current users easily migrate to the new ESlint + Typescript parsing ?
For anyone not tracking JS world as their first news outlet:
TSlint is going to die in 2020, long live Typescript
REF: https://eslint.org/blog/2019/01/future-typescript-eslint
Branch | Build failing π¨ |
---|---|
Dependency | tslint |
Current Version | 5.3.2 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
tslint is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you itβs very likely also breaking them.
I recommend you give this issue a very high priority. Iβm sure you can resolve this πͺ
--type-check
CLI option now only enables checking for compiler errors before linting. It is no longer required to enable rules that use the type checker -- only need to supply --project
now.switch-final-break
(#2804)use-default-type-parameter
(#2253)binary-expression-operand-order
(#2805)ban
new options format: allows to specify an optional explanation message for function bans, banning nested methods and using a wildcard for object of a method ban (#2547)no-duplicate-variable
adds check-parameters
option to check if variable has the same name as a parameter (#2597)curly
: "as-needed" option (#2842)no-unbound-method
add option "ignore-static"
(#2751)strict-boolean-expressions
adds allow-boolean-or-undefined
(#2820)object-literal-shorthand
can fix longhand methods (#2558)prefer-object-spread
allows constructor, function and method calls and more as first argument to Object.assign
(#2828)no-unbound-method
walker skips past the parent if it is a cast or parenthesized expression (#2838)object-literal-shorthand
: fixed suggestion for generator functions (#2558)no-unused-variable
rule on Windows (#2819)tslint --project
if allowJs
is set in tsconfig.json (#2823)align
with option "members"
: check members of class expressions; don't check semicolons in classes (#2668)no-inferred-empty-object-type
: fix stack overflow (#2762)semicolon
: don't warn about unnecesary semicolon when it is actually needed, e.g. when followed by type assertion or template string (#2655)space-before-function-paren
: Ignore async arrow function with no parentheses (#2833)no-unsafe-any
: Don't fail on continue label;
(#2830)no-unbound-method
: Allow unbound method to be used as a condition (#2834)no-unsafe-any
: Allow to switch on a value of type any
(#2836)no-unsafe-any
: Don't mark declare global {}
as an unsafe any. (#2839)indent
now checks indentation of expressions inside template strings (#2826)--project
(or -p
) enables rules that require the type checker. --type-check
only checks for errors before linting is no longer required (#2773)deprecation
: error message includes deprecation text if available (#2748)cyclomatic-complexity
: Don't count empty switch case(#2743)strict-boolean-expressions
: Allow any
, and true
and false
literal types (#2758)no-floating-promises
: Allow 'promise.catch()' (#2774)comment-format
no longer excludes comments with triple slash from linting except /// <reference path="..."/>
(#2616)prefer-object-spread
: lint more locations where return value is used. (#2828)semicolon
: option "never"
is now spec compliant (#2655)object-literal-shorthand
handles async functions correctly (#2558)--test
CLI option: allow passing path to tslint.json (#2784)strict-type-predicates
: warn if strictNullChecks is not enabled (#2786)Thanks to our contributors!
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
With this tslint.json
file:
{
"extends": [
"tslint-config-standard"
]
}
Running tslint emits several warnings:
$ npx tslint src/file.ts
Warning: The 'await-promise' rule requires type information.
Warning: The 'deprecation' rule requires type information.
Warning: The 'no-unused-variable' rule requires type information.
Warning: The 'no-use-before-declare' rule requires type information.
Warning: The 'no-floating-promises' rule requires type information.
Warning: The 'no-unnecessary-qualifier' rule requires type information.
Warning: The 'no-unnecessary-type-assertion' rule requires type information.
Warning: The 'strict-type-predicates' rule requires type information.
Note that src/file.ts
contains no lint issues:
$ cat src/file.ts
console.log('Test')
Is there something I'm missing/doing wrong, or are these warnings expected?
Branch | Build failing π¨ |
---|---|
Dependency | tslint |
Current Version | 5.7.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
tslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
typeof-compare
is deprecated because typescript already does that check (#3286)--type-check
is no longer necessary and will be removed in the next major version (#3322)tslint:latest
configuration+ "ban-comma-operator": true, + "jsdoc-format": { + options: "check-multiline-start", + }, + "no-duplicate-switch-case": true, + "no-implicit-dependencies": true, + "no-return-await": true,
linterOptions
configuration field to tslint.json
, which supports a list of exclude
globs to disable linting for a subset of files (#2409)no-return-await
(#3233)no-redundant-jsdoc
(#2754)no-duplicate-switch-case
(#2937)no-implicit-dependencies
(#3343)no-unnecessary-class
(#3119)ban-comma-operator
(#3250)one-line
(#3200)curly
(#3262)jsdoc-format
adds option "check-multiline-start"
to enforce the first line of a multiline JSDoc comment to be empty. (#3181)trailing-comma
adds option "esSpecCompliant"
to make it compatible with the ES spec regarding trailing commas after object/array rest and rest parameters. (#3176)"check-parameter-property"
option for member-access
rule (#3325)"strict-bound-class-methods"
option for semicolon
rule (#3294)"grouped-imports"
option for ordered-imports
rule (#3138)"ignore-blank-lines"
option for no-trailing-whitespace
rule (#3346)"never"
option for object-literal-shorthand
disallows shorthand notation (#3268)"exclude-class-expressions"
option for max-classes-per-file
rule (#3281)no-unnecessary-type-assertion
supports a whitelist of types to ignore (#3257)"module-source-path"
for ordered-imports
allows sorting imports by trailing end of path (#3178)no-empty-interface
allows providing type arguments for extended type (#3260)return-undefined
handles union return types in async functions (#3298)deprecation
checks correct constructor overload (#3203)return-undefined
declared return type takes precedence over contextual type (#3298)inputFilePath
as an optional parameter in Configuration.findConfiguration()
(#3195)return-undefined
fixed regressions: once again allows anything if return type is any
(#3298)only-arrow-functions
allow function if this
is used in parameter initializer (#3315)no-conditional-assignment
: exclude intentional assignments, e.g. inside functions (#2629)no-angle-bracket-type-assertion
fixer adds parentheses when necessary (#3301)no-angle-bracket-type-assertion
fixed order when autofixing consecutive assertions (#3301)vso
formatter no longer duplicates output for fixed failures (#3348)no-unbound-method
: Allow negation of method (#3349)arrow-parens
with option "ban-single-arg-parens"
no longer produces invalid code when fixed (#3247)tslint.json
stopped at the current directory. (#3309)--test
works correctly with any compilerOptions.target
(#3296)whitepace
handles files with BOM and other irregular whitespace (#3305)callable-types
auto fix produces invalid results (#3342)no-string-literal
correctly fix property names with leading underscores (#3184)variable-name
fixed crash on empty variable name (#3292)trailing-comma
fixed crash on arrow function without parens (#3246)space-before-function-paren
for anonymous/arrow generic functions (#3085)no-unused-variable
along with the noUnusedLocals
and noUnusedParameters
compiler options (#3227)no-invalid-this
ignores functions with a this
param (#3267)import-blacklist
also checks exports and dynamic imports (#3258)no-conditional-assignment
added check for conditional (ternary) expressions (#2629)completed-docs
to list doc tags that mark a node as not requiring a documentation body. Tags can also provide a regexp matcher to validate that their contents are docs-valid. (#2415)await-promise
enforces that for-await-of
is only used with AsyncIterable
(#3297)one-line
checks type alias declarations (#3200)deprecation
checks object destructuring (#3318)no-submodule-imports
also checks exports (#3258)restrict-plus-operands
: More specific error message when arguments include strings (#3220)no-unsafe-any
checks more expressions, for example destructuring, yield
, property initializer (#3196)object-literal-sort-keys
: allow grouping of object properties via additional blank lines when using alphabetical ordering. (#3191)colors
module to chalk
module (#3171)no-unused-variable
applies the ignorePattern to imports (#3187)Thanks to our contributors!
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
palantir/tslint#1599 (comment)
This is pertains to a development branch, but it sounds like the change is probably going to be kept.
I'm a developer of SonarTS code analyzer, and we have the tslint extension which can be interesting for you. Most of the rules are built to detect bugs and different suspicious patters, they don't generate false positives, and therefore the extension is a good choice for any code base.
Could you give it a try and then consider adding it to your project if you like it? And if you don't, the feedback will be greatly appreciated :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.