Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Fix lint x(
Browse files Browse the repository at this point in the history
  • Loading branch information
sandersn committed Apr 19, 2019
1 parent 183b4fe commit db84a80
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/rules/expectRule.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
import { dirname, basename, resolve as resolvePath, join } from "path";
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
import os = require("os");
import { basename, dirname, join, resolve as resolvePath } from "path";
import * as Lint from "tslint";
import * as TsType from "typescript";
import { last } from "../util";
Expand Down Expand Up @@ -42,14 +42,23 @@ export class Rule extends Lint.Rules.TypedRule {

const { tsconfigPath, versionsToTest } = options;

const getFailures = ({ versionName, path }: VersionToTest, nextHigherVersion: string | undefined, writeOutput: boolean) => {
const getFailures = (
{ versionName, path }: VersionToTest,
nextHigherVersion: string | undefined,
writeOutput: boolean,
) => {
const ts = require(path);
const program = getProgram(tsconfigPath, ts, versionName, lintProgram);
const failures = this.applyWithFunction(sourceFile, ctx => walk(ctx, program, ts, versionName, nextHigherVersion));
if (writeOutput) {
const packageName = basename(dirname(tsconfigPath));
if (!packageName.match(/v\d+/) && !packageName.match(/ts\d\.\d/)) {
const d = { [packageName]: { typeCount: (program as any).getTypeCount(), memory: ts.sys.getMemoryUsage ? ts.sys.getMemoryUsage() : 0 } };
const d = {
[packageName]: {
typeCount: (program as any).getTypeCount(),
memory: ts.sys.getMemoryUsage ? ts.sys.getMemoryUsage() : 0,
},
};
if (!existsSync(perfDir)) {
mkdirSync(perfDir);
}
Expand Down

0 comments on commit db84a80

Please sign in to comment.