Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fimbul/mimir

Package Overview
Dependencies
Maintainers
2
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fimbul/mimir

Core rules of the Fimbullinter project

  • 0.10.0-dev.20180510
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
311
increased by18.7%
Maintainers
2
Weekly downloads
 
Created
Source

Mímir

Core rules, formatters and configurations of the Fimbullinter project.

npm version npm downloads Renovate enabled CircleCI Build status codecov Join the chat at https://gitter.im/fimbullinter/wotan

Make sure to also read the full documentation of all available modules.

Purpose

This library contains all core rules, formatters and configuration presets of the Fimbullinter project. As a typical user you don't need to explicitly install this package. It's already installed as a dependency of Wotan.

Rules

RuleDescriptionDifference to TSLint rule / Why you should use it
await-async-result:mag: Warns about not using the result of a call to an async function inside async functions.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-only-promise:mag: :wrench: Finds uses of await on non-Promise values. Also checks for await loops.Works for all PromiseLike and Thenable types out of the box without any configuration.
ban-dom-globals:mag: Disallows uses of global variables like name or event. Using these variables is most likely not intended.There's an open PR to add a similar rule to TSLint.
generator-require-yieldRequires at least one yield inside generator functions.There's no similar TSLint rule.
new-parens:wrench: Requires parentheses when invoking constructors.Performance!
no-case-declarationDisallows let, class and enum in case blocks.TSLint has no similar rule, ESLint has no-case-declarations which forbids function declarations as well.
no-debugger:wrench: Bans debugger; statements from your production code.Performance!
no-duplicate-case:mag_right: Detects switch statements where multiple case clauses check for the same value.This implementation tries to infer the value instead of just comparing the source code.
no-duplicate-spread-property:mag: Detects properties in object literals with object spread that are always overridden.TSLint has no such rule.
no-fallthroughPrevents unintentional fallthough in switch statements from one case to another.Allows more comment variants such as fallthrough or fall through.
no-inferred-empty-object:mag: Detects type parameters that are inferred as {} because the compiler cannot infer a type.Really checks every type parameter of function, method and constructor calls. Correctly handles type parameters from JSDoc comments. Recognises type parameter defaults on all merged declarations.
no-invalid-assertion:mag: Disallows asserting a literal type to a different literal type of the same widened type, e.g. 'foo' as 'bar'.TSLint has no similar rule.
no-misused-genericsDetects generic type parameters that cannot be inferred from the functions parameters. It also detects generics that don't enforce any constraint between types.There's no similar TSLint rule.
no-nan-compareDisallows comparing with NaN, use isNaN(number) or Number.isNaN(number) instead.Performance!
no-return-awaitDisallows 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-variableDetects variables that are not initialized and never assigned a value.There's no similar TSLint rule.
no-unreachable-codeDisallows statements that will never be executed.TSLint removed their no-unreachable rule in v4.0.0.
no-unsafe-finallyDisallows control flow statements return, throw, break and continue inside the finally block of a try statement.Performance!
no-unstable-api-useFinds uses of deprecated and experimental variables, classes, properties, functions, signatures, ... requires type informationThis rule checks element accesses (foo[bar]), JSX elements, chained function calls (getFn()()) in addition to what TSLint's deprecation rule does and has more useful error reporting.
no-unused-expressionWarns about side-effect free expressions whose value is not usedThis one is a bit stricter than TSLint's no-unused-expression and checks for loops in addition.
no-unused-labelWarns about labels that are never used or at the wrong position.TSLint only has label-position which doesn't check for unused labels.
no-useless-assertionDetects type assertions that don't change the type or are not necessary in the first place. requires type informationTSLint'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-declareDisallows the declare keyword on statements without runtime value, e.g. declare type T = any;.TSLint has no such rule.
no-useless-initializerDetects unnecessary initialization with undefined and destructuring defaults (requires type information).TSLint's rule no-unnecessary-initializer doesn't fix all parameter initializers and gives false positives for destructuring.
no-useless-jump-labelDetects continue label; and break label; where the label is not necessary.There's no similar TSLint rule.
no-useless-predicateDetects redundant conditions that are either always true or always false. requires type informationCombination of TSLint's strict-type-predicates, typeof-compare and parts of strict-boolean-expressions.
no-useless-spreadDetects redundant array and object spread which can safely be removed.There's no similar TSLint rule.
prefer-constPrefer const for variables that are never reassigned. Use option {destructuring: "any"} if you want to see failures for each identifier of a destructuring, even if not all of them can be constants. The default is {destructuring: "all"}.TSLint's prefer-const rule gives some false positives for merged declarations and variables used in before being declared which results in a compiler error after fixing.
prefer-dot-notationPrefer obj.foo over obj['foo'] where possible.Same as TSLint's no-string-literal rule, but more performant.
prefer-for-ofPrefer for-of loops over regular for loops where possible. requires type informationAvoids the false positives of TSLint's prefer-for-of rule.
prefer-namespace-keywordPrefer namespace foo {} over module foo {} to avoid confusion with ECMAScript modules.Same as TSLint's no-internal-module.
prefer-number-isnanPrefer ES2015's Number.isNaN over the global isNaN mainly for performance. requires type informationNo similar rule in TSLint.
prefer-object-spreadPrefer object spread over Object.assign for copying properties to a new object. requires type informationPerformance, and better handling of parens in fixer and avoids false positives that would cause a compile error when fixed.
return-never-callPrefer return neverReturns(); or throw neverReturns(); over plain calls to neverReturns(); to enable better control flow analysis and type inference.TSLint has no similar rule.
syntaxcheckReports syntax errors as lint errors. This rule is not enabled in wotan:recommended. requires type informationUsed to be part of the deprecated tslint --type-check
trailing-newlineRequires a line break at the end of each file.Nothing fancy here :(
try-catch-return-awaitCompanion of no-return-await because inside a try-catch block you should await returned promises to correctly enter the catch on rejection and/or the finally block after completion. requires type informationTSLint has no similar rule.
typecheckTypeScript's compiler errors as lint errors. This rule is not enabled in wotan:recommended. requires type informationLike the deprecated tslint --type-check but formatted and can be disabled like any other rule.

Formatters

  • stylish
  • json

Configuration Presets

  • wotan:recommended contains recommended builtin rules. This configuration only adds new rules in major versions.
  • wotan:latest contains recommended builtin rules and is updated in minor versions. Be aware that this might cause your build to break.

License

Apache-2.0 © Klaus Meinhardt

Keywords

FAQs

Package last updated on 10 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc