Skip to content

Commit bc16e49

Browse files
chore: migrate to eslint
1 parent 8d7dffe commit bc16e49

File tree

90 files changed

+1872
-759
lines changed

Some content is hidden

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

90 files changed

+1872
-759
lines changed

.eslintrc.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": [
4+
"projects/**/*"
5+
],
6+
"overrides": [
7+
{
8+
"files": [
9+
"*.ts"
10+
],
11+
"parserOptions": {
12+
"project": [
13+
"tsconfig.json",
14+
"e2e/tsconfig.json"
15+
],
16+
"createDefaultProgram": true
17+
},
18+
"extends": [
19+
"plugin:@angular-eslint/ng-cli-compat",
20+
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
21+
"plugin:@angular-eslint/template/process-inline-templates"
22+
],
23+
"rules": {
24+
"@angular-eslint/component-selector": [
25+
"error",
26+
{
27+
"type": "element",
28+
"prefix": "app",
29+
"style": "kebab-case"
30+
}
31+
],
32+
"@angular-eslint/directive-selector": [
33+
"error",
34+
{
35+
"type": "attribute",
36+
"prefix": "app",
37+
"style": "camelCase"
38+
}
39+
],
40+
"@typescript-eslint/explicit-member-accessibility": [
41+
"off",
42+
{
43+
"accessibility": "explicit"
44+
}
45+
],
46+
"arrow-parens": [
47+
"off",
48+
"always"
49+
],
50+
"import/order": "off"
51+
}
52+
},
53+
{
54+
"files": [
55+
"*.html"
56+
],
57+
"extends": [
58+
"plugin:@angular-eslint/template/recommended"
59+
],
60+
"rules": {}
61+
}
62+
]
63+
}

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
src
22
example
33
tsconfig.json
4-
tslint.json
54
*.tgz
65
node_modules/*
76
npm-debug.log

angular.json

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,12 @@
115115
}
116116
},
117117
"lint": {
118-
"builder": "@angular-devkit/build-angular:tslint",
118+
"builder": "@angular-eslint/builder:lint",
119119
"options": {
120-
"tsConfig": [
121-
"tsconfig.app.json",
122-
"tsconfig.spec.json",
123-
"e2e/tsconfig.json"
124-
],
125-
"exclude": [
126-
"**/node_modules/**",
127-
"**/projects/**"
128-
],
129-
"tslintConfig": "tslint-prettier.json",
130-
"typeCheck": true
120+
"lintFilePatterns": [
121+
"src/**/*.ts",
122+
"src/**/*.html"
123+
]
131124
}
132125
},
133126
"e2e": {
@@ -166,21 +159,19 @@
166159
}
167160
},
168161
"lint": {
169-
"builder": "@angular-devkit/build-angular:tslint",
162+
"builder": "@angular-eslint/builder:lint",
170163
"options": {
171-
"tsConfig": [
172-
"projects/ngx-openlayers/tsconfig.lib.json",
173-
"projects/ngx-openlayers/tsconfig.spec.json"
174-
],
175-
"exclude": [
176-
"**/node_modules/**"
177-
],
178-
"tslintConfig": "projects/ngx-openlayers/tslint-prettier.json",
179-
"typeCheck": true
164+
"lintFilePatterns": [
165+
"projects/ngx-openlayers/**/*.ts",
166+
"projects/ngx-openlayers/**/*.html"
167+
]
180168
}
181169
}
182170
}
183171
}
184172
},
185-
"defaultProject": "demo-ngx-openlayers"
173+
"defaultProject": "demo-ngx-openlayers",
174+
"cli": {
175+
"defaultCollection": "@angular-eslint/schematics"
176+
}
186177
}

package.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,22 @@
3131
},
3232
"devDependencies": {
3333
"@angular-devkit/build-angular": "~12.2.18",
34+
"@angular-eslint/builder": "13.5.0",
35+
"@angular-eslint/eslint-plugin": "13.5.0",
36+
"@angular-eslint/eslint-plugin-template": "13.5.0",
37+
"@angular-eslint/schematics": "13.5.0",
38+
"@angular-eslint/template-parser": "13.5.0",
3439
"@angular/cli": "~12.2.18",
3540
"@angular/compiler-cli": "~12.2.17",
3641
"@angular/language-service": "~12.2.17",
3742
"@types/jasmine": "~3.8.0",
3843
"@types/node": "^12.11.1",
39-
"codelyzer": "^6.0.0",
44+
"@typescript-eslint/eslint-plugin": "5.27.1",
45+
"@typescript-eslint/parser": "5.27.1",
46+
"eslint": "^8.17.0",
47+
"eslint-plugin-import": "latest",
48+
"eslint-plugin-jsdoc": "latest",
49+
"eslint-plugin-prefer-arrow": "latest",
4050
"jasmine-core": "~3.8.0",
4151
"jasmine-spec-reporter": "~5.0.0",
4252
"karma": "~6.4.1",
@@ -49,9 +59,6 @@
4959
"protractor": "~7.0.0",
5060
"standard-version": "^7.1.0",
5161
"ts-node": "~8.3.0",
52-
"tslint": "~6.1.0",
53-
"tslint-config-prettier": "^1.13.0",
54-
"tslint-plugin-prettier": "^2.3.0",
5562
"typescript": "~4.3.5"
5663
}
5764
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"extends": "../../.eslintrc.json",
3+
"ignorePatterns": [
4+
"!**/*"
5+
],
6+
"overrides": [
7+
{
8+
"files": [
9+
"*.ts"
10+
],
11+
"parserOptions": {
12+
"project": [
13+
"projects/ngx-openlayers/tsconfig.lib.json",
14+
"projects/ngx-openlayers/tsconfig.spec.json"
15+
],
16+
"createDefaultProgram": true
17+
},
18+
"rules": {
19+
"@angular-eslint/component-selector": [
20+
"error",
21+
{
22+
"type": "element",
23+
"prefix": "aol",
24+
"style": "kebab-case"
25+
}
26+
],
27+
"@angular-eslint/directive-selector": [
28+
"error",
29+
{
30+
"type": "attribute",
31+
"prefix": "aol",
32+
"style": "camelCase"
33+
}
34+
],
35+
"@typescript-eslint/explicit-member-accessibility": [
36+
"off",
37+
{
38+
"accessibility": "explicit"
39+
}
40+
],
41+
"arrow-parens": [
42+
"off",
43+
"always"
44+
],
45+
"import/order": "off",
46+
"no-underscore-dangle": "off"
47+
}
48+
},
49+
{
50+
"files": [
51+
"*.html"
52+
],
53+
"rules": {}
54+
}
55+
]
56+
}

projects/ngx-openlayers/src/lib/attributions.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { AfterViewInit, Component, ContentChildren, Host, QueryList } from '@angular/core';
22
import { Attribution } from 'ol/control';
3-
import { SourceComponent } from './sources/source.component';
43
import { AttributionComponent } from './attribution.component';
4+
import { SourceComponent } from './sources/source.component';
55

66
@Component({
77
selector: 'aol-attributions',
88
template: '<ng-content></ng-content>',
99
})
1010
export class AttributionsComponent implements AfterViewInit {
11-
instance: Array<Attribution>;
12-
1311
@ContentChildren(AttributionComponent)
1412
attributions: QueryList<AttributionComponent>;
1513

14+
instance: Array<Attribution>;
15+
1616
constructor(@Host() private source: SourceComponent) {}
1717

1818
/* we can do this at the very end */

projects/ngx-openlayers/src/lib/collectioncoordinates.component.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import { Component, Input, OnChanges, OnInit, Optional, SimpleChanges } from '@angular/core';
2-
import { MapComponent } from './map.component';
2+
import { Coordinate } from 'ol/coordinate';
3+
import { transform } from 'ol/proj';
34
import { GeometryLinestringComponent } from './geom/geometrylinestring.component';
4-
import { GeometryPolygonComponent } from './geom/geometrypolygon.component';
5-
import { GeometryMultiPointComponent } from './geom/geometrymultipoint.component';
65
import { GeometryMultiLinestringComponent } from './geom/geometrymultilinestring.component';
6+
import { GeometryMultiPointComponent } from './geom/geometrymultipoint.component';
77
import { GeometryMultiPolygonComponent } from './geom/geometrymultipolygon.component';
8-
import { Coordinate } from 'ol/coordinate';
9-
import { transform } from 'ol/proj';
8+
import { GeometryPolygonComponent } from './geom/geometrypolygon.component';
9+
import { MapComponent } from './map.component';
1010

1111
@Component({
1212
selector: 'aol-collection-coordinates',
1313
template: ` <div class="aol-collection-coordinates"></div> `,
1414
})
1515
export class CollectionCoordinatesComponent implements OnChanges, OnInit {
16-
private host: any;
17-
private mapSrid = 'EPSG:3857';
18-
1916
@Input()
2017
coordinates: Coordinate[] | Coordinate[][] | Coordinate[][][];
2118
@Input()
2219
srid = 'EPSG:3857';
2320

21+
private host: any;
22+
private mapSrid = 'EPSG:3857';
23+
2424
constructor(
2525
private map: MapComponent,
2626
@Optional() geometryLinestring: GeometryLinestringComponent,

projects/ngx-openlayers/src/lib/controls/attribution.component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import { MapComponent } from '../map.component';
77
template: ``,
88
})
99
export class ControlAttributionComponent implements OnInit, OnDestroy {
10-
public componentType = 'control';
11-
instance: Attribution;
12-
target: Element;
1310
@Input()
1411
collapsible: boolean;
1512

13+
componentType = 'control';
14+
instance: Attribution;
15+
target: Element;
16+
1617
constructor(private map: MapComponent, private element: ElementRef) {}
1718

1819
ngOnInit() {

projects/ngx-openlayers/src/lib/controls/control.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import { Component, ContentChild, OnDestroy, OnInit } from '@angular/core';
22
import { Control } from 'ol/control';
3-
import { MapComponent } from '../map.component';
43
import { ContentComponent } from '../content.component';
5-
import { TileGridComponent } from '../tilegrid.component';
4+
import { MapComponent } from '../map.component';
65

76
@Component({
87
selector: 'aol-control',
98
template: ` <ng-content></ng-content> `,
109
})
1110
export class ControlComponent implements OnInit, OnDestroy {
12-
public componentType = 'control';
13-
instance: Control;
14-
element: Element;
1511
@ContentChild(ContentComponent, { static: true })
1612
content: ContentComponent;
1713

14+
componentType = 'control';
15+
instance: Control;
16+
element: Element;
17+
1818
constructor(private map: MapComponent) {}
1919

2020
ngOnInit() {

projects/ngx-openlayers/src/lib/controls/default.component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Component, OnDestroy, OnInit, Input } from '@angular/core';
2-
import { Control, defaults } from 'ol/control';
1+
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
32
import { Collection } from 'ol';
3+
import { Control, defaults } from 'ol/control';
44
import { Options as AttributionOptions } from 'ol/control/Attribution';
55
import { Options as RotateOptions } from 'ol/control/Rotate';
66
import { Options as ZoomOptions } from 'ol/control/Zoom';
@@ -12,7 +12,6 @@ import { MapComponent } from '../map.component';
1212
template: '',
1313
})
1414
export class DefaultControlComponent implements OnInit, OnDestroy {
15-
instance: Collection<Control>;
1615
@Input()
1716
attribution: boolean;
1817
@Input()
@@ -26,6 +25,8 @@ export class DefaultControlComponent implements OnInit, OnDestroy {
2625
@Input()
2726
zoomOptions: ZoomOptions;
2827

28+
instance: Collection<Control>;
29+
2930
constructor(private map: MapComponent) {}
3031

3132
ngOnInit() {

0 commit comments

Comments
 (0)