Skip to content

Commit f260ed9

Browse files
authored
Merge pull request #48 from SuperITMan/feature/upgrade-prettier-and-reformat-code
Feature/upgrade prettier and reformat code
2 parents 877e2a8 + 157eb76 commit f260ed9

23 files changed

+454
-465
lines changed

.cz-config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ module.exports = {
2626
},
2727
{
2828
value: "ci",
29-
name:
30-
"ci: Changes to our CI configuration files and scripts (example scopes: GitHub Actions, Travis, Circle, BrowserStack, SauceLabs)"
29+
name: "ci: Changes to our CI configuration files and scripts (example scopes: GitHub Actions, Travis, Circle, BrowserStack, SauceLabs)"
3130
},
3231
{
3332
value: "chore",

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.angular/
12
.git/
23
.github/
34
.idea/

.prettierrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require("@nationalbankbelgium/code-style/prettier/2.3.x");
1+
module.exports = require("@nationalbankbelgium/code-style/prettier/3.1.x");

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@
1717

1818
NgxFormErrors is heavily inspired in these projects:
1919

20-
- [valdr](https://github.com/netceteragroup/valdr): a model centric approach to AngularJS form validation
21-
- [ngx-errors](https://github.com/UltimateAngular/ngx-errors): a declarative validation errors library for Angular Reactive Forms
22-
- [ngx-valdemort](https://github.com/Ninja-Squad/ngx-valdemort): consistent validation error messages for Angular Reactive forms
20+
- [valdr](https://github.com/netceteragroup/valdr): a model centric approach to AngularJS form validation
21+
- [ngx-errors](https://github.com/UltimateAngular/ngx-errors): a declarative validation errors library for Angular Reactive Forms
22+
- [ngx-valdemort](https://github.com/Ninja-Squad/ngx-valdemort): consistent validation error messages for Angular Reactive forms
2323

2424
## Why NgxFormErrors?
2525

2626
Let's just have a look at the following example:
2727

2828
### Plain Reactive Forms approach
2929

30+
<!-- prettier-ignore -->
3031
```html
3132
<input type="text" formControlName="foo" />
3233

@@ -48,6 +49,7 @@ This easily becomes messy and cumbersome as soon as you have multiple fields. An
4849

4950
Your component template is cleaner :wink:
5051

52+
<!-- prettier-ignore -->
5153
```html
5254
<input type="text" formControlName="foo" />
5355
<!--or-->
@@ -59,6 +61,7 @@ Your component template is cleaner :wink:
5961

6062
You decide how to display the messages by defining your own Error component :sunglasses:
6163

64+
<!-- prettier-ignore -->
6265
```html
6366
<!-- Error component's template -->
6467

@@ -75,6 +78,7 @@ You decide how to display the messages by defining your own Error component :sun
7578

7679
And the messages are centralized in a service :astonished:
7780

81+
<!-- prettier-ignore -->
7882
```typescript
7983
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
8084
import { NgxFormErrorsMessageService, NgxFormErrorsModule } from "@nationalbankbelgium/ngx-form-errors";
@@ -121,11 +125,11 @@ npm install @nationalbankbelgium/ngx-form-errors
121125

122126
NgxFormErrors is built with [ng-packagr](https://github.com/ng-packagr/ng-packagr) which means that the final package implements the [Angular Package Format](https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/preview) providing the following bundles:
123127

124-
- FESM2015
125-
- FESM5
126-
- ESM2015
127-
- ESM5
128-
- UMD
128+
- FESM2015
129+
- FESM5
130+
- ESM2015
131+
- ESM5
132+
- UMD
129133

130134
So it can be consumed by [Angular CLI](https://github.com/angular/angular-cli), [Webpack](https://github.com/webpack/webpack) or [SystemJS](https://github.com/systemjs/systemjs).
131135

@@ -143,19 +147,19 @@ To know how to release NgxFormErrors, refer to [this page](/RELEASE.md).
143147

144148
### Christopher Cortes
145149

146-
- [@GitHub](https://github.com/christophercr)
150+
- [@GitHub](https://github.com/christophercr)
147151

148152
### Alexis Georges
149153

150-
- [@GitHub](https://github.com/SuperITMan)
154+
- [@GitHub](https://github.com/SuperITMan)
151155

152156
## License
153157

154158
This project and all associated source code is licensed under the terms of the [MIT License](/LICENSE).
155159

156160
## Documentation
157161

158-
- [Developer Guide](/docs/DEV_GUIDE.md)
162+
- [Developer Guide](/docs/DEV_GUIDE.md)
159163

160164
## Thank you notes :)
161165

demo-app/ng12/angular.json

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,10 @@
2222
"main": "src/main.ts",
2323
"polyfills": "src/polyfills.ts",
2424
"tsConfig": "tsconfig.app.json",
25-
"assets": [
26-
"src/favicon.ico",
27-
"src/assets"
28-
],
29-
"styles": [
30-
"node_modules/normalize.css/normalize.css",
31-
"src/styles/styles.scss"
32-
],
25+
"assets": ["src/favicon.ico", "src/assets"],
26+
"styles": ["node_modules/normalize.css/normalize.css", "src/styles/styles.scss"],
3327
"stylePreprocessorOptions": {
34-
"includePaths": [
35-
"src/styles"
36-
]
28+
"includePaths": ["src/styles"]
3729
},
3830
"scripts": [],
3931
"vendorChunk": true,
@@ -100,29 +92,18 @@
10092
"polyfills": "src/polyfills.ts",
10193
"tsConfig": "tsconfig.spec.json",
10294
"karmaConfig": "karma.conf.js",
103-
"styles": [
104-
"node_modules/normalize.css/normalize.css",
105-
"src/styles/styles.scss"
106-
],
95+
"styles": ["node_modules/normalize.css/normalize.css", "src/styles/styles.scss"],
10796
"stylePreprocessorOptions": {
108-
"includePaths": [
109-
"src/styles"
110-
]
97+
"includePaths": ["src/styles"]
11198
},
11299
"scripts": [],
113-
"assets": [
114-
"src/favicon.ico",
115-
"src/assets"
116-
]
100+
"assets": ["src/favicon.ico", "src/assets"]
117101
}
118102
},
119103
"lint": {
120104
"builder": "@angular-eslint/builder:lint",
121105
"options": {
122-
"lintFilePatterns": [
123-
"src/**/*.ts",
124-
"src/**/*.html"
125-
]
106+
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
126107
}
127108
},
128109
"e2e": {
Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,37 @@
1-
import { ComponentFixture, TestBed, waitForAsync} from "@angular/core/testing";
1+
import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
22
import { AppComponent } from "./app.component";
33
import { RouterTestingModule } from "@angular/router/testing";
44
import { NO_ERRORS_SCHEMA } from "@angular/core";
55

66
describe("AppComponent", () => {
7-
let fixture: ComponentFixture<AppComponent>;
8-
let component: AppComponent;
7+
let fixture: ComponentFixture<AppComponent>;
8+
let component: AppComponent;
99

10-
beforeEach(waitForAsync(() => {
11-
return TestBed.configureTestingModule({
12-
imports: [
13-
RouterTestingModule
14-
],
15-
declarations: [
16-
AppComponent
17-
],
18-
schemas: [ NO_ERRORS_SCHEMA ]
19-
}).compileComponents();
20-
}));
10+
beforeEach(waitForAsync(() => {
11+
return TestBed.configureTestingModule({
12+
imports: [RouterTestingModule],
13+
declarations: [AppComponent],
14+
schemas: [NO_ERRORS_SCHEMA]
15+
}).compileComponents();
16+
}));
2117

22-
beforeEach(() => {
23-
fixture = TestBed.createComponent(AppComponent);
24-
component = fixture.componentInstance;
25-
fixture.detectChanges();
26-
});
18+
beforeEach(() => {
19+
fixture = TestBed.createComponent(AppComponent);
20+
component = fixture.componentInstance;
21+
fixture.detectChanges();
22+
});
2723

28-
it("should create the app", () => {
29-
expect(fixture).toBeDefined();
30-
expect(component).toBeDefined();
31-
});
24+
it("should create the app", () => {
25+
expect(fixture).toBeDefined();
26+
expect(component).toBeDefined();
27+
});
3228

33-
it("should render title in a h1 tag", () => {
34-
fixture.detectChanges();
35-
const compiled: HTMLElement = fixture.debugElement.nativeElement;
36-
const h1Element = compiled.querySelector("h1");
37-
expect(h1Element).toBeTruthy();
38-
// tslint:disable-next-line:no-non-null-assertion
39-
expect(h1Element!.textContent).toContain("Ngx-Form-Errors");
40-
});
29+
it("should render title in a h1 tag", () => {
30+
fixture.detectChanges();
31+
const compiled: HTMLElement = fixture.debugElement.nativeElement;
32+
const h1Element = compiled.querySelector("h1");
33+
expect(h1Element).toBeTruthy();
34+
// tslint:disable-next-line:no-non-null-assertion
35+
expect(h1Element!.textContent).toContain("Ngx-Form-Errors");
36+
});
4137
});

demo-app/ng12/src/app/app.module.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,28 @@ import { NgxFormsExampleComponent, ReactiveFormsExampleComponent, TemplateDriven
3939
NavigationComponent,
4040
CardComponent
4141
],
42-
imports: [
43-
BrowserModule,
44-
BrowserAnimationsModule,
45-
AppRoutingModule,
46-
FormsModule,
47-
HttpClientModule,
48-
MatButtonModule,
49-
MatButtonToggleModule,
50-
MatCardModule,
51-
MatFormFieldModule,
52-
MatGridListModule,
53-
MatInputModule,
54-
MatToolbarModule,
55-
MatListModule,
56-
MatSidenavModule,
57-
MatIconModule,
58-
ReactiveFormsModule,
59-
TranslateModule.forRoot(),
60-
NgxFormErrorsModule.forRoot({
61-
formErrorComponent: TranslatedFormErrorComponent
62-
})
63-
],
42+
imports: [
43+
BrowserModule,
44+
BrowserAnimationsModule,
45+
AppRoutingModule,
46+
FormsModule,
47+
HttpClientModule,
48+
MatButtonModule,
49+
MatButtonToggleModule,
50+
MatCardModule,
51+
MatFormFieldModule,
52+
MatGridListModule,
53+
MatInputModule,
54+
MatToolbarModule,
55+
MatListModule,
56+
MatSidenavModule,
57+
MatIconModule,
58+
ReactiveFormsModule,
59+
TranslateModule.forRoot(),
60+
NgxFormErrorsModule.forRoot({
61+
formErrorComponent: TranslatedFormErrorComponent
62+
})
63+
],
6464
exports: [LanguageSelectorComponent],
6565
providers: [],
6666
entryComponents: [SimpleFormErrorComponent, TranslatedFormErrorComponent],

demo-app/ng12/src/app/components/card/card.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,4 @@ export class CardComponent {
3939
break;
4040
}
4141
}
42-
4342
}

demo-app/ng12/src/app/components/card/card.theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@use '~@angular/material' as mat;
1+
@use "~@angular/material" as mat;
22
@mixin card-theme($theme) {
33
$primary: map-get($theme, primary);
44
$accent: map-get($theme, accent);

demo-app/ng12/src/app/components/language-selector/language-selector.theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@use '~@angular/material' as mat;
1+
@use "~@angular/material" as mat;
22
@mixin language-selector-theme($theme) {
33
$primary: map-get($theme, primary);
44

0 commit comments

Comments
 (0)