Skip to content

Add ESLint flat config with CI enforcement#922

Draft
loganrosen wants to merge 3 commits intohacs:mainfrom
loganrosen:eslint-10-upgrade
Draft

Add ESLint flat config with CI enforcement#922
loganrosen wants to merge 3 commits intohacs:mainfrom
loganrosen:eslint-10-upgrade

Conversation

@loganrosen
Copy link

@loganrosen loganrosen commented Mar 15, 2026

Replaces the broken .eslintrc.yaml with a modern eslint.config.mjs flat config and adds lint enforcement to CI.

Depends on #923 (submodule update).

Changes

  • Delete .eslintrc.yaml (was non-functional — referenced missing plugins)
  • Add eslint.config.mjs flat config using plugins already in the submodule's dependency tree
  • Add yarn lint script and CI lint job
  • Fix all lint errors in src/

Lint fixes

  • Remove debug console.log calls in dialog error handlers
  • Empty interface → type alias (@typescript-eslint/no-empty-object-type)
  • location.href = location.hreflocation.reload() (no-self-assign)
  • Unnecessary regex escapes (no-useless-escape)
  • Add alt="" to decorative integration icon img (lit-a11y/alt-text)
  • eslint-disable no-console for logger utility

Copilot AI review requested due to automatic review settings March 15, 2026 22:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR upgrades the frontend’s linting toolchain to ESLint v10 using the new flat config format, and adds a CI job to enforce linting to keep the codebase consistently formatted and error-free.

Changes:

  • Upgrade ESLint + related plugins/configs and migrate from .eslintrc.yaml to eslint.config.mjs (flat config).
  • Add yarn lint and a dedicated CI lint job (Node 22), while keeping the build job on Node 18.
  • Apply targeted lint-driven code fixes (console usage, reload behavior, optional chaining, a11y alt, regex escapes, and TS type cleanup).

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
yarn.lock Updates dependency graph for ESLint v10 + plugin upgrades/removals.
package.json Adds lint script and updates ESLint-related devDependencies.
eslint.config.mjs Introduces ESLint v10 flat config and project lint rules/ignores.
.github/workflows/test.yml Adds lint job in CI and splits Node versions for lint vs build.
.eslintrc.yaml Removes legacy ESLint config.
src/tools/markdown.ts Regex escape cleanups aligned with lint rules.
src/tools/hacs-logger.ts File-level no-console disable for logger implementation.
src/extra.ts Uses location.reload() and suppresses no-console for a single error log.
src/dashboards/hacs-repository-dashboard.ts Replaces unused-expression pattern with optional chaining invocation.
src/dashboards/hacs-dashboard.ts Same optional chaining fix + adds alt for integration icon image.
src/components/dialogs/show-hacs-dialog.ts Replaces empty interface with a type alias.
src/components/dialogs/hacs-form-dialog.ts Removes stray debug console.log.
src/components/dialogs/hacs-custom-repositories-dialog.ts Removes stray debug console.log.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@loganrosen loganrosen marked this pull request as draft March 15, 2026 22:58
loganrosen and others added 3 commits March 19, 2026 21:35
Updates the HA frontend submodule from 20250109.0 to 20260312.0,
bringing in upstream dependency updates including gulp 5.0.1 which
fixes Node 20+ compatibility (gulp-cli 3.1.0 handles async ESM).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adapt to upstream component renames and removals:
- ha-circular-progress → ha-spinner
- ha-menu/ha-md-menu-item → ha-dropdown/ha-dropdown-item
- ha-button-menu → ha-dropdown
- createCloseHeading() → ha-dialog header-title attribute
- resources/compatibility and @polymer/polymer removed
- resources/ha-style → resources/append-ha-style

Build system fixes:
- polymer_dir → root_dir in paths.cjs and rspack.cjs
- Remove isHassioBuild (removed upstream)
- Write dummy iconMetadata.json for rspack resolution

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace broken .eslintrc.yaml with eslint.config.mjs (flat config).
Add lint script and CI job. Fix all lint errors:
- Remove debug console.log calls
- Empty interface → type alias
- location.href self-assign → location.reload()
- Unnecessary regex escapes
- Add alt attr to decorative img
- eslint-disable for logger utility

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@loganrosen loganrosen changed the title Upgrade ESLint to v10 with flat config and add lint to CI Add ESLint flat config with CI enforcement Mar 26, 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.

3 participants