Skip to content

Commit 20fa663

Browse files
committed
style: setup up automatic formatting and linting rules
1 parent 17dabb9 commit 20fa663

15 files changed

+3936
-1859
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: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
# Angular Infinite Scroll
2+
23
[![Build Status][travis-badge]][travis-badge-url]
34
[![Coverage Status][coveralls-badge]][coveralls-badge-url]
5+
[![code style: prettier][prettier-badge]][prettier-badge-url]
46

57
A simple, lightweight infinite scrolling directive for [Angular][angular] which emits an event when an element has been scrolled to the bottom.
68

79
This is a simple library for [Angular][angular], implemented in the [Angular Package Format v5.0](https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/edit#heading=h.k0mh3o8u5hx).
810

9-
1011
## Install
1112

1213
`npm i @thisissoon/angular-infinite-scroll --save`
1314

1415
`app.module.ts`
16+
1517
```ts
1618
import { InfiniteScrollModule } from '@thisissoon/angular-infinite-scroll';
1719

1820
@NgModule({
19-
imports: [
20-
InfiniteScrollModule
21-
]
21+
imports: [InfiniteScrollModule]
2222
})
23-
export class AppModule { }
23+
export class AppModule {}
2424
```
2525

26-
2726
## Example
2827

2928
A working example can be found inside [/src](https://github.com/thisissoon/angular-infinite-scroll/tree/master/src) folder
@@ -48,15 +47,13 @@ export class AppComponent {
4847
// Do something here
4948
}
5049
}
51-
5250
```
5351

5452
## Options
5553

5654
* `offset` (number): distance in px from bottom of element to trigger `scrollEnd` event (default: 0)
5755
* `disabled` (boolean): If true directive will not trigger `scrollEnd` event
5856

59-
6057
## Development server
6158

6259
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.
@@ -81,10 +78,11 @@ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protrac
8178

8279
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
8380

84-
8581
[travis-badge]: https://travis-ci.org/thisissoon/angular-infinite-scroll.svg?branch=master
8682
[travis-badge-url]: https://travis-ci.org/thisissoon/angular-infinite-scroll
8783
[coveralls-badge]: https://coveralls.io/repos/github/thisissoon/angular-infinite-scroll/badge.svg?branch=master
8884
[coveralls-badge-url]: https://coveralls.io/github/thisissoon/angular-infinite-scroll?branch=master
8985
[angular]: https://angular.io/
9086
[angular-inviewport]: https://github.com/thisissoon/angular-inviewport
87+
[prettier-badge]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=shield
88+
[prettier-badge-url]: https://github.com/prettier/prettier

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)