3 Object.defineProperty(exports, "__esModule", {
7 var _fs = require("fs");
9 var _utils = require("./utils");
11 var _createProgram = require("./create-program");
13 var _createProgram2 = _interopRequireDefault(_createProgram);
15 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18 * @returns true iff output === input
20 var runTsLint = function runTsLint(filepath, fix) {
21 var tslint = (0, _utils.requireModule)((0, _utils.getModulePath)(filepath, "tslint"));
22 var code = (0, _fs.readFileSync)(filepath, "utf8");
23 var config = tslint.Configuration.findConfiguration(null, filepath).results;
25 var program = (0, _createProgram2.default)(filepath);
27 // TODO(azz): This actually writes over the file, we don't really want that...
28 var linter = new tslint.Linter({ fix }, program);
30 linter.lint(filepath, code, config);
31 var result = linter.getResult();
33 // There were no fixes applied
34 return result.fixes.length === 0;
36 // There were no auto-fixable problems
37 return !result.failures.find(function (failure) {
43 exports.default = runTsLint;