Paul Gschwendtner b5ab7aff43 refactor: add override keyword to members implementing abstract declarations (#42512)
In combination with the TS `noImplicitOverride` compatibility changes,
we also want to follow the best-practice of adding `override` to
members which are implemented as part of abstract classes. This
commit fixes all instances which will be flagged as part of the
custom `no-implicit-override-abstract` TSLint rule.

PR Close #42512
2021-07-12 13:11:17 -07:00

48 lines
1.2 KiB
TypeScript

/**
* @license
* Copyright Google LLC 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 {join} from 'path';
import {error} from '../../utils/console';
import {Formatter} from './base-formatter';
/**
* Formatter for running clang-format against Typescript and Javascript files
*/
export class ClangFormat extends Formatter {
override name = 'clang-format';
override binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/clang-format');
override defaultFileMatcher = ['**/*.{t,j}s'];
override actions = {
check: {
commandFlags: `--Werror -n -style=file`,
callback:
(_: string, code: number) => {
return code !== 0;
},
},
format: {
commandFlags: `-i -style=file`,
callback:
(file: string, code: number, _: string, stderr: string) => {
if (code !== 0) {
error(`Error running clang-format on: ${file}`);
error(stderr);
error();
return true;
}
return false;
}
}
};
}