0.24.0 • Published 3 years ago

@fimbul/mimir v0.24.0

Weekly downloads
145
License
Apache-2.0
Repository
github
Last release
3 years ago

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. It's used internally by Wotan.

Rules

RuleDescriptionDifference to TSLint rule / Why you should use it
await-async-resultWarns about not using the result of a call to an async function inside async functions. requires type informationTSLint'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-promiseFinds uses of await on non-Promise values. Also checks for await loops. requires type informationWorks for all PromiseLike and Thenable types out of the box without any configuration.
generator-require-yieldRequire at least one yield inside generator functions.There's no similar TSLint rule.
no-debuggerBan debugger; statements from your production code.Performance!
no-fallthroughPrevents 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-inferred-empty-objectWarns if a type parameter is inferred as {} because the compiler cannot find any inference site.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-return-awaitWarns 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-unreachable-codeWarns 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.
no-unsafe-finallyForbids 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-nan-compareDon't compare with NaN, use isNaN(number) or Number.isNaN(number) instead.Performance!
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-initializerDetects unnecessary initialization with undefined.TSLint's rule no-unnecessary-initializer doesn't fix all parameter initializers and gives false positives for destructuring.
prefer-dot-notationPrefer obj.foo over obj['foo'] where possible.Same as TSLint's no-string-literal rule, but more performant.
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.
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.TSLint 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

0.24.0

3 years ago

0.23.0

3 years ago

0.22.0

3 years ago

0.21.0

5 years ago

0.20.0

5 years ago

0.19.0

5 years ago

0.18.0

5 years ago

0.17.0

5 years ago

0.16.0

5 years ago

0.15.0

6 years ago

0.14.0

6 years ago

0.13.0

6 years ago

0.12.0

6 years ago

0.11.0

6 years ago

0.10.0

6 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago