@fimbul/bifrost

中文文档
0.24.0发布于 2021/02/20Apache-2.0TypeScriptCommonJS近 30 天下载 23.6万

Compatibility layer for TSLint rules

原始使用文档
文档目录7 节
  1. Purpose
  2. Installation
  3. Using TSLint Rules and Formatters in Wotan
  4. Rules
  5. Formatters
  6. Using Fimbullinter Rules in TSLint
  7. License

Bifröst

Compatiblity layer for TSLint rules and formatters.

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

Allows TSLint rule authors to provide the same rules for Wotan without any refactoring. Although @fimbul/heimdall already allows users to use your rules and formatters in Wotan, they still need to remember to use -m @fimbul/heimdall when running Wotan. You can help these users by providing your rules in a format that Wotan understands without any plugin.

It also provides the exact opposite functionality: using rules originally written for Fimbullinter (wotan) as TSLint rule.

Installation

npm install --save @fimbul/bifrost
# or
yarn add @fimbul/bifrost

Using TSLint Rules and Formatters in Wotan

Rules

Given a TSLint rule my-foo in a file myFooRule.ts, you simply create a file my-foo.ts with the following content:

import {wrapTslintRule} from '@fimbul/bifrost';
import {Rule} from './myFooRule.ts';

const Wrapped = wrapTslintRule(Rule, 'my-foo');
export {Wrapped as Rule};

If you want to use a different directory for your TSLint rules and their Wotan wrapper, you just need to adjust the paths in the above example.

Formatters

Given a TSLint formatter my-foo in a file myFooFormatter.ts, you simply create a file my-foo.ts with the following content:

import {wrapTslintFormatter} from '@fimbul/bifrost';
import {Formatter} from './myFooFormatter.ts';

const Wrapped = wrapTslintFormatter(Formatter);
export {Wrapped as Formatter};

Note that findings with severity suggestion are reported as warning through TSLint formatters.

Using Fimbullinter Rules in TSLint

Given a Fimbullinter rule my-foo in a file my-foo.ts, you simply create a file myFooRule.ts with the following content:

import {wrapRuleForTslint} from '@fimbul/bifrost';
import {Rule} from './my-foo.ts';

const Wrapped = wrapRuleForTslint(Rule);
export {Wrapped as Rule};

License

Apache-2.0 © Klaus Meinhardt

版本与发布记录

@fimbul/bifrost 共发布 61 个版本,首次发布于 2018/02/01;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.24.0latest2021/02/205 年前
0.24.0-dev.202102162021/02/165 年前
0.24.0-dev.202102142021/02/145 年前
0.24.0-dev.202101202021/01/205 年前
0.22.02020/12/095 年前
0.21.02019/06/077 年前

关于 @fimbul/bifrost 的常见问题

@fimbul/bifrost 是什么?

Compatibility layer for TSLint rules

如何安装 @fimbul/bifrost?

在项目目录运行 npm install @fimbul/bifrost,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:tslint(^5.0.0)、typescript(>= 4.0.0 || >= 4.2.0-dev)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fimbul/bifrost 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fimbul/bifrost 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@fimbul/bifrost 可以商用吗?

@fimbul/bifrost 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@fimbul/bifrost 的下载量有多少?

根据 npm 官方下载统计,@fimbul/bifrost 在 2026/10/15 – 2026/11/13 这 30 天内被下载 235,817 次,日均约 7,861 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fimbul/bifrost 还在维护吗?

最新版本 0.24.0 发布于 2021/02/20(5 年前);至今共发布 61 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/02/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。