@fimbul/wotan
Advanced tools
Comparing version 0.3.0 to 0.4.0-dev.20180227
{ | ||
"name": "@fimbul/wotan", | ||
"version": "0.3.0", | ||
"version": "0.4.0-dev.20180227", | ||
"description": "Pluggable TypeScript and JavaScript linter", | ||
@@ -41,3 +41,3 @@ "bin": "bin/main.js", | ||
"@types/node": "^9.3.0", | ||
"@types/resolve": "^0.0.6", | ||
"@types/resolve": "^0.0.7", | ||
"@types/rimraf": "^2.0.2", | ||
@@ -44,0 +44,0 @@ "@types/semver": "^5.4.0", |
@@ -45,4 +45,6 @@ # wotan | ||
---- | ---- | ---- | ||
`await-async-result` | Warns about not using the result of a call to an async function inside async functions. *requires type information* | TSLint's `no-floating-promises` requires you to specify a list of Promise names, it checks outside of async functions and only requires you to register the `onrejected` callback. | ||
`await-promise` | Finds uses of `await` on non-Promise values. Also checks `for await` loops. *requires type information* | Works for all `PromiseLike` and `Thenable` types out of the box without any configuration. | ||
`deprecation` | Finds uses of deprecated variables, classes, properties, functions, signatures, ... *requires type information* | This rule checks element accesses (`foo[bar]`), JSX elements, chained function calls (`getFn()()`) in addition to what the TSLint rule does and has more useful error reporting. | ||
`generator-yield` | Require at least one `yield` inside generator functions. | There's no similar TSLint rule. | ||
`no-debugger` | Ban `debugger;` statements from your production code. | Performance! | ||
@@ -55,4 +57,6 @@ `no-fallthrough` | Prevents unintentional fallthough in `switch` statements from one case to another. If the fallthrough is intended, add a comment that matches `/^\s*falls? ?through\b/i`. | Allows more comment variants such as `fallthrough` or `fall through`. | ||
`no-unused-label` | Warns about labels that are never used or at the wrong position. | TSLint only has `label-position` which doesn't check for unused labels. | ||
`no-nan-compare` | Don't compare with `NaN`, use `isNaN(number)` or `Number.isNaN(number)` instead. | Performance! | ||
`no-useless-assertion` | Detects type assertions that don't change the type or are not necessary in the first place. *requires type information* | TSLint's `no-unnecessary-type-assertion` does not detect assertions needed to silence the compiler warning `Variable ... is used before being assigned.` The Wotan builtin rule also checks whether the assertion is necessary at all or the receiver accepts the original type. | ||
`no-useless-initializer` | Detects unnecessary initialization with `undefined`. | TSLint's rule `no-unnecessary-initializer` doesn't fix all parameter initializers and gives false positives for destructuring. | ||
`prefer-object-spread` | Prefer object spread over `Object.assign` for copying properties to a new object. | Performance, and better handling of parens in fixer. | ||
`syntaxcheck` | Reports syntax errors as lint errors. This rule is **not** enabled in `wotan:recommended`. *requires type information* | Used to be part of the deprecated `tslint --type-check` | ||
@@ -59,0 +63,0 @@ `trailing-newline` | Requires a line break at the end of each file. | Nothing fancy here :( |
@@ -21,3 +21,3 @@ "use strict"; | ||
else if (tsutils_1.isExpressionStatement(node)) { | ||
if (!isDirective(node)) | ||
if (!isDirective(node) && node.expression.kind !== ts.SyntaxKind.VoidExpression) | ||
this.checkNode(node.expression, node); | ||
@@ -24,0 +24,0 @@ } |
import { AbstractRule } from '../types'; | ||
import * as ts from 'typescript'; | ||
export declare class Rule extends AbstractRule { | ||
static supports(sourceFile: ts.SourceFile): boolean; | ||
apply(): void; | ||
@@ -4,0 +6,0 @@ private checkFunctionParameters(parameters); |
@@ -7,2 +7,5 @@ "use strict"; | ||
class Rule extends types_1.AbstractRule { | ||
static supports(sourceFile) { | ||
return !sourceFile.isDeclarationFile; | ||
} | ||
apply() { | ||
@@ -9,0 +12,0 @@ const isJs = this.sourceFile.flags & ts.NodeFlags.JavaScriptFile; |
@@ -6,2 +6,3 @@ "use strict"; | ||
const ts = require("typescript"); | ||
const rule_utils_1 = require("../rule-utils"); | ||
class Rule extends types_1.TypedRule { | ||
@@ -20,18 +21,10 @@ constructor() { | ||
do { | ||
switch (wrap.kind) { | ||
case ts.SyntaxKind.FunctionDeclaration: | ||
case ts.SyntaxKind.MethodDeclaration: | ||
if (wrap.node.body === undefined) | ||
break; | ||
case ts.SyntaxKind.ArrowFunction: | ||
case ts.SyntaxKind.FunctionExpression: | ||
if (tsutils_1.hasModifier(wrap.node.modifiers, ts.SyntaxKind.AsyncKeyword)) { | ||
this.inTryCatch = false; | ||
wrap.children.forEach(this.visitNode, this); | ||
this.inTryCatch = inTryCatch; | ||
wrap = wrap.skip; | ||
continue; | ||
} | ||
if (!rule_utils_1.isAsyncFunction(wrap.node)) { | ||
wrap = wrap.next; | ||
continue; | ||
} | ||
wrap = wrap.next; | ||
this.inTryCatch = false; | ||
wrap.children.forEach(this.visitNode, this); | ||
this.inTryCatch = inTryCatch; | ||
wrap = wrap.skip; | ||
} while (wrap !== end); | ||
@@ -38,0 +31,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
401317
160
5112
226