Joey Perrott 2cb5f59acc feat(dev-infra): run buildifier formatting and linting via ng-dev (#36842)
In an effort to centralize formatting and linting enforcement into one
location, buildifier is being added as a formatter for ng-dev's format
command.  Allowing for format enforcement for all .bzl, .bazel, WORKSPACE
and BUILD files.

PR Close #36842
2020-05-04 12:45:00 -07:00

30 lines
853 B
TypeScript

/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {getAngularDevConfig} from '../../utils/config';
import {FormatConfig} from '../config';
import {Buildifier} from './buildifier';
import {ClangFormat} from './clang-format';
/**
* Get all defined formatters which are active based on the current loaded config.
*/
export function getActiveFormatters() {
let config = {};
try {
config = getAngularDevConfig<'format', FormatConfig>().format || {};
} catch {
}
return [new Buildifier(config), new ClangFormat(config)].filter(
formatter => formatter.isEnabled());
}
// Rexport symbols used for types elsewhere.
export {Formatter, FormatterAction} from './base-formatter';