Skip to content

Fix all 7 ESLint errors reported by npm run lint - #770

Merged
joedolson merged 2 commits into
ableplayer:developfrom
blogcastAI:upstream/eslint-clean
Aug 25, 2026
Merged

joedolson merged 2 commits into
ableplayer:developfrom
blogcastAI:upstream/eslint-clean

Conversation

@blogcastAI

Copy link
Copy Markdown

Hi @joedolson — we run Able Player v5 in production (YouTube grids on an accessibility-first creator platform) and would like to start contributing back. Starting small with the lint baseline so later PRs stay clean.

What

Fixes every error npm run lint currently reports on develop (7 errors, 4 files):

  • scripts/ableplayer-base.js — the descriptionsAudible else-if repeats the first condition (no-dupe-else-if). The comment says the branch supports "both singular and plural spelling of attribute", but the singular form was never read. The branch now reads options.descriptionAudible ?? data.descriptionAudible, so data-description-audible works as the comment intends. Happy to drop this hunk and simply delete the dead branch if the singular spelling was never meant to be supported.
  • scripts/dialog.js — adds the missing AblePlayer import for AblePlayer.getActiveDOMElement() (no-undef).
  • scripts/dragdrop.js — removes two unused thisObj locals (no-unused-vars); comments the intentionally-empty Space/Enter branch (no-empty).
  • scripts/preference.js — removes the write-only $thisLabel and one dead $thisField assignment (no-unused-vars, no-useless-assignment).

Verification

  • npm run lint: 0 problems (was 7)
  • npx jest --selectProjects jsdom: 55/55 pass
  • npm run build: clean; build artifacts not committed per contributing.md

🤖 Generated with Claude Code

- ableplayer-base.js: the descriptionsAudible else-if duplicated the first
  condition (no-dupe-else-if), so the documented singular spelling
  data-description-audible was never honored. Read the singular attribute
  (options.descriptionAudible ?? data.descriptionAudible) in the second
  branch, matching the existing comment's intent.
- dialog.js: import AblePlayer for the AblePlayer.getActiveDOMElement()
  call (no-undef).
- dragdrop.js: remove unused thisObj locals in handleWindowButtonClick and
  handleMenuChoice (no-unused-vars); document the intentionally-empty
  Space/Enter branch (no-empty).
- preference.js: remove the write-only $thisLabel variable and a dead
  $thisField assignment (no-unused-vars, no-useless-assignment).

npm run lint: 0 problems. jsdom test suites: 55/55 pass. Build artifacts
intentionally omitted per contributing.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@joedolson joedolson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the contribution! One change requested - and it's on the line you'd already tagged as odd, so I don't imagine you're surprised.

Comment thread scripts/ableplayer-base.js Outdated
if (descriptionsAudible !== undefined && descriptionsAudible === false) {
this.readDescriptionsAloud = false;
} else if (descriptionsAudible !== undefined && descriptionsAudible === false) {
} else if (descriptionAudible !== undefined && descriptionAudible === false) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This took some research. I traced back the origin of this, and learned that data-description-audible was added as an alternate code path for turning this on in the original commit for the feature. However, it's never been in the documentation - it seems like this was just a protection against the possibility of spelling the attribute differently.

Based on that, I think that it would be preferable to eliminate the alternate condition. It's technically a breaking change, but I don't personally see a lot of value to protecting incorrect attribute name paths unless they were at some point changed or documented differently than the current standard - and that isn't the case here.

Per review: the singular `data-description-audible` alternate code
path was added in the feature's original commit as protection against
misspelling the attribute, but was never documented and never the
standard form. Eliminate the alternate condition rather than keep a
lint-clean version of it; `data-descriptions-audible` (plural) is the
one supported spelling.
@blogcastAI

Copy link
Copy Markdown
Author

Agreed — removed the alternate condition entirely rather than keeping a lint-clean version of an undocumented path. data-descriptions-audible (plural) is now the only spelling checked. Thanks for tracing the origin — that history makes the call easy. If you'd like, we can note the removal in the 5.1.0 changelog under breaking changes; happy to add that to this PR or leave it for your release notes.

blogcastAI added a commit to blogcastAI/ableplayer that referenced this pull request Aug 10, 2026
…#773 review fixes into develop

# Conflicts:
#	.github/workflows/ci.yml
#	e2e/a11y.spec.js
#	e2e/keyboard.spec.js
#	e2e/serve.mjs
#	jest-puppeteer.config.cjs
#	playwright.config.js
@joedolson
joedolson merged commit 29a31fd into ableplayer:develop Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants