Skip to content

Instantly share code, notes, and snippets.

View keawade's full-sized avatar
🤘

Keith Wade keawade

🤘
View GitHub Profile
@swissmanu
swissmanu / apply-prettier.ts
Created March 21, 2019 07:19
Apply Prettier Schematic
import { Rule, Tree } from '@angular-devkit/schematics';
import * as prettier from 'prettier';
import { Observable } from 'rxjs';
export default function(): Rule {
return (tree: Tree) =>
new Observable<Tree>(o => {
prettier.resolveConfig(process.cwd()).then(prettierConfig => {
if (!prettierConfig) {
o.error(new Error('Could not resolve prettier configuration'));