fix: update to Angular v17 broke linter #1
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR
Context
Based on Olivier’s PR (VilledeMontreal#221),
I updated the Angular version to v17 and fixed the following issue: VilledeMontreal#222.
The lint error was caused by several factors :
villedemontreal/lint-configwhich is incompatible with current ESLint versioneslint,typescript-eslintandangular-eslintpackagesExplanation
The Lint job failed because it ran before the build job in GitHub Actions.
The Storybook sub-project depends on the built version of
angular-uiand without it, TypeScript cannot resolve certain imports.For example, the following code will fail during linting:
with the following error in GitHub Actions :
As
angular-uiis developed inside this project, it doesn't appear inpackage.jsonnor innode_modules.In that case, Typescript will look in the
dist/folder to find the lib. These types are only available after the build step, as they reside in thedist/folder but currently as the lint command is ran before the build command, thedist/folder does not exist.Step to reproduce in local
npm cidist/folder doesn't exist in the root folder. Delete it otherwisenpm run lint=> The error will occurrednpm run build && npm run lint=> the lint will pass without error (only warnings)Why now ?
Because of
eslint,typescript-eslintandangular-eslintversions supported by Angular v17 which may include breaking changes or enforce stricter best practices.The solution
To resolve this, we can either :
Or
This PR implements the first solution to minimize code changes.