Skip to content

Commit aaf6b6e

Browse files
committed
style(prettier): adding automatic formatting and linting
1 parent b7e82c3 commit aaf6b6e

17 files changed

+11501
-9334
lines changed

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package.json
2+
package-lock.json

.prettierrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"singleQuote": true,
3+
"useTabs": false,
4+
"tabWidth": 2,
5+
"semi": true,
6+
"bracketSpacing": true,
7+
"overrides": [
8+
{
9+
"files": "src/**/*.scss",
10+
"options": {
11+
"singleQuote": false
12+
}
13+
}
14+
]
15+
}

.stylelintrc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"extends": ["stylelint-config-standard", "stylelint-config-recommended-scss"],
3+
"rules": {
4+
"order/order": [
5+
"custom-properties",
6+
"declarations"
7+
],
8+
"order/properties-alphabetical-order": true,
9+
"no-empty-source": null,
10+
"selector-type-no-unknown": [
11+
true,
12+
{
13+
"ignore": ["custom-elements", "default-namespace"]
14+
}
15+
],
16+
"selector-pseudo-element-no-unknown": [
17+
true,
18+
{
19+
"ignorePseudoElements": ["ng-deep"]
20+
}
21+
],
22+
"declaration-colon-newline-after": null,
23+
"at-rule-empty-line-before": null,
24+
"block-closing-brace-newline-after": null
25+
},
26+
"plugins": [
27+
"stylelint-order"
28+
]
29+
}

README.md

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Build Status][travis-badge]][travis]
44
[![Coverage Status][coveralls-badge]][coveralls]
55
[![Commitizen friendly][commitizen-badge]][commitizen]
6+
[![code style: prettier][prettier-badge]][prettier-badge-url]
67

78
This project was generated with [Angular CLI][angular-cli] version 1.6.6.
89

@@ -21,6 +22,7 @@ This is a simple library for [Angular][angular], implemented in the [Angular Pac
2122
`yarn add @thisissoon/angular-masonry masonry-layout`
2223

2324
`app.module.ts`
25+
2426
```ts
2527
import { MasonryModule } from '@thisissoon/angular-masonry';
2628

@@ -29,24 +31,25 @@ const masonryProviders = [
2931
];
3032

3133
@NgModule({
32-
imports: [
33-
MasonryModule.forRoot(masonryProviders)
34-
]
34+
imports: [MasonryModule.forRoot(masonryProviders)]
3535
})
36-
export class AppModule { }
36+
export class AppModule {}
3737
```
3838

3939
`angular.json`
4040

4141
Add the Masonry library javascript to your angular cli config
42+
4243
```ts
4344
"scripts": [
4445
"../node_modules/masonry-layout/dist/masonry.pkgd.js"
4546
],
4647
```
4748

4849
#### Universal app (only needed if using platform-server)
50+
4951
`app.server.module.ts`
52+
5053
```ts
5154
import { MasonryModule } from '@thisissoon/angular-masonry';
5255

@@ -57,7 +60,7 @@ import { MasonryModule } from '@thisissoon/angular-masonry';
5760
MasonryModule.forRoot()
5861
]
5962
})
60-
export class AppServerModule { }
63+
export class AppServerModule {}
6164
```
6265

6366
## Example
@@ -68,15 +71,13 @@ A full working example can be found in the [src/app](https://github.com/thisisso
6871

6972
```ts
7073
export class AppComponent implements AfterViewInit, OnDestroy {
71-
72-
@ViewChild('grid')
73-
public grid: ElementRef;
74+
@ViewChild('grid') public grid: ElementRef;
7475

7576
public masonryInstance: MasonryInstance;
7677

7778
public cards = cards;
7879

79-
constructor(@Inject(Masonry) public masonry) { }
80+
constructor(@Inject(Masonry) public masonry) {}
8081

8182
ngAfterViewInit() {
8283
const options: MasonryOptions = {
@@ -99,7 +100,9 @@ export class AppComponent implements AfterViewInit, OnDestroy {
99100
```
100101

101102
### `app.component.css`
103+
102104
Styling is just an example
105+
103106
```css
104107
:host {
105108
display: block;
@@ -118,6 +121,7 @@ Styling is just an example
118121
```
119122

120123
### `app.component.html`
124+
121125
```html
122126
<div class="grid" #grid>
123127
<div class="card" *ngFor="let card of cards">
@@ -164,15 +168,17 @@ To get more help on the Angular CLI use `ng help` or go check out the [Angular C
164168

165169
[travis]: https://travis-ci.org/thisissoon/angular-masonry
166170
[travis-badge]: https://travis-ci.org/thisissoon/angular-masonry.svg?branch=master
167-
[coveralls]:https://coveralls.io/github/thisissoon/angular-masonry?branch=master
168-
[coveralls-badge]:https://coveralls.io/repos/github/thisissoon/angular-masonry/badge.svg?branch=master
169-
[commitizen]:http://commitizen.github.io/cz-cli/
170-
[commitizen-badge]:https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
171-
[conventional-changelog]:https://github.com/conventional-changelog/conventional-changelog
172-
[standard-version]:https://github.com/conventional-changelog/standard-version
173-
[Karma]:https://karma-runner.github.io
174-
[Protractor]:http://www.protractortest.org/
171+
[coveralls]: https://coveralls.io/github/thisissoon/angular-masonry?branch=master
172+
[coveralls-badge]: https://coveralls.io/repos/github/thisissoon/angular-masonry/badge.svg?branch=master
173+
[commitizen]: http://commitizen.github.io/cz-cli/
174+
[commitizen-badge]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
175+
[prettier-badge]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=shield
176+
[prettier-badge-url]: https://github.com/prettier/prettier
177+
[conventional-changelog]: https://github.com/conventional-changelog/conventional-changelog
178+
[standard-version]: https://github.com/conventional-changelog/standard-version
179+
[karma]: https://karma-runner.github.io
180+
[protractor]: http://www.protractortest.org/
175181
[angular]: https://angular.io/
176-
[angular-cli]:https://github.com/angular/angular-cli
177-
[angular-cli-readme]:https://github.com/angular/angular-cli/blob/master/README.md
178-
[masonry]:https://masonry.desandro.com/
182+
[angular-cli]: https://github.com/angular/angular-cli
183+
[angular-cli-readme]: https://github.com/angular/angular-cli/blob/master/README.md
184+
[masonry]: https://masonry.desandro.com/

angular.json

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,9 @@
1616
"main": "src/main.ts",
1717
"tsConfig": "src/tsconfig.app.json",
1818
"polyfills": "src/polyfills.ts",
19-
"assets": [
20-
"src/assets",
21-
"src/favicon.ico"
22-
],
23-
"styles": [
24-
"src/styles.scss"
25-
],
26-
"scripts": [
27-
"node_modules/masonry-layout/dist/masonry.pkgd.js"
28-
],
19+
"assets": ["src/assets", "src/favicon.ico"],
20+
"styles": ["src/styles.scss"],
21+
"scripts": ["node_modules/masonry-layout/dist/masonry.pkgd.js"],
2922
"progress": false
3023
},
3124
"configurations": {
@@ -73,31 +66,17 @@
7366
"polyfills": "src/polyfills.ts",
7467
"tsConfig": "src/tsconfig.spec.json",
7568
"progress": false,
76-
"codeCoverageExclude": [
77-
"src/app/masonry/masonry-ref.ts"
78-
],
79-
"scripts": [
80-
"node_modules/masonry-layout/dist/masonry.pkgd.js"
81-
],
82-
"styles": [
83-
"src/styles.scss"
84-
],
85-
"assets": [
86-
"src/assets",
87-
"src/favicon.ico"
88-
]
69+
"codeCoverageExclude": ["src/app/masonry/masonry-ref.ts"],
70+
"scripts": ["node_modules/masonry-layout/dist/masonry.pkgd.js"],
71+
"styles": ["src/styles.scss"],
72+
"assets": ["src/assets", "src/favicon.ico"]
8973
}
9074
},
9175
"lint": {
9276
"builder": "@angular-devkit/build-angular:tslint",
9377
"options": {
94-
"tsConfig": [
95-
"src/tsconfig.app.json",
96-
"src/tsconfig.spec.json"
97-
],
98-
"exclude": [
99-
"**/node_modules/**"
100-
]
78+
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
79+
"exclude": ["**/node_modules/**"]
10180
}
10281
}
10382
}
@@ -117,12 +96,8 @@
11796
"lint": {
11897
"builder": "@angular-devkit/build-angular:tslint",
11998
"options": {
120-
"tsConfig": [
121-
"e2e/tsconfig.e2e.json"
122-
],
123-
"exclude": [
124-
"**/node_modules/**"
125-
]
99+
"tsConfig": ["e2e/tsconfig.e2e.json"],
100+
"exclude": ["**/node_modules/**"]
126101
}
127102
}
128103
}

karma.conf.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Karma configuration file, see link for more information
22
// https://karma-runner.github.io/1.0/config/configuration-file.html
33

4-
module.exports = function (config) {
4+
module.exports = function(config) {
55
config.set({
66
basePath: '',
77
frameworks: ['jasmine', '@angular-devkit/build-angular'],
@@ -13,19 +13,21 @@ module.exports = function (config) {
1313
require('@angular-devkit/build-angular/plugins/karma'),
1414
require('karma-spec-reporter')
1515
],
16-
client:{
16+
client: {
1717
clearContext: false // leave Jasmine Spec Runner output visible in browser
1818
},
1919
coverageIstanbulReporter: {
20-
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly', 'text-summary' ],
20+
dir: require('path').join(__dirname, 'coverage'),
21+
reports: ['html', 'lcovonly', 'text-summary'],
2122
fixWebpackSourcePaths: true
2223
},
2324
angularCli: {
2425
environment: 'dev'
2526
},
26-
reporters: config.angularCli && config.angularCli.codeCoverage ?
27-
['spec', 'kjhtml', 'coverage-istanbul'] :
28-
['spec', 'kjhtml'],
27+
reporters:
28+
config.angularCli && config.angularCli.codeCoverage
29+
? ['spec', 'kjhtml', 'coverage-istanbul']
30+
: ['spec', 'kjhtml'],
2931
port: 9876,
3032
colors: true,
3133
logLevel: config.LOG_INFO,

0 commit comments

Comments
 (0)