Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 7, 2025

CLI-generated WebComponents apps fail lint with @typescript-eslint/no-unused-vars errors. The default @typescript-eslint/recommended config doesn't account for common Lit/WebComponents patterns where underscore-prefixed variables indicate intentional non-use.

Changes

ESLint Configuration (eslint.config.mjs)

  • Added @typescript-eslint/no-unused-vars rule with argsIgnorePattern: '^_' and varsIgnorePattern: '^_' (matches Lit framework convention)
  • Enabled eslint-plugin-lit with rules: no-legacy-template-syntax, no-invalid-html, no-useless-template-literals
  • Replaced inline globals with globals package for browser and es2021 environments
  • Updated ecmaVersion from 12 to latest

Dependencies (package.json)

  • Added @eslint/eslintrc@^3.2.0 (required for FlatCompat)
  • Added globals@^15.14.0

Applied to both _base and _base_with_home project templates.

Example

// ✅ Now allowed - underscore indicates intentional non-use
private _cache: Map<string, any> = new Map();
private handleEvent(_event: Event): void { /* ... */ }

// ❌ Still caught - missing underscore prefix
const unusedVar = 1;  // error: 'unusedVar' is assigned but never used

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.google-analytics.com
    • Triggering command: Ignite UI CLI (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Lint errors in CLI generated app for WebComponents</issue_title>
<issue_description>### Description
When you create a WC app through the CLI and you run lint test, no-unused-vars errors occur.

Steps to reproduce

  1. Create a WebComponents application through the CLI
  2. Install the modules
  3. Run lint tests

Result

no-unused-vars errors are shown

Expected result

There should be no errors when you run the lint tests.

Attachments

image
</issue_description>

<agent_instructions>Let's first investigate which is the most common tool for linting a web components project. Then define which are the recommended lint rules to be set.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix lint errors in CLI generated app for WebComponents Configure ESLint for WebComponents templates to allow underscore-prefixed unused variables Nov 7, 2025
Copilot AI requested a review from Lipata November 7, 2025 11:08
@Lipata Lipata marked this pull request as ready for review November 19, 2025 11:05
@coveralls
Copy link

Coverage Status

coverage: 70.369%. remained the same
when pulling 936277e on copilot/fix-lint-errors-webcomponents-app
into 549f80a on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lint errors in CLI generated app for WebComponents

3 participants