Skip to content

Commit 2675e13

Browse files
authored
Merge pull request #35 from cloudnc/chore/upgrade-angular
2 parents 16ef260 + e0705d8 commit 2675e13

19 files changed

+3713
-4010
lines changed

.eslintrc.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": ["projects/**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts"],
7+
"parserOptions": {
8+
"project": ["tsconfig.json", "e2e/tsconfig.json"],
9+
"createDefaultProgram": true
10+
},
11+
"extends": ["plugin:@angular-eslint/recommended", "plugin:@angular-eslint/template/process-inline-templates"],
12+
"rules": {
13+
"@angular-eslint/component-selector": [
14+
"error",
15+
{
16+
"prefix": "lib",
17+
"style": "kebab-case",
18+
"type": "element"
19+
}
20+
],
21+
"@angular-eslint/directive-selector": [
22+
"error",
23+
{
24+
"prefix": "lib",
25+
"style": "camelCase",
26+
"type": "attribute"
27+
}
28+
]
29+
}
30+
},
31+
{
32+
"files": ["*.html"],
33+
"extends": ["plugin:@angular-eslint/template/recommended"],
34+
"rules": {}
35+
}
36+
]
37+
}

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v1
18-
- name: Use Node.js 12.8
18+
- name: Use Node.js 16
1919
uses: actions/setup-node@v1
2020
with:
21-
node-version: 12.8
21+
node-version: 16
2222
- name: Install dependencies
2323
run: yarn --frozen-lockfile --non-interactive --no-progress
2424
- name: Lint Demo

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ speed-measure-plugin*.json
3232
.history/*
3333

3434
# misc
35+
/.angular/cache
3536
/.sass-cache
3637
/connect.lock
3738
/coverage

angular.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@
2222
"main": "src/main.ts",
2323
"polyfills": "src/polyfills.ts",
2424
"tsConfig": "tsconfig.app.json",
25-
"aot": true,
2625
"assets": ["src/favicon.ico", "src/assets"],
2726
"styles": ["src/styles.scss"],
28-
"scripts": []
27+
"scripts": [],
28+
"vendorChunk": true,
29+
"extractLicenses": false,
30+
"buildOptimizer": false,
31+
"sourceMap": true,
32+
"optimization": false,
33+
"namedChunks": true
2934
},
3035
"configurations": {
3136
"production": {
@@ -55,7 +60,8 @@
5560
}
5661
]
5762
}
58-
}
63+
},
64+
"defaultConfiguration": ""
5965
},
6066
"serve": {
6167
"builder": "@angular-devkit/build-angular:dev-server",
@@ -85,13 +91,6 @@
8591
"styles": ["src/styles.scss"],
8692
"scripts": []
8793
}
88-
},
89-
"lint": {
90-
"builder": "@angular-devkit/build-angular:tslint",
91-
"options": {
92-
"tsConfig": ["tsconfig.app.json", "tsconfig.spec.json"],
93-
"exclude": ["**/node_modules/**"]
94-
}
9594
}
9695
}
9796
},
@@ -122,17 +121,19 @@
122121
}
123122
},
124123
"lint": {
125-
"builder": "@angular-devkit/build-angular:tslint",
124+
"builder": "@angular-eslint/builder:lint",
126125
"options": {
127-
"tsConfig": [
128-
"projects/ngx-observable-lifecycle/tsconfig.lib.json",
129-
"projects/ngx-observable-lifecycle/tsconfig.spec.json"
130-
],
131-
"exclude": ["**/node_modules/**"]
126+
"lintFilePatterns": [
127+
"projects/ngx-observable-lifecycle/**/*.ts",
128+
"projects/ngx-observable-lifecycle/**/*.html"
129+
]
132130
}
133131
}
134132
}
135133
}
136134
},
137-
"defaultProject": "ngx-observable-lifecycle-app"
135+
"defaultProject": "ngx-observable-lifecycle-app",
136+
"cli": {
137+
"defaultCollection": "@angular-eslint/schematics"
138+
}
138139
}

karma.conf.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,25 @@ module.exports = function (config) {
99
require('karma-jasmine'),
1010
require('karma-chrome-launcher'),
1111
require('karma-jasmine-html-reporter'),
12-
require('karma-coverage-istanbul-reporter'),
12+
require('karma-coverage'),
1313
require('@angular-devkit/build-angular/plugins/karma'),
1414
],
1515
client: {
16+
jasmine: {
17+
// you can add configuration options for Jasmine here
18+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19+
// for example, you can disable the random execution with `random: false`
20+
// or set a specific seed with `seed: 4321`
21+
},
1622
clearContext: false, // leave Jasmine Spec Runner output visible in browser
1723
},
18-
coverageIstanbulReporter: {
19-
dir: require('path').join(__dirname, './coverage/ngx-observable-lifecycle'),
20-
reports: ['html', 'lcovonly', 'text-summary'],
21-
fixWebpackSourcePaths: true,
24+
jasmineHtmlReporter: {
25+
suppressAll: true, // removes the duplicated traces
26+
},
27+
coverageReporter: {
28+
dir: require('path').join(__dirname, './coverage/test'),
29+
subdir: '.',
30+
reporters: [{ type: 'html' }, { type: 'text-summary' }, { type: 'lcovonly' }],
2231
},
2332
reporters: ['progress', 'kjhtml'],
2433
port: 9876,

package.json

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
"------------------ DEMO COMMANDS -----------------": "",
1414
"demo:start": "yarn run ng serve",
1515
"demo:build:base": "yarn run ng build",
16-
"demo:build:prod": "yarn run demo:build:base --prod",
16+
"demo:build:prod": "yarn run demo:build:base --configuration production",
1717
"demo:test": "yarn run ng test",
1818
"demo:lint:check": "yarn run ng lint",
1919
"demo:lint:fix": "yarn run demo:lint:check --fix",
2020
"------------------ LIB COMMANDS -----------------": "",
21-
"lib:build:prod": "yarn run ng build --project ngx-observable-lifecycle --prod",
21+
"lib:build:prod": "yarn run ng build --project ngx-observable-lifecycle --configuration production",
2222
"lib:build:watch": "yarn run lib:build:prod --watch",
2323
"lib:test:watch": "yarn run ng test --project ngx-observable-lifecycle --code-coverage",
2424
"lib:test:ci": "yarn run ng test --project ngx-observable-lifecycle --watch false --browsers ChromeHeadless --code-coverage",
@@ -30,47 +30,54 @@
3030
"lint:fix": "yarn demo:lint:fix && yarn prettier:write",
3131
"test": "yarn lib:test:watch",
3232
"start": "yarn demo:start",
33-
"commit": "git add . && git-cz"
33+
"commit": "git add . && git-cz",
34+
"lint": "ng lint"
3435
},
3536
"dependencies": {
36-
"@angular/animations": "~11.2.3",
37-
"@angular/common": "~11.2.3",
38-
"@angular/compiler": "~11.2.3",
39-
"@angular/core": "~11.2.3",
40-
"@angular/forms": "~11.2.3",
41-
"@angular/platform-browser": "~11.2.3",
42-
"@angular/platform-browser-dynamic": "~11.2.3",
43-
"@angular/router": "~11.2.3",
37+
"@angular/animations": "~13.0.2",
38+
"@angular/common": "~13.0.2",
39+
"@angular/compiler": "~13.0.2",
40+
"@angular/core": "~13.0.2",
41+
"@angular/forms": "~13.0.2",
42+
"@angular/platform-browser": "~13.0.2",
43+
"@angular/platform-browser-dynamic": "~13.0.2",
44+
"@angular/router": "~13.0.2",
4445
"rxjs": "~6.5.4",
45-
"tslib": "^2.0.0",
46-
"zone.js": "~0.10.2"
46+
"tslib": "^2.3.1",
47+
"zone.js": "~0.11.4"
4748
},
4849
"devDependencies": {
49-
"@angular-devkit/build-angular": "~0.1102.1",
50-
"@angular/cli": "~11.2.1",
51-
"@angular/compiler-cli": "~11.2.3",
52-
"@angular/language-service": "~11.2.3",
50+
"@angular-devkit/build-angular": "~13.0.3",
51+
"@angular-eslint/builder": "13.0.1",
52+
"@angular-eslint/eslint-plugin": "13.0.1",
53+
"@angular-eslint/eslint-plugin-template": "13.0.1",
54+
"@angular-eslint/schematics": "13.0.1",
55+
"@angular-eslint/template-parser": "13.0.1",
56+
"@angular/cli": "~13.0.3",
57+
"@angular/compiler-cli": "~13.0.2",
58+
"@angular/language-service": "~13.0.2",
5359
"@types/jasmine": "~3.6.0",
5460
"@types/jasminewd2": "~2.0.3",
5561
"@types/node": "^12.11.1",
62+
"@typescript-eslint/eslint-plugin": "5.3.0",
63+
"@typescript-eslint/parser": "5.3.0",
5664
"codecov": "^3.7.0",
57-
"codelyzer": "^6.0.0",
5865
"commitizen": "4.1.2",
5966
"embedme": "1.21.0",
67+
"eslint": "^8.2.0",
6068
"jasmine-core": "~3.6.0",
6169
"jasmine-spec-reporter": "~5.0.0",
62-
"karma": "~6.1.1",
70+
"karma": "~6.3.9",
6371
"karma-chrome-launcher": "~3.1.0",
64-
"karma-coverage-istanbul-reporter": "~3.0.2",
72+
"karma-coverage": "~2.0.3",
6573
"karma-jasmine": "~4.0.0",
6674
"karma-jasmine-html-reporter": "^1.5.0",
67-
"ng-packagr": "^11.2.4",
68-
"prettier": "2.0.5",
75+
"ng-packagr": "^13.0.6",
76+
"prettier": "2.4.1",
6977
"protractor": "~7.0.0",
7078
"semantic-release": "^17.2.3",
7179
"ts-node": "~8.3.0",
72-
"tslint": "~6.1.0",
73-
"typescript": "~4.0.3"
80+
"typescript": "~4.4.4"
7481
},
7582
"repository": {
7683
"type": "git",
@@ -81,4 +88,4 @@
8188
"path": "./node_modules/cz-conventional-changelog"
8289
}
8390
}
84-
}
91+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"extends": "../../.eslintrc.json",
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts"],
7+
"parserOptions": {
8+
"project": [
9+
"projects/ngx-observable-lifecycle/tsconfig.lib.json",
10+
"projects/ngx-observable-lifecycle/tsconfig.spec.json"
11+
],
12+
"createDefaultProgram": true
13+
},
14+
"rules": {
15+
"@angular-eslint/directive-selector": [
16+
"error",
17+
{
18+
"type": "attribute",
19+
"prefix": "lib",
20+
"style": "camelCase"
21+
}
22+
],
23+
"@angular-eslint/component-selector": [
24+
"error",
25+
{
26+
"type": "element",
27+
"prefix": "lib",
28+
"style": "kebab-case"
29+
}
30+
]
31+
}
32+
},
33+
{
34+
"files": ["*.html"],
35+
"rules": {}
36+
}
37+
]
38+
}

projects/ngx-observable-lifecycle/karma.conf.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,25 @@ module.exports = function (config) {
99
require('karma-jasmine'),
1010
require('karma-chrome-launcher'),
1111
require('karma-jasmine-html-reporter'),
12-
require('karma-coverage-istanbul-reporter'),
12+
require('karma-coverage'),
1313
require('@angular-devkit/build-angular/plugins/karma'),
1414
],
1515
client: {
16+
jasmine: {
17+
// you can add configuration options for Jasmine here
18+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19+
// for example, you can disable the random execution with `random: false`
20+
// or set a specific seed with `seed: 4321`
21+
},
1622
clearContext: false, // leave Jasmine Spec Runner output visible in browser
1723
},
18-
coverageIstanbulReporter: {
19-
dir: require('path').join(__dirname, '../../coverage/ngx-observable-lifecycle'),
20-
reports: ['html', 'lcovonly', 'text-summary'],
21-
fixWebpackSourcePaths: true,
24+
jasmineHtmlReporter: {
25+
suppressAll: true, // removes the duplicated traces
26+
},
27+
coverageReporter: {
28+
dir: require('path').join(__dirname, '../../coverage/example'),
29+
subdir: '.',
30+
reporters: [{ type: 'html' }, { type: 'text-summary' }, { type: 'lcovonly' }],
2231
},
2332
reporters: ['progress', 'kjhtml'],
2433
port: 9876,

projects/ngx-observable-lifecycle/src/lib/ngx-observable-lifecycle.integration.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('integration', () => {
4242
let onDestroy$Spy: ObserverSpy;
4343
let componentInstanceId = 0;
4444

45-
// tslint:disable:no-conflicting-lifecycle
45+
/* eslint-disable @angular-eslint/no-conflicting-lifecycle */
4646
@Component({
4747
selector: 'lib-test-component',
4848
template: 'test-component',
@@ -57,7 +57,8 @@ describe('integration', () => {
5757
AfterViewInit,
5858
AfterViewChecked,
5959
AfterContentChecked,
60-
AfterContentInit {
60+
AfterContentInit
61+
{
6162
public componentInstanceId = componentInstanceId++;
6263

6364
public ngAfterContentChecked(): void {

projects/ngx-observable-lifecycle/src/lib/ngx-observable-lifecycle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function getSubjectForHook(componentInstance: PatchedComponentInstance<any>, hoo
7070
proto[hooksPatched][hook] = true;
7171
}
7272

73-
// tslint:disable-next-line:no-non-null-assertion - this is definitely defined above
73+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
7474
return componentInstance[hookSubject][hook]!;
7575
}
7676

0 commit comments

Comments
 (0)