-
-
Notifications
You must be signed in to change notification settings - Fork 902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: upgrade to angular 13 #1996
feat: upgrade to angular 13 #1996
Conversation
@varnastadeus when you get a chance please review this PR and approve it |
Any idea when Angular 13 support will be available? Kinda desperately need to update to Angular 13 ASAP. Thank you. |
Hopefully soon. @varnastadeus reviewing the code now. |
@pavankjadda That's awesome, thank you! |
@@ -31,16 +34,6 @@ | |||
"src/ng-select/lib/ng-templates.directive.ts" | |||
] | |||
} | |||
}, | |||
"lint": { | |||
"builder": "@angular-devkit/build-angular:tslint", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should eslint not be enabled instead of just dropping tslint? Specifically builder: @angular-eslint/builder:lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like why the CI is failing too since there is now no lint command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pavankjadda can you address this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since angular removed tslint, I think we should add @angular-eslint
to the project and remove tslint. And angular-eslint still adding the support. Perhaps we can add beta version of the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay. I added angular-eslint
to the project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pavankjadda thanks for adding the lint config back, a few questions on it 🙂
"@typescript-eslint/dot-notation": "off", | ||
"@typescript-eslint/explicit-member-accessibility": [ | ||
"off", | ||
{ | ||
"accessibility": "explicit" | ||
} | ||
], | ||
"@typescript-eslint/member-delimiter-style": [ | ||
"off", | ||
{ | ||
"multiline": { | ||
"delimiter": "none", | ||
"requireLast": true | ||
}, | ||
"singleline": { | ||
"delimiter": "semi", | ||
"requireLast": false | ||
} | ||
} | ||
], | ||
"@typescript-eslint/semi": [ | ||
"off", | ||
null | ||
], | ||
"brace-style": [ | ||
"error", | ||
"1tbs" | ||
], | ||
"id-blacklist": "off", | ||
"id-match": "off", | ||
"no-redeclare": "error", | ||
"no-trailing-spaces": "off", | ||
"no-underscore-dangle": "off" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we fix these so we don't have to turn these off? I assume they must be triggering errors if they're not matching what was in the previous tslist.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@angular-eslint
library converted all rules from tslint.json
to this file. But to be honest I haven't looked at the file closely, since they do good job of it. But I am not sure if we need to tackle this in this PR or have separate for it.
src/ng-select/.eslintrc.json
Outdated
"rules": { | ||
"@angular-eslint/directive-selector": [ | ||
"error", | ||
{ | ||
"type": "attribute", | ||
"prefix": "lib", | ||
"style": "camelCase" | ||
} | ||
], | ||
"@angular-eslint/component-selector": [ | ||
"error", | ||
{ | ||
"type": "element", | ||
"prefix": "lib", | ||
"style": "kebab-case" | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need to specify these since they are defined in .eslintrc.json and it looks like this should extend that config? (The same applies to src/ng-option-highlight/.eslintrc.json)
"createDefaultProgram": true | ||
}, | ||
"extends": [ | ||
"plugin:@angular-eslint/recommended", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does recommended cover all the rules in tslint.json?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran lint based on this config, I got following report
/Users/jaddap2/WebstormProjects/ng-select/src/ng-select/lib/ng-dropdown-panel.component.ts
35:15 error The selector should start with one of these prefixes: "lib" (https://angular.io/guide/styleguide#style-02-07) @angular-eslint/component-selector
/Users/jaddap2/WebstormProjects/ng-select/src/ng-select/lib/ng-option.component.ts
14:15 error The selector should start with one of these prefixes: "lib" (https://angular.io/guide/styleguide#style-02-07) @angular-eslint/component-selector
/Users/jaddap2/WebstormProjects/ng-select/src/ng-select/lib/ng-select.component.spec.ts
4150:7 error Component class names should end with one of these suffixes: "Component" (https://angular.io/styleguide#style-02-03) @angular-eslint/component-class-suffix
4241:7 error Component class names should end with one of these suffixes: "Component" (https://angular.io/styleguide#style-02-03) @angular-eslint/component-class-suffix
4248:7 error Component class names should end with one of these suffixes: "Component" (https://angular.io/styleguide#style-02-03) @angular-eslint/component-class-suffix
/Users/jaddap2/WebstormProjects/ng-select/src/ng-select/lib/ng-select.component.ts
62:15 error The selector should start with one of these prefixes: "lib" (https://angular.io/guide/styleguide#style-02-07) @angular-eslint/component-selector
72:5 error Use @HostBinding or @HostListener rather than the `host` metadata property (https://angular.io/styleguide#style-06-03) @angular-eslint/no-host-metadata-property
258:5 warning Lifecycle interface 'OnInit' should be implemented for method 'ngOnInit'. (https://angular.io/styleguide#style-09-01) @angular-eslint/use-lifecycle-interface
/Users/jaddap2/WebstormProjects/ng-select/src/ng-select/lib/ng-templates.directive.ts
4:24 error The selector should start with one of these prefixes: "lib" (https://angular.io/guide/styleguide#style-02-08) @angular-eslint/directive-selector
18:24 error The selector should be camelCase (https://angular.io/guide/styleguide#style-02-06) @angular-eslint/directive-selector
23:24 error The selector should be camelCase (https://angular.io/guide/styleguide#style-02-06) @angular-eslint/directive-selector
28:24 error The selector should be camelCase (https://angular.io/guide/styleguide#style-02-06) @angular-eslint/directive-selector
33:24 error The selector should be camelCase (https://angular.io/guide/styleguide#style-02-06) @angular-eslint/directive-selector
38:24 error The selector should be camelCase (https://angular.io/guide/styleguide#style-02-06) @angular-eslint/directive-selector
43:24 error The selector should be camelCase (https://angular.io/guide/styleguide#style-02-06) @angular-eslint/directive-selector
48:24 error The selector should be camelCase (https://angular.io/guide/styleguide#style-02-06) @angular-eslint/directive-selector
53:24 error The selector should be camelCase (https://angular.io/guide/styleguide#style-02-06) @angular-eslint/directive-selector
58:24 error The selector should be camelCase (https://angular.io/guide/styleguide#style-02-06) @angular-eslint/directive-selector
63:24 error The selector should be camelCase (https://angular.io/guide/styleguide#style-02-06) @angular-eslint/directive-selector
68:24 error The selector should be camelCase (https://angular.io/guide/styleguide#style-02-06) @angular-eslint/directive-selector
we can the following errors since they are false positive
- The selector should be camelCase
- The selector should start with one of these prefixes: "lib"
but we may want to resolve this
72:5 error Use @HostBinding or @HostListener rather than the `host` metadata property (https://angular.io/styleguide#style-06-03) @angular-eslint/no-host-metadata-property
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed on https://github.com/pavankjadda/ng-select/pull/1 (first commit)
@pavankjadda I created https://github.com/pavankjadda/ng-select/pull/1 against your branch that this PR is created off of including my suggestions and additional eslint config changes. You can merge the PR to update this PR with my suggestions. |
suggestions to #1996
@terencehonles merged your changes. All files passing lint rules. This is good to go now. |
@varnastadeus please review this |
Thanks for the follow up @pavankjadda. @varnastadeus I followed up to confirm the lint rules match the original intent (some things slipped through because tslint didn't catch everything it was configured to) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finishing a full review, LGTM!
@@ -1,5 +1,9 @@ | |||
{ | |||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", | |||
"cli": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably fine, but it probably can also be dropped. Not sure if you have a preference @varnastadeus
Do you have access to merge this and release new version? |
Nope, that would be @varnastadeus, just letting them know I thought the PR looked good 🙂 |
@varnastadeus When you get a chance please review and approve this. |
@pavankjadda tests are not running in the CI job. Can you check on this? |
I am able to run them on local machine. It seems some kind of issue with GitHub actions when using Karma |
@pavankjadda I am having the same error while running |
Interesting. Let me check |
@varnastadeus would you mind enabling CI workflow on each commit and pull request. I just pushed an update and I don't know if it passes CI |
I see all tests passing (272/273) expect this one
I see the following error message in Console. I wonder if this was introduced by changes from @terencehonles. But that's highly unlikely
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can probably remove from the karma config and the package.json
karma-coverage-istanbul-reporter
@varnastadeus all the tests are passing on my local machine. You can review this now. |
…from karma config. 1. removes unsupported `karma-coverage-istanbul-reporter` plugin from karma config. 2. see https://github.com/angular/angular-cli/blob/master/CHANGELOG.md#angular-devkitbuild-angular-3 for more details on this
diff --git a/src/ng-select/karma.conf.js b/src/ng-select/karma.conf.js
--- src/ng-select/karma.conf.js
+++ src/ng-select/karma.conf.js
@@ -14,11 +14,11 @@
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
- coverageIstanbulReporter: {
+ coverageReporter: {
dir: require('path').join(__dirname, '../../coverage/ng-select'),
- reports: ['lcovonly'],
+ reporters: ['lcovonly'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
|
@varnastadeus I was about to do the same 😅 it looks like we may want to also pull in angular/angular-cli@ef8815d but when updating to Angular 13.0.2 I noticed that I had to use |
These are the changes I made https://github.com/pavankjadda/ng-select/pull/2 |
Since you have push access to @pavankjadda's branch you can fast forward it with |
@varnastadeus Thanks for this. I still see CI failing in Update: Never mind I still old Karma config in one file. Updated it, CI should pass now |
@varnastadeus never mind. I updated karma config based on latest configuration changes. I tested them in another branch in my fork. All works fine and CI is passing. You can merge the PR now |
thanks again for the PR guys 🎉 |
@pavankjadda I have addressed those issues here #2004 |
🎉 This PR is included in version 8.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
No description provided.