Skip to content

Commit 19c8fad

Browse files
committed
Major Refactoring
- Remove tslint, add in eslint - Remove unused scss files - Fix linting throughout the codebase - Remove unused e2e code
1 parent 0894e46 commit 19c8fad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+4951
-2574
lines changed

.eslintrc.json

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": [
4+
"projects/**/*",
5+
"schematics/**/*"
6+
],
7+
"overrides": [
8+
{
9+
"files": [
10+
"*.ts"
11+
],
12+
"parserOptions": {
13+
"project": [
14+
"tsconfig.json"
15+
],
16+
"ecmaVersion": 2020,
17+
"ecmaFeatures": {
18+
"impliedStrict": true
19+
},
20+
"createDefaultProgram": false
21+
},
22+
"extends": [
23+
"eslint:recommended",
24+
"plugin:@typescript-eslint/eslint-recommended",
25+
"plugin:@typescript-eslint/recommended",
26+
"plugin:@angular-eslint/ng-cli-compat",
27+
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
28+
"plugin:@angular-eslint/template/process-inline-templates",
29+
"plugin:prettier/recommended"
30+
],
31+
"env": {
32+
"shared-node-browser": true,
33+
"node": true,
34+
"amd": true,
35+
"browser": true,
36+
"jasmine": true
37+
},
38+
"rules": {
39+
"space-in-parens": "off",
40+
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
41+
"lines-around-comment": "off",
42+
"array-bracket-spacing": "off",
43+
"space-before-function-paren": "off",
44+
"computed-property-spacing": "off",
45+
"quotes": ["error","single", { "allowTemplateLiterals": true }],
46+
"consistent-return": ["off"],
47+
"no-param-reassign": ["error", {"ignorePropertyModificationsFor": ["consoleElement"]}],
48+
"no-console": ["warn", {"allow": ["warn", "error"]}],
49+
"prettier/prettier": [
50+
"error",
51+
{
52+
"trailingComma": "none",
53+
"tabWidth": 2,
54+
"semi": true,
55+
"singleQuote": true,
56+
"endOfLine":"auto"
57+
}
58+
],
59+
"@angular-eslint/directive-selector": [
60+
"error",
61+
{
62+
"type": "attribute",
63+
"prefix": "ngx-daterangepicker-material",
64+
"style": "camelCase"
65+
}
66+
],
67+
"@angular-eslint/component-selector": [
68+
"error",
69+
{
70+
"type": "element",
71+
"prefix": "ngx-daterangepicker-material",
72+
"style": "kebab-case"
73+
}
74+
]
75+
}
76+
},
77+
// NOTE: We are not applying prettier in this override, only @angular-eslint/template,
78+
{
79+
"files": ["*.html"],
80+
"extends": [
81+
"plugin:@angular-eslint/template/recommended"
82+
],
83+
"rules": {}
84+
},
85+
// NOTE: we are not applying @angular-eslint/template in this override, only prettier
86+
{
87+
"files": [
88+
"*.html"
89+
],
90+
"excludedFiles": [
91+
"*inline-template-*.component.html"
92+
],
93+
"extends": [
94+
"plugin:prettier/recommended"
95+
],
96+
"rules": {
97+
// NOTE: we are overriding the default config to always set the parser to angular (see below)
98+
"prettier/prettier": [
99+
"error",
100+
{
101+
"parser": "angular",
102+
"bracketSameLine": true
103+
}
104+
]
105+
}
106+
}
107+
]
108+
}

.naverc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14.19.3

angular.json

+8-33
Original file line numberDiff line numberDiff line change
@@ -87,39 +87,11 @@
8787
}
8888
},
8989
"lint": {
90-
"builder": "@angular-devkit/build-angular:tslint",
90+
"builder": "@angular-eslint/builder:lint",
9191
"options": {
92-
"tsConfig": [
93-
"src/tsconfig.app.json",
94-
"src/tsconfig.spec.json"
95-
],
96-
"exclude": [
97-
"**/node_modules/**"
98-
]
99-
}
100-
}
101-
}
102-
},
103-
"ngx-daterangepicker-material-e2e": {
104-
"root": "demo/e2e",
105-
"sourceRoot": "demo/e2e",
106-
"projectType": "application",
107-
"architect": {
108-
"e2e": {
109-
"builder": "@angular-devkit/build-angular:protractor",
110-
"options": {
111-
"protractorConfig": "./protractor.conf.js",
112-
"devServerTarget": "ngx-daterangepicker-material:serve"
113-
}
114-
},
115-
"lint": {
116-
"builder": "@angular-devkit/build-angular:tslint",
117-
"options": {
118-
"tsConfig": [
119-
"e2e/tsconfig.e2e.json"
120-
],
121-
"exclude": [
122-
"**/node_modules/**"
92+
"lintFilePatterns": [
93+
"demo/**/*.ts",
94+
"demo/**/*.html"
12395
]
12496
}
12597
}
@@ -135,5 +107,8 @@
135107
"@schematics/angular:directive": {
136108
"prefix": ""
137109
}
110+
},
111+
"cli": {
112+
"defaultCollection": "@angular-eslint/schematics"
138113
}
139-
}
114+
}

demo/src/.eslintrc.json

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"extends": "../../.eslintrc.json",
3+
"ignorePatterns": [
4+
"!**/*"
5+
],
6+
"overrides": [
7+
{
8+
"files": [
9+
"*.ts"
10+
],
11+
"parserOptions": {
12+
"project": [
13+
"tsconfig.app.json",
14+
"tsconfig.spec.json"
15+
],
16+
"createDefaultProgram": false
17+
},
18+
"rules": {
19+
"@angular-eslint/directive-selector": [
20+
"error",
21+
{
22+
"type": "attribute",
23+
"prefix": "ngx",
24+
"style": "camelCase"
25+
}
26+
],
27+
"@angular-eslint/component-selector": [
28+
"error",
29+
{
30+
"type": "element",
31+
"prefix": "ngx",
32+
"style": "kebab-case"
33+
}
34+
]
35+
}
36+
},
37+
{
38+
"files": [
39+
"*.html"
40+
],
41+
"rules": {}
42+
}
43+
]
44+
}

demo/src/app/app.component.html

+17-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
<a class="hide-on-small-only hidden-xs" href="//github.com/fetrarij/ngx-daterangepicker-material" >
2-
<img style="position: absolute; top: 0; right: 0; border: 0; z-index: 2000" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png">
1+
<a class="hide-on-small-only hidden-xs" href="//github.com/fetrarij/ngx-daterangepicker-material">
2+
<img
3+
style="position: absolute; top: 0; right: 0; border: 0; z-index: 2000"
4+
src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67"
5+
alt="Fork me on GitHub"
6+
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" />
37
</a>
48
<nav class="light-blue lighten-1" role="navigation">
5-
<div class="nav-wrapper container">
6-
<ul class="left hide-on-small-only">
7-
<li routerLinkActive="active"><a [routerLink]="['simple']">Simple</a></li>
8-
<li routerLinkActive="active"><a [routerLink]="['single-datepicker']">Single datepicker (fr)</a></li>
9-
<li routerLinkActive="active"><a [routerLink]="['reactive-forms']">Reactive forms</a></li>
10-
<li routerLinkActive="active"><a [routerLink]="['with-timepicker']">With timepicker</a></li>
11-
<li routerLinkActive="active"><a [routerLink]="['custom-ranges']">Custom ranges</a></li>
12-
<li routerLinkActive="active"><a [routerLink]="['full']">Full options</a></li>
13-
</ul>
14-
15-
</div>
9+
<div class="nav-wrapper container">
10+
<ul class="left hide-on-small-only">
11+
<li routerLinkActive="active"><a [routerLink]="['simple']">Simple</a></li>
12+
<li routerLinkActive="active"><a [routerLink]="['single-datepicker']">Single datepicker (fr)</a></li>
13+
<li routerLinkActive="active"><a [routerLink]="['reactive-forms']">Reactive forms</a></li>
14+
<li routerLinkActive="active"><a [routerLink]="['with-timepicker']">With timepicker</a></li>
15+
<li routerLinkActive="active"><a [routerLink]="['custom-ranges']">Custom ranges</a></li>
16+
<li routerLinkActive="active"><a [routerLink]="['full']">Full options</a></li>
17+
</ul>
18+
</div>
1619
</nav>
1720

1821
<div class="container">
19-
<router-outlet></router-outlet>
22+
<router-outlet></router-outlet>
2023
</div>

demo/src/app/app.component.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import { Component,ViewChild } from '@angular/core';
1+
import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'ngx-root',
55
templateUrl: './app.component.html',
66
styleUrls: ['./app.component.scss']
77
})
8-
9-
export class AppComponent {
10-
}
8+
export class AppComponent {}

demo/src/app/app.module.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
33
import { NgModule } from '@angular/core';
44
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
55
import { RouterModule } from '@angular/router';
6-
import { AppRoutes } from './app.routing';
6+
import { appRoutes } from './app.routing';
77
import { MatButtonModule } from '@angular/material/button';
88
import { MatCardModule } from '@angular/material/card';
99
import { MatCheckboxModule } from '@angular/material/checkbox';
@@ -20,7 +20,7 @@ import { SingleDatepickerComponent } from './single-datepicker/single-datepicker
2020
import { CustomRangesComponent } from './custom-ranges/custom-ranges.component';
2121
import { TimepickerComponent } from './timepicker/timepicker.component';
2222
import { ReactiveFormComponent } from './reactive-form/reactive-form.component';
23-
23+
import { MatOptionModule } from '@angular/material/core';
2424

2525
@NgModule({
2626
declarations: [
@@ -48,9 +48,10 @@ import { ReactiveFormComponent } from './reactive-form/reactive-form.component';
4848
applyLabel: 'Okay',
4949
firstDay: 0
5050
}),
51-
RouterModule.forRoot(AppRoutes),
51+
RouterModule.forRoot(appRoutes),
52+
MatOptionModule
5253
],
5354
providers: [],
5455
bootstrap: [AppComponent]
5556
})
56-
export class AppModule { }
57+
export class AppModule {}

demo/src/app/app.routing.ts

+30-30
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,34 @@ import { SingleDatepickerComponent } from './single-datepicker/single-datepicker
66
import { TimepickerComponent } from './timepicker/timepicker.component';
77
import { ReactiveFormComponent } from './reactive-form/reactive-form.component';
88

9-
export const AppRoutes: Routes = [
10-
{
11-
path: '',
12-
redirectTo: 'simple',
13-
pathMatch: 'full'
14-
},
15-
{
16-
path: 'simple',
17-
component: SimpleComponent,
18-
},
19-
{
20-
path: 'single-datepicker',
21-
component: SingleDatepickerComponent,
22-
},
23-
{
24-
path: 'with-timepicker',
25-
component: TimepickerComponent,
26-
},
27-
{
28-
path: 'full',
29-
component: FullComponent,
30-
},
31-
{
32-
path: 'custom-ranges',
33-
component: CustomRangesComponent,
34-
},
35-
{
36-
path: 'reactive-forms',
37-
component: ReactiveFormComponent,
38-
}
9+
export const appRoutes: Routes = [
10+
{
11+
path: '',
12+
redirectTo: 'simple',
13+
pathMatch: 'full'
14+
},
15+
{
16+
path: 'simple',
17+
component: SimpleComponent
18+
},
19+
{
20+
path: 'single-datepicker',
21+
component: SingleDatepickerComponent
22+
},
23+
{
24+
path: 'with-timepicker',
25+
component: TimepickerComponent
26+
},
27+
{
28+
path: 'full',
29+
component: FullComponent
30+
},
31+
{
32+
path: 'custom-ranges',
33+
component: CustomRangesComponent
34+
},
35+
{
36+
path: 'reactive-forms',
37+
component: ReactiveFormComponent
38+
}
3939
];

0 commit comments

Comments
 (0)