首页 > 解决方案 > 对字符串而不是文件运行 tslint --fix

问题描述

我想在字符串的脚本中运行 tslint fix。我想象这样的事情:

import { fixer } from 'tslint'

const stringToFormatAndFix = // some typescript file content

const formatted = fixer(tslintJson, 'file/path/to/tslint.json')

背景:我正在使用tsquery查找接口的最后一个 PropertySignature 并向其附加一个字符串。之后我想根据 tslint.json 自动格式化该文件。因为我使用的是角度示意图并且所有更改都是在虚拟文件系统中进行的,所以我不能只通过它的 cli 运行 tslint。

标签: angulartslintangular-schematics

解决方案


推荐阅读