Skip to content
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

Update eslint config to include JSX files #3139

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

AlanGreene
Copy link
Member

Changes

Discovered while reviewing #3108 that eslint wasn't processing our JSX files.

By default eslint only processes files with .js extension. Add an override to include .jsx

Run npm run lint:fix to address to issues that can be automatically resolved.

Fix a11y bug with Task component keyboard nav that this highlighted.

/kind misc
/kind bug

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Docs included if any changes are user facing
  • Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (new features, significant UI changes, API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Fix keyboard accessibility issue that prevented the Task details from being accessed by keyboard on the PipelineRun details page

By default eslint only processes files with `.js` extension. Add
an override to include `.jsx`

Run `npm run lint:fix` to address to issues that can be automatically resolved.

Fix a11y bug with Task component keyboard nav that this highlighted.
@tekton-robot tekton-robot added the kind/misc Categorizes issue or PR as a miscellaneuous one. label Sep 29, 2023
@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. labels Sep 29, 2023
@AlanGreene AlanGreene requested review from briangleeson and removed request for skaegi September 29, 2023 15:56
@@ -13,7 +13,7 @@ limitations under the License.
module.exports = {
env: {
browser: true,
es2021: true,
es2022: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required for eslint to support public class fields without requiring babel

@@ -53,7 +56,7 @@ module.exports = {
'formatjs/enforce-default-message': 'error',
'formatjs/enforce-id': 'error',
'formatjs/no-complex-selectors': 'error',
'formatjs/no-literal-string-in-jsx': 'error',
'formatjs/no-literal-string-in-jsx': 'off', // TODO: [AG] re-enable this after cleanup
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of these, mostly the hardcoded Tekton resource kinds so intentionally left as literals. May revisit this rule in future if it becomes annoying but temporarily disabling for now.

@@ -112,16 +122,6 @@ export /* istanbul ignore next */ class PipelineRunContainer extends Component {
}));
};

getPipelineTask = ({ pipelineRun, selectedTaskId, taskRun }) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class method expected to use this. No need for it to be a class method since it's a pure function so move it outside the component and update references

className="tkn--task-link"
tabIndex={0} // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This meant that the Task element wasn't reachable by keyboard, so users couldn't access the Task status, pod info, results, etc. by keyboard. Also couldn't expand other tasks in the tree by keyboard.

Copy link
Contributor

@briangleeson briangleeson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 29, 2023
@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: briangleeson

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 29, 2023
@tekton-robot tekton-robot merged commit 10474f4 into tektoncd:main Sep 29, 2023
3 checks passed
@AlanGreene AlanGreene deleted the eslint_jsx branch September 29, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. kind/misc Categorizes issue or PR as a miscellaneuous one. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants