Skip to content

Commit fd54415

Browse files
josephperrottAndrewKushnir
authored andcommitted
ci: complete migration to prettier formatting (angular#55580)
Format the remaining unformatted files in the repository PR Close angular#55580
1 parent 49d3062 commit fd54415

File tree

18 files changed

+47
-163
lines changed

18 files changed

+47
-163
lines changed

.devcontainer/recommended-devcontainer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"devondcarew.bazel-code",
99
"gkalpak.aio-docs-utils",
1010
"ms-vscode.vscode-typescript-tslint-plugin",
11-
"xaver.clang-format",
1211
// The following extensions are useful when working on angular.io (i.e. inside the `aio/` directory).
1312
//"angular.ng-template",
1413
//"dbaeumer.vscode-eslint",

.ng-dev/format.mts

Lines changed: 5 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,8 @@ export const format: FormatConfig = {
77
'prettier': {
88
'matchers': [
99
'**/*.{yaml,yml}',
10-
'adev/**/*.{js,ts}',
11-
'devtools/**/*.{js,ts}',
12-
'integration/**/*.{js,ts}',
13-
'tools/**/*.{js,ts}',
14-
'modules/**/*.{js,ts}',
15-
'scripts/**/*.{js,ts}',
16-
'packages/animations/**/*.{js,ts}',
17-
'packages/bazel/**/*.{js,ts}',
18-
'packages/benchpress/**/*.{js,ts}',
19-
'packages/common/**/*.{js,ts}',
20-
'packages/compiler/**/*.{js,ts}',
21-
'packages/compiler-cli/**/*.{js,ts}',
22-
'packages/core/**/*.{js,ts}',
23-
'packages/docs/**/*.{js,ts}',
24-
'packages/elements/**/*.{js,ts}',
25-
'packages/examples/**/*.{js,ts}',
26-
'packages/forms/**/*.{js,ts}',
27-
'packages/language-service/**/*.{js,ts}',
28-
'packages/localize/**/*.{js,ts}',
29-
'packages/platform-browser/**/*.{js,ts}',
30-
'packages/platform-browser-dynamic/**/*.{js,ts}',
31-
'packages/platform-server/**/*.{js,ts}',
32-
'packages/misc/**/*.{js,ts}',
33-
'packages/private/**/*.{js,ts}',
34-
'packages/router/**/*.{js,ts}',
35-
'packages/service-worker/**/*.{js,ts}',
36-
'packages/upgrade/**/*.{js,ts}',
37-
'packages/zone.js/**/*.{js,ts}',
10+
'**/*.{js,ts}',
3811

39-
// Test cases contain non valid code.
40-
'!packages/compiler-cli/test/compliance/test_cases/**/*.{js,ts}',
4112
// Do not format d.ts files as they are generated
4213
'!**/*.d.ts',
4314
// Both third_party and .yarn are directories containing copied code which should
@@ -49,60 +20,10 @@ export const format: FormatConfig = {
4920
'!packages/core/src/i18n/locale_en.ts',
5021
'!packages/common/locales/closure-locale.ts',
5122
'!packages/common/src/i18n/currencies.ts',
52-
],
53-
},
54-
'clang-format': {
55-
'matchers': [
56-
'**/*.{js,ts}',
57-
// TODO: burn down format failures and remove aio and integration exceptions.
58-
'!aio/**',
59-
'!integration/**',
60-
// Both third_party and .yarn are directories containing copied code which should
61-
// not be modified.
62-
'!third_party/**',
63-
'!.yarn/**',
64-
// Do not format d.ts files as they are generated
65-
'!**/*.d.ts',
66-
// Do not format generated ng-dev script
67-
'!dev-infra/ng-dev.js',
68-
'!dev-infra/build-worker.js',
69-
// Do not format compliance test-cases since they must match generated code
70-
'!packages/compiler-cli/test/compliance/test_cases/**/*.js',
71-
// Do not format the locale files which are checked-in for Google3, but generated using
72-
// the `generate-locales-tool` from `packages/common/locales`.
73-
'!packages/core/src/i18n/locale_en.ts',
74-
'!packages/common/locales/closure-locale.ts',
75-
'!packages/common/src/i18n/currencies.ts',
76-
// Temporarily disable formatting for adev
77-
'!adev/**',
78-
79-
// Migrated to prettier
80-
'!devtools/**/*.{js,ts}',
81-
'!tools/**/*.{js,ts}',
82-
'!modules/**/*.{js,ts}',
83-
'!scripts/**/*.{js,ts}',
84-
'!packages/animations/**/*.{js,ts}',
85-
'!packages/bazel/**/*.{js,ts}',
86-
'!packages/benchpress/**/*.{js,ts}',
87-
'!packages/common/**/*.{js,ts}',
88-
'!packages/compiler/**/*.{js,ts}',
89-
'!packages/compiler-cli/**/*.{js,ts}',
90-
'!packages/core/**/*.{js,ts}',
91-
'!packages/docs/**/*.{js,ts}',
92-
'!packages/elements/**/*.{js,ts}',
93-
'!packages/examples/**/*.{js,ts}',
94-
'!packages/forms/**/*.{js,ts}',
95-
'!packages/language-service/**/*.{js,ts}',
96-
'!packages/localize/**/*.{js,ts}',
97-
'!packages/platform-browser/**/*.{js,ts}',
98-
'!packages/platform-browser-dynamic/**/*.{js,ts}',
99-
'!packages/platform-server/**/*.{js,ts}',
100-
'!packages/misc/**/*.{js,ts}',
101-
'!packages/private/**/*.{js,ts}',
102-
'!packages/router/**/*.{js,ts}',
103-
'!packages/service-worker/**/*.{js,ts}',
104-
'!packages/upgrade/**/*.{js,ts}',
105-
'!packages/zone.js/**/*.{js,ts}',
23+
// Test cases contain non valid code.
24+
'!packages/compiler-cli/test/compliance/test_cases/**/*.{js,ts}',
25+
// Ignore AIO as its pending removal.
26+
'!aio/**/*.{js,ts}',
10627
],
10728
},
10829
'buildifier': true,

.vscode/extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
"recommendations": [
77
"BazelBuild.vscode-bazel",
88
"ms-vscode.vscode-typescript-tslint-plugin",
9-
"xaver.clang-format",
109
],
1110
}

.vscode/recommended-settings.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
{
2-
// Format js and ts files on save with `clang-format.executable`
3-
// If `clang-format.executable` is not being used, these two settings should be removed otherwise it will break existing formatting.
4-
// You can instead run `yarn gulp format` to manually format your code.
52
"[javascript]": {
63
"editor.formatOnSave": true,
74
},
85
"[typescript]": {
96
"editor.formatOnSave": true,
107
},
11-
// Please install https://marketplace.visualstudio.com/items?itemName=xaver.clang-format to take advantage of `clang-format` in VSCode.
12-
// (See https://clang.llvm.org/docs/ClangFormat.html for more info `clang-format`.)
13-
"clang-format.executable": "${workspaceRoot}/node_modules/.bin/clang-format",
148
// Exclude third party modules and build artifacts from the editor watchers/searches.
159
"files.watcherExclude": {
1610
"**/.git/objects/**": true,

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ To ensure consistency throughout the source code, keep these rules in mind as yo
207207
* All public API methods **must be documented**.
208208
* We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at **100 characters**.
209209
210-
An automated formatter is available, see [DEVELOPER.md](docs/DEVELOPER.md#clang-format).
210+
An automated formatter is available, see [DEVELOPER.md](docs/DEVELOPER.md#formatting-your-source-code).
211211
212212
213213
## <a name="commit"></a> Commit Message Format

adev/src/content/tutorials/first-app/steps/14-http/src-final/app/home/home.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export class HomeComponent {
4242
return;
4343
}
4444

45-
this.filteredLocationList = this.housingLocationList.filter(
46-
(housingLocation) => housingLocation?.city.toLowerCase().includes(text.toLowerCase()),
45+
this.filteredLocationList = this.housingLocationList.filter((housingLocation) =>
46+
housingLocation?.city.toLowerCase().includes(text.toLowerCase()),
4747
);
4848
}
4949
}

adev/src/content/tutorials/first-app/steps/14-http/src/app/home/home.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export class HomeComponent {
3838
return;
3939
}
4040

41-
this.filteredLocationList = this.housingLocationList.filter(
42-
(housingLocation) => housingLocation?.city.toLowerCase().includes(text.toLowerCase()),
41+
this.filteredLocationList = this.housingLocationList.filter((housingLocation) =>
42+
housingLocation?.city.toLowerCase().includes(text.toLowerCase()),
4343
);
4444
}
4545
}

browser-providers.conf.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ const customLaunchers = {
4343

4444
const sauceAliases = {
4545
'CI_REQUIRED': buildConfiguration('unitTest', 'SL', true),
46-
'CI_OPTIONAL': buildConfiguration('unitTest', 'SL', false)
46+
'CI_OPTIONAL': buildConfiguration('unitTest', 'SL', false),
4747
};
4848

4949
module.exports = {
50-
customLaunchers : customLaunchers,
51-
sauceAliases : sauceAliases,
50+
customLaunchers: customLaunchers,
51+
sauceAliases: sauceAliases,
5252
};
5353

5454
function buildConfiguration(type, target, required) {
5555
return Object.keys(config)
56-
.filter((item) => {
57-
const conf = config[item][type];
58-
return conf.required === required && conf.target === target;
59-
})
60-
.map((item) => target + '_' + item.toUpperCase());
56+
.filter((item) => {
57+
const conf = config[item][type];
58+
return conf.required === required && conf.target === target;
59+
})
60+
.map((item) => target + '_' + item.toUpperCase());
6161
}

devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/property-resolver/directive-property-resolver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ export class DirectivePropertyResolver {
157157
propPointer = inputLabels.has(propName)
158158
? inputProps
159159
: outputLabels.has(propName)
160-
? outputProps
161-
: stateProps;
160+
? outputProps
161+
: stateProps;
162162
propPointer[propName] = this.directiveProperties[propName];
163163
});
164164

docs/CODING_STANDARDS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ built _with_ Angular. (Though you can follow them too if you really want).
77

88
The [Google JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html) is the
99
basis for Angular's coding style, with additional guidance here pertaining to TypeScript. The team
10-
uses `clang-format` to automatically format code; automatic formatting is enforced by CI.
10+
uses `prettier` to automatically format code; automatic formatting is enforced by CI.
1111

1212
## Code practices
1313

0 commit comments

Comments
 (0)