Skip to content

Commit

Permalink
test: load prettierrc
Browse files Browse the repository at this point in the history
  • Loading branch information
ikatyang committed Feb 15, 2018
1 parent 6738595 commit 740926c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
17 changes: 4 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"@types/jest": "^22.0.0",
"@types/make-dir": "^1.0.1",
"@types/node": "^9.3.0",
"@types/prettier": "^1.5.0",
"@types/prettier": "^1.10.0",
"codelyzer": "4.1.0",
"commitizen": "^2.9.5",
"cz-conventional-changelog": "^2.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
6 changes: 3 additions & 3 deletions tools/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import * as prettier from "prettier";
import * as tslint from "tslint";

export function format(filename: string, source: string) {
return prettier.format(source, { filepath: filename });
const options = prettier.resolveConfig.sync(filename, { editorconfig: false });
return prettier.format(source, { filepath: filename, ...options });
}

export function lint(filename: string, source: string) {
const dirname = path.dirname(filename);

const tslintPath = path.join(dirname, "tslint.json");
const tslintConfig = tslint.Linter.findConfiguration(tslintPath, "")
.results;
const tslintConfig = tslint.Linter.findConfiguration(tslintPath, "").results;
const linter = new tslint.Linter({ fix: false, formatter: "verbose" });

linter.lint(filename, source, tslintConfig);
Expand Down

0 comments on commit 740926c

Please sign in to comment.