比弗罗斯特
TSLint 规则和格式化器的兼容层 .
一定要也读 所有可用模块的完整文档。 。 。 .
目的
允许TSLint规则作者为Wotan提供相同的规则而无需重构.
虽然 @fimbul/heimdall 已允许用户在 Wodan 中使用您的规则和格式化器, 他们仍需要记住使用 -m @fimbul/heimdall 当运行沃坦.
您可以帮助这些用户, 以 Wotan 所理解的格式提供规则, 而没有任何插件 .
它还提供了完全相反的功能:使用Fimbullinter(沃坦语)最初所写的规则作为TSLint规则.
安装
npm install --save @fimbul/bifrost
# or
yarn add @fimbul/bifrost
使用 Wodan 中的 TSLint 规则和格式
规则
鉴于 TSLint 规则 my-foo 在文件中 myFooRule.ts,您只需创建文件 my-foo.ts 内容如下:
import {wrapTslintRule} from '@fimbul/bifrost';
import {Rule} from './myFooRule.ts';
const Wrapped = wrapTslintRule(Rule, 'my-foo');
export {Wrapped as Rule};
如果您想要为您的 TSLint 规则及其 Wotan 包装程序使用不同的目录, 您只需要调整上述示例中的路径 .
格式化器
给一个 TSLint 文件 my-foo 在文件中 myFooFormatter.ts,您只需创建文件 my-foo.ts 内容如下:
import {wrapTslintFormatter} from '@fimbul/bifrost';
import {Formatter} from './myFooFormatter.ts';
const Wrapped = wrapTslintFormatter(Formatter);
export {Wrapped as Formatter};
注意结论严重性 suggestion 报告为 warning 通过 TSLint 格式化器.
使用 TSLint 中的 Fimbullinter 规则
鉴于费姆布尔特规则 my-foo 在文件中 my-foo.ts,您只需创建文件 myFooRule.ts 内容如下:
import {wrapRuleForTslint} from '@fimbul/bifrost';
import {Rule} from './my-foo.ts';
const Wrapped = wrapRuleForTslint(Rule);
export {Wrapped as Rule};
许可证
阿帕奇-2.0 © 克劳斯·梅因哈特