Skip to content

Commit fae075c

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

17 files changed

+3851
-1727
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: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Angular Scroll Collapse
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
A simple lightweight library for [Angular][angular] that detects scroll direction and adds a `sn-scrolling-up` or `sn-scrolling-down` class to the element. The library can also detect when the user has scrolled passed the element and apply a `sn-affix` class. Useful for make a element sticky when the user has scrolled beyond it. This library can will also apply `sn-minimise` class after the user has scrolled beyond the height of the element.
79

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

10-
1112
## Install
1213

1314
### via NPM
@@ -19,6 +20,7 @@ This is a simple library for [Angular][angular], implemented in the [Angular Pac
1920
`yarn add @thisissoon/angular-scroll-collapse @thisissoon/angular-inviewport`
2021

2122
`app.module.ts`
23+
2224
```ts
2325
import { InViewportModule, WindowRef } from '@thisissoon/angular-inviewport';
2426
import { ScrollCollapseModule } from '@thisissoon/angular-scroll-collapse';
@@ -31,12 +33,13 @@ import { ScrollCollapseModule } from '@thisissoon/angular-scroll-collapse';
3133
ScrollCollapseModule
3234
]
3335
})
34-
export class AppModule { }
36+
export class AppModule {}
3537
```
3638

3739
`yarn add @thisissoon/angular-scroll-collapse @thisissoon/angular-inviewport`
3840

3941
`app.server.module.ts`
42+
4043
```ts
4144
import { InViewportModule } from '@thisissoon/angular-inviewport';
4245
import { ScrollCollapseModule } from '@thisissoon/angular-scroll-collapse';
@@ -47,10 +50,9 @@ import { ScrollCollapseModule } from '@thisissoon/angular-scroll-collapse';
4750
ScrollCollapseModule
4851
]
4952
})
50-
export class AppServerModule { }
53+
export class AppServerModule {}
5154
```
5255

53-
5456
## Examples
5557

5658
A working example can be found inside [/src](https://github.com/thisissoon/angular-scroll-collapse/tree/master/src) folder.
@@ -66,11 +68,11 @@ A working example can be found inside [/src](https://github.com/thisissoon/angul
6668
```css
6769
.foo {
6870
left: 0;
69-
height : 100px;
71+
height: 100px;
7072
position: fixed;
7173
right: 0;
7274
top: 0;
73-
transition: all .35s ease-in-out;
75+
transition: all 0.35s ease-in-out;
7476
}
7577

7678
.foo.sn-scrolling-down {
@@ -102,7 +104,6 @@ In this scenario the nav element will have the class `sn-affix` added when the u
102104
}
103105
```
104106

105-
106107
### Minimise mode
107108

108109
In this scenario the nav element will have the class `sn-minimise` added when the user scrolls 100px (the original height of the element) down the page.
@@ -117,8 +118,7 @@ In this scenario the nav element will have the class `sn-minimise` added when th
117118
.foo {
118119
left: 0;
119120
height: 100px;
120-
position
121-
right: 0;
121+
positionright: 0;
122122
top: 0;
123123
}
124124

@@ -135,7 +135,6 @@ In this scenario the nav element will have the class `sn-minimise` added when th
135135
</header>
136136
```
137137

138-
139138
## Development server
140139

141140
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.
@@ -168,18 +167,19 @@ Run `npm run release` to create a new release. This will use [Standard Version][
168167

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

171-
172170
[travis-badge]: https://travis-ci.org/thisissoon/angular-scroll-collapse.svg?branch=master
173171
[travis-badge-url]: https://travis-ci.org/thisissoon/angular-scroll-collapse
174172
[coveralls-badge]: https://coveralls.io/repos/github/thisissoon/angular-scroll-collapse/badge.svg?branch=master
175173
[coveralls-badge-url]: https://coveralls.io/github/thisissoon/angular-scroll-collapse?branch=master
174+
[prettier-badge]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=shield
175+
[prettier-badge-url]: https://github.com/prettier/prettier
176176
[angular]: https://angular.io/
177-
[commitizen]:http://commitizen.github.io/cz-cli/
178-
[commitizen-badge]:https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
179-
[conventional-changelog]:https://github.com/conventional-changelog/conventional-changelog
180-
[standard-version]:https://github.com/conventional-changelog/standard-version
181-
[Karma]:https://karma-runner.github.io
182-
[Protractor]:http://www.protractortest.org/
183-
[angular-cli]:https://github.com/angular/angular-cli
184-
[angular-cli-readme]:https://github.com/angular/angular-cli/blob/master/README.md
185-
[apfv5]:https://goo.gl/jB3GVv
177+
[commitizen]: http://commitizen.github.io/cz-cli/
178+
[commitizen-badge]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
179+
[conventional-changelog]: https://github.com/conventional-changelog/conventional-changelog
180+
[standard-version]: https://github.com/conventional-changelog/standard-version
181+
[karma]: https://karma-runner.github.io
182+
[protractor]: http://www.protractortest.org/
183+
[angular-cli]: https://github.com/angular/angular-cli
184+
[angular-cli-readme]: https://github.com/angular/angular-cli/blob/master/README.md
185+
[apfv5]: https://goo.gl/jB3GVv

angular.json

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,8 @@
1717
"tsConfig": "src/tsconfig.app.json",
1818
"polyfills": "src/polyfills.ts",
1919
"progress": false,
20-
"assets": [
21-
"src/assets",
22-
"src/favicon.ico"
23-
],
24-
"styles": [
25-
"src/styles.scss"
26-
],
20+
"assets": ["src/assets", "src/favicon.ico"],
21+
"styles": ["src/styles.scss"],
2722
"scripts": []
2823
},
2924
"configurations": {
@@ -72,25 +67,15 @@
7267
"tsConfig": "src/tsconfig.spec.json",
7368
"progress": false,
7469
"scripts": [],
75-
"styles": [
76-
"src/styles.scss"
77-
],
78-
"assets": [
79-
"src/assets",
80-
"src/favicon.ico"
81-
]
70+
"styles": ["src/styles.scss"],
71+
"assets": ["src/assets", "src/favicon.ico"]
8272
}
8373
},
8474
"lint": {
8575
"builder": "@angular-devkit/build-angular:tslint",
8676
"options": {
87-
"tsConfig": [
88-
"src/tsconfig.app.json",
89-
"src/tsconfig.spec.json"
90-
],
91-
"exclude": [
92-
"**/node_modules/**"
93-
]
77+
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
78+
"exclude": ["**/node_modules/**"]
9479
}
9580
}
9681
}
@@ -110,12 +95,8 @@
11095
"lint": {
11196
"builder": "@angular-devkit/build-angular:tslint",
11297
"options": {
113-
"tsConfig": [
114-
"e2e/tsconfig.e2e.json"
115-
],
116-
"exclude": [
117-
"**/node_modules/**"
118-
]
98+
"tsConfig": ["e2e/tsconfig.e2e.json"],
99+
"exclude": ["**/node_modules/**"]
119100
}
120101
}
121102
}

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)