2020-04-24 19:29:53 -04:00
|
|
|
/**
|
|
|
|
* @license
|
2020-05-19 15:08:49 -04:00
|
|
|
* Copyright Google LLC All Rights Reserved.
|
2020-04-24 19:29:53 -04:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2020-05-08 17:51:29 -04:00
|
|
|
import {getFormatConfig} from '../config';
|
2020-04-24 19:29:53 -04:00
|
|
|
|
|
|
|
import {Buildifier} from './buildifier';
|
|
|
|
import {ClangFormat} from './clang-format';
|
2021-04-26 15:45:02 -04:00
|
|
|
import {Prettier} from './prettier';
|
2020-04-24 19:29:53 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get all defined formatters which are active based on the current loaded config.
|
|
|
|
*/
|
|
|
|
export function getActiveFormatters() {
|
2020-05-08 17:51:29 -04:00
|
|
|
const config = getFormatConfig().format;
|
2021-04-26 15:45:02 -04:00
|
|
|
return [
|
|
|
|
new Prettier(config),
|
|
|
|
new Buildifier(config),
|
|
|
|
new ClangFormat(config),
|
|
|
|
].filter((formatter) => formatter.isEnabled());
|
2020-04-24 19:29:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Rexport symbols used for types elsewhere.
|
|
|
|
export {Formatter, FormatterAction} from './base-formatter';
|