Skip to content

Commit

Permalink
feat(ng-dev/format): support mjs and cjs files with prettier and clan…
Browse files Browse the repository at this point in the history
…g-format (#274)

Adds support for mjs and cjs files with prettier and clang-format in the
ng-dev format command. These files will appear more often in the future
due to us using ESM for heavily.

PR Close #274
  • Loading branch information
devversion authored and josephperrott committed Oct 25, 2021
1 parent 8535ff4 commit 471437d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ng-dev/format/formatters/clang-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ClangFormat extends Formatter {

override binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/clang-format');

override defaultFileMatcher = ['**/*.{t,j}s'];
override defaultFileMatcher = ['**/*.{t,j,cj,mj}s'];

override actions = {
check: {
Expand Down
2 changes: 1 addition & 1 deletion ng-dev/format/formatters/prettier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class Prettier extends Formatter {

override binaryFilePath = join(this.git.baseDir, 'node_modules/.bin/prettier');

override defaultFileMatcher = ['**/*.{t,j}s'];
override defaultFileMatcher = ['**/*.{t,j,cj,mj}s'];

/**
* The configuration path of the prettier config, obtained during construction to prevent needing
Expand Down
4 changes: 2 additions & 2 deletions tools/local-actions/changelog/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -45297,7 +45297,7 @@ var require_clang_format = __commonJS({
super(...arguments);
this.name = "clang-format";
this.binaryFilePath = (0, path_12.join)(this.git.baseDir, "node_modules/.bin/clang-format");
this.defaultFileMatcher = ["**/*.{t,j}s"];
this.defaultFileMatcher = ["**/*.{t,j,cj,mj}s"];
this.actions = {
check: {
commandFlags: `--Werror -n -style=file`,
Expand Down Expand Up @@ -45339,7 +45339,7 @@ var require_prettier = __commonJS({
super(...arguments);
this.name = "prettier";
this.binaryFilePath = (0, path_12.join)(this.git.baseDir, "node_modules/.bin/prettier");
this.defaultFileMatcher = ["**/*.{t,j}s"];
this.defaultFileMatcher = ["**/*.{t,j,cj,mj}s"];
this.configPath = this.config["prettier"] ? (0, child_process_1.spawnSync)(this.binaryFilePath, ["--find-config-path", "."]).stdout.trim() : "";
this.actions = {
check: {
Expand Down

0 comments on commit 471437d

Please sign in to comment.