@fimbul/mimir
Advanced tools
Comparing version 0.7.0-dev.20180327 to 0.7.0-dev.20180328
{ | ||
"name": "@fimbul/mimir", | ||
"version": "0.7.0-dev.20180327", | ||
"version": "0.7.0-dev.20180328", | ||
"description": "Core rules of the Fimbullinter project", | ||
@@ -5,0 +5,0 @@ "main": "recommended.yaml", |
@@ -35,2 +35,3 @@ # Mímir | ||
`no-return-await` | Warns for unnecesary `return await foo;` when you can simply `return foo;` | The same as TSLint's rule. I wrote both, but this one is faster. | ||
`no-unassigned-variable` | Detects variables that are not initialized and never assigned a value. | There's no similar TSLint rule. | ||
`no-unreachable-code` | Warns about statements that will never be executed. Works like TypeScript's dead code detection but doesn't fail compilation because it's a lint error. | TSLint removed their `no-unreachable` rule in v4.0.0. | ||
@@ -37,0 +38,0 @@ `no-unsafe-finally` | Forbids control flow statements `return`, `throw`, `break` and `continue` inside the `finally` block of a try statement. | Performance! |
@@ -7,2 +7,3 @@ "use strict"; | ||
const tsutils_1 = require("tsutils"); | ||
const utils_1 = require("../utils"); | ||
let Rule = class Rule extends ymir_1.ConfigurableRule { | ||
@@ -36,3 +37,3 @@ parseOptions(options) { | ||
const canBeConst = (declaration.initializer !== undefined || tsutils_1.isForInOrOfStatement(parent.parent)) && | ||
variableInfo.uses.every(noReassignment) && | ||
!variableInfo.uses.some(utils_1.isVariableReassignment) && | ||
(kind === 1 || | ||
@@ -133,5 +134,2 @@ variableInfo.declarations.length === 1 && !usedInOuterScopeOrTdz(name, variableInfo.uses)); | ||
} | ||
function noReassignment(use) { | ||
return (use.domain & 4) === 0 || !tsutils_1.isReassignmentTarget(use.location); | ||
} | ||
//# sourceMappingURL=prefer-const.js.map |
import * as ts from 'typescript'; | ||
import { VariableUse } from 'tsutils'; | ||
import { RuleContext } from '@fimbul/ymir'; | ||
@@ -7,1 +8,2 @@ export declare function isStrictNullChecksEnabled(options: ts.CompilerOptions): boolean; | ||
export declare function isAsyncFunction(node: ts.Node): node is ts.FunctionLikeDeclaration; | ||
export declare function isVariableReassignment(use: VariableUse): boolean; |
@@ -40,2 +40,6 @@ "use strict"; | ||
exports.isAsyncFunction = isAsyncFunction; | ||
function isVariableReassignment(use) { | ||
return (use.domain & (4 | 8)) === 4 && tsutils_1.isReassignmentTarget(use.location); | ||
} | ||
exports.isVariableReassignment = isVariableReassignment; | ||
//# sourceMappingURL=utils.js.map |
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
229205
108
2703
68