-
Notifications
You must be signed in to change notification settings - Fork 237
WORLDSERVICE-225: Adds linting rules and standards around optional chaining #12646
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
WORLDSERVICE-225: Adds linting rules and standards around optional chaining #12646
Conversation
'**/tz/**', | ||
'index.stories.jsx', | ||
'index.amp.stories.jsx', | ||
'.storybook/**/*', |
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.
For @typescript-eslint/prefer-optional-chain
to work correctly without erroring, I've had to disable linting of anything in .storybook, this is because the tsconfig hasn't been pointed to .storybook, when I added it it surfaced a lot of typescript errors, too many to fix in this PR.
So we either need a follow up ticket and PR to fix the TS errors in .storybook and reinstate linting of the folder, or we don't use this new rule until we do those fixes. Either way we need a ticket to fix the TS errors in .storybook.
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 fine - the components within the storybook directory are mainly for Component Health, and are written in TS. For me, they are much less important than actual components which we use the Simorgh app. Do we even need a follow up ticket to fix this in the future? No harm in creating one, I suppose, but it's low priority.
…/github.com/bbc/simorgh into WORLDSERVICE-225-optional-chaining-standard
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've had to revert these back to jsx, due to typescript excluding the legacy folder
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.
Given that we had to rename some files from tsx -> jsx, let's create a follow up ticket to fix those. I would also create a separate ticket to fix the TS linting errors within the .storybook directory, which is a lower priority.
'**/tz/**', | ||
'index.stories.jsx', | ||
'index.amp.stories.jsx', | ||
'.storybook/**/*', |
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 fine - the components within the storybook directory are mainly for Component Health, and are written in TS. For me, they are much less important than actual components which we use the Simorgh app. Do we even need a follow up ticket to fix this in the future? No harm in creating one, I suppose, but it's low priority.
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.
Did this get renamed to jsx to avoid TS linting errors?
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.
As eslint targets the legacy folder, it will run all linting rules against it, including ts linting rules, but because we've excluded the legacy folder from being targeted by the ts compiler, eslint produces an error. These components should really be fully migrated over
Resolves WORLDSERVICE-225
Summary
Adds linting rules and coding standards for Optional Chaining.
Code changes
no-unsafe-optional-chaining
lint rule@typescript-eslint/prefer-optional-chain
rule.storybook
folder from being linted temporarilyDeveloper Checklist
Testing
Ready-For-Test, Local
)Ready-For-Test, Test
)Ready-For-Test, Preview
)Ready-For-Test, Live
)Additional Testing Steps
Useful Links