Skip to content

Commit 9f01b76

Browse files
committed
style: added auto formatting and linting using prettier
1 parent 0b7bda2 commit 9f01b76

23 files changed

+7896
-5732
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: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Angular Image Loader
2+
23
[![Build Status][travis-badge]][travis-badge-url]
34
[![Coverage Status][coveralls-badge]][coveralls-badge-url]
45
[![Commitizen friendly][commitizen-badge]][commitizen]
6+
[![code style: prettier][prettier-badge]][prettier-badge-url]
57

68
This project was generated with [Angular CLI][angular-cli] version 1.5.4.
79

@@ -11,7 +13,6 @@ A simple progressive/responsive/lazy loading image library for [Angular][angular
1113

1214
This is a simple library for [Angular][angular], implemented in the [Angular Package Format v5.0][apfv5].
1315

14-
1516
## Install
1617

1718
### via NPM
@@ -20,11 +21,15 @@ This is a simple library for [Angular][angular], implemented in the [Angular Pac
2021

2122
### via Yarn
2223

23-
`yarn add @thisissoon/angular-image-loader @thisissoon/angular-inviewport `
24+
`yarn add @thisissoon/angular-image-loader @thisissoon/angular-inviewport`
2425

2526
`app.module.ts`
27+
2628
```ts
27-
import { ImageLoaderModule, VideoLoaderModule } from '@thisissoon/angular-image-loader';
29+
import {
30+
ImageLoaderModule,
31+
VideoLoaderModule
32+
} from '@thisissoon/angular-image-loader';
2833
import { InViewportModule, WindowRef } from '@thisissoon/angular-inviewport';
2934

3035
// Provide window object for platform browser
@@ -39,10 +44,11 @@ export const providers: Provider[] = [
3944
VideoLoaderModule // Only this import required if using just the video loader
4045
]
4146
})
42-
export class AppModule { }
47+
export class AppModule {}
4348
```
4449

4550
`app.server.module.ts` (Only needed if using Angular Universal)
51+
4652
```ts
4753
import { ImageLoaderModule } from '@thisissoon/angular-image-loader';
4854
import { InViewportModule, WindowRef } from '@thisissoon/angular-inviewport';
@@ -55,10 +61,9 @@ import { InViewportModule, WindowRef } from '@thisissoon/angular-inviewport';
5561
VideoLoaderModule
5662
]
5763
})
58-
export class AppModule { }
64+
export class AppModule {}
5965
```
6066

61-
6267
## Image Loader Example
6368

6469
A working example can be found inside [/src](https://github.com/thisissoon/angular-image-loader/tree/master/src) folder.
@@ -83,7 +88,7 @@ export class AppComponent {
8388
sizes: Breakpoint[] = [
8489
{ size: 'xs', width: 0 },
8590
{ size: 'md', width: 768 },
86-
{ size: 'lg', width: 992 },
91+
{ size: 'lg', width: 992 }
8792
];
8893

8994
image: ResponsiveImage = {
@@ -122,7 +127,7 @@ export class AppComponent {
122127

123128
```css
124129
.foo {
125-
transition: all .35s ease-in-out;
130+
transition: all 0.35s ease-in-out;
126131
}
127132

128133
.sn-image-not-loaded ::ng-deep .img {
@@ -174,22 +179,25 @@ export class AppComponent {
174179
sizes: Breakpoint[] = [
175180
{ size: 'xs', width: 0 },
176181
{ size: 'md', width: 768 },
177-
{ size: 'lg', width: 992 },
182+
{ size: 'lg', width: 992 }
178183
];
179184

180185
video: ResponsiveVideo = {
181186
videos: [
182187
{
183188
size: 'xs',
184-
url: 'http://res.cloudinary.com/thisissoon/video/upload/ac_none,c_fill,h_568,q_80,w_320/v1517616795/demos/jellyfish-25-mbps-hd-hevc.mp4'
189+
url:
190+
'http://res.cloudinary.com/thisissoon/video/upload/ac_none,c_fill,h_568,q_80,w_320/v1517616795/demos/jellyfish-25-mbps-hd-hevc.mp4'
185191
},
186192
{
187193
size: 'md',
188-
url: 'http://res.cloudinary.com/thisissoon/video/upload/ac_none,c_fill,h_1024,q_80,w_768/v1517616795/demos/jellyfish-25-mbps-hd-hevc.mp4'
194+
url:
195+
'http://res.cloudinary.com/thisissoon/video/upload/ac_none,c_fill,h_1024,q_80,w_768/v1517616795/demos/jellyfish-25-mbps-hd-hevc.mp4'
189196
},
190197
{
191198
size: 'lg',
192-
url: 'http://res.cloudinary.com/thisissoon/video/upload/ac_none,c_fill,h_720,q_80,w_1280/v1517616795/demos/jellyfish-25-mbps-hd-hevc.mp4'
199+
url:
200+
'http://res.cloudinary.com/thisissoon/video/upload/ac_none,c_fill,h_720,q_80,w_1280/v1517616795/demos/jellyfish-25-mbps-hd-hevc.mp4'
193201
}
194202
],
195203
poster: {
@@ -199,7 +207,6 @@ export class AppComponent {
199207
}
200208
```
201209

202-
203210
### Check inviewport status manually
204211

205212
```html
@@ -220,7 +227,6 @@ export class AppComponent {
220227
<button (click)="videoEl.checkInViewportStatus()">Check status</button>
221228
```
222229

223-
224230
## Development server
225231

226232
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
@@ -249,24 +255,24 @@ This repo uses [Commitizen CLI][commitizen] and [Conventional Changelog][convent
249255

250256
Run `npm run release` to create a new release. This will use [Standard Version][standard-version] to create a new release. [Standard Version][standard-version] will generate / update the changelog based on commits generated using [Commitizen CLI][commitizen], update the version number following semantic versioning rules and then commit and tag the commit for the release. Simply run `git push --follow-tags origin master`.
251257

252-
253258
## Further help
254259

255260
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README][angular-cli-readme].
256261

257-
258262
[travis-badge]: https://travis-ci.org/thisissoon/angular-image-loader.svg?branch=master
259263
[travis-badge-url]: https://travis-ci.org/thisissoon/angular-image-loader
260264
[coveralls-badge]: https://coveralls.io/repos/github/thisissoon/angular-image-loader/badge.svg?branch=master
261265
[coveralls-badge-url]: https://coveralls.io/github/thisissoon/angular-image-loader?branch=master
266+
[prettier-badge]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=shield
267+
[prettier-badge-url]: https://github.com/prettier/prettier
262268
[angular]: https://angular.io/
263269
[angular-inviewport]: https://github.com/thisissoon/angular-inviewport
264-
[commitizen]:http://commitizen.github.io/cz-cli/
265-
[commitizen-badge]:https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
266-
[conventional-changelog]:https://github.com/conventional-changelog/conventional-changelog
267-
[standard-version]:https://github.com/conventional-changelog/standard-version
268-
[karma]:https://karma-runner.github.io
269-
[protractor]:http://www.protractortest.org/
270-
[angular-cli]:https://github.com/angular/angular-cli
271-
[angular-cli-readme]:https://github.com/angular/angular-cli/blob/master/README.md
272-
[apfv5]:(https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/edit#heading=h.k0mh3o8u5hx)
270+
[commitizen]: http://commitizen.github.io/cz-cli/
271+
[commitizen-badge]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
272+
[conventional-changelog]: https://github.com/conventional-changelog/conventional-changelog
273+
[standard-version]: https://github.com/conventional-changelog/standard-version
274+
[karma]: https://karma-runner.github.io
275+
[protractor]: http://www.protractortest.org/
276+
[angular-cli]: https://github.com/angular/angular-cli
277+
[angular-cli-readme]: https://github.com/angular/angular-cli/blob/master/README.md
278+
[apfv5]: (https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/edit#heading=h.k0mh3o8u5hx)

angular.json

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,8 @@
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-
],
19+
"assets": ["src/assets", "src/favicon.ico"],
20+
"styles": ["src/styles.scss"],
2621
"scripts": []
2722
},
2823
"configurations": {
@@ -70,25 +65,15 @@
7065
"polyfills": "src/polyfills.ts",
7166
"tsConfig": "src/tsconfig.spec.json",
7267
"scripts": [],
73-
"styles": [
74-
"src/styles.scss"
75-
],
76-
"assets": [
77-
"src/assets",
78-
"src/favicon.ico"
79-
]
68+
"styles": ["src/styles.scss"],
69+
"assets": ["src/assets", "src/favicon.ico"]
8070
}
8171
},
8272
"lint": {
8373
"builder": "@angular-devkit/build-angular:tslint",
8474
"options": {
85-
"tsConfig": [
86-
"src/tsconfig.app.json",
87-
"src/tsconfig.spec.json"
88-
],
89-
"exclude": [
90-
"**/node_modules/**"
91-
]
75+
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
76+
"exclude": ["**/node_modules/**"]
9277
}
9378
}
9479
}
@@ -108,12 +93,8 @@
10893
"lint": {
10994
"builder": "@angular-devkit/build-angular:tslint",
11095
"options": {
111-
"tsConfig": [
112-
"e2e/tsconfig.e2e.json"
113-
],
114-
"exclude": [
115-
"**/node_modules/**"
116-
]
96+
"tsConfig": ["e2e/tsconfig.e2e.json"],
97+
"exclude": ["**/node_modules/**"]
11798
}
11899
}
119100
}
@@ -129,4 +110,4 @@
129110
"prefix": "sn"
130111
}
131112
}
132-
}
113+
}

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)