Skip to content

[MM-68143] Fix ESLint --ext flags to include dot prefix for file extensions#1145

Open
M-ZubairAhmed wants to merge 3 commits intomainfrom
MM-68143
Open

[MM-68143] Fix ESLint --ext flags to include dot prefix for file extensions#1145
M-ZubairAhmed wants to merge 3 commits intomainfrom
MM-68143

Conversation

@M-ZubairAhmed
Copy link
Copy Markdown
Member

@M-ZubairAhmed M-ZubairAhmed commented Mar 31, 2026

Summary

  • Fix ESLint --ext flags in lint commands to include the file extensions.
  • Simplified the lint and lint:fix scripts in both webapp/package.json and standalone/package.json by removing explicit --ignore-pattern flags and relying on .eslintignore files instead.
  • Updated webapp/.eslintignore and added standalone/.eslintignore to ignore node_modules/, dist/, and (for webapp) lib/ directories,
  • Modified the Makefile to remove .eslintcache files from both webapp and standalone

Ticket Link

Fixes https://mattermost.atlassian.net/browse/MM-68143

…iles

- Introduced a new .eslintignore file in the standalone directory to exclude node_modules and dist from linting.
- Updated lint and fix scripts in both standalone and webapp package.json files to simplify the ESLint command by removing ignore patterns for node_modules and dist, and added support for .tsx files.
- Added 'node_modules/', 'dist/', and 'lib/' to the .eslintignore file to prevent linting of these directories, ensuring a cleaner linting process.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

📝 Walkthrough

Walkthrough

The changes consolidate ESLint configuration across webapp and standalone directories by moving ignore patterns into dedicated .eslintignore files and simplifying lint scripts. Cache files are now automatically cleaned, and the fix script is renamed to lint:fix in both packages.

Changes

Cohort / File(s) Summary
Build Configuration
Makefile
Added removal of .eslintcache files from webapp and standalone directories during cleanup operations.
ESLint Configuration
webapp/.eslintignore, standalone/.eslintignore
Created/updated ESLint ignore files with patterns for node_modules/, dist/, and additional directories per context (webapp also ignores lib/ and mattermost-webapp/*).
Package Scripts
webapp/package.json, standalone/package.json
Simplified lint scripts by consolidating --ext flags into single comma-separated values, moved ignore patterns to .eslintignore files, and renamed fix script to lint:fix with --fix flag included.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title refers to fixing ESLint --ext flags but the changeset focuses on simplifying ESLint commands via .eslintignore files and script refactoring, not specifically dot prefix fixes. Clarify whether the primary change is about --ext flag formatting or about simplifying ESLint configuration through .eslintignore files and script updates.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description is directly related to the changeset, clearly outlining the ESLint configuration updates, script simplifications, and cache file cleanup across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch MM-68143

Comment @coderabbitai help to get the list of available commands and usage tips.

@M-ZubairAhmed M-ZubairAhmed changed the title Add ESLint configuration and update linting scripts in package.json f… [MM-68143] Fix ESLint --ext flags to include dot prefix for file extensions Mar 31, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
webapp/package.json (1)

13-14: Consider keeping a fix alias for backward compatibility.

Renaming to lint:fix is fine, but preserving fix avoids breaking existing local/automation workflows that still call npm run fix.

Proposed compatibility alias
   "scripts": {
     "preinstall": "./install_mattermost_webapp.sh",
     "build": "webpack --mode=production",
     "build:watch": "webpack --mode=production --watch",
     "debug": "webpack --mode=none",
     "debug:watch": "webpack --mode=development --watch",
     "lint": "eslint --ext .js,.jsx,.tsx,.ts . --quiet --cache",
+    "fix": "npm run lint:fix",
     "lint:fix": "eslint --ext .js,.jsx,.tsx,.ts . --quiet --fix --cache",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@webapp/package.json` around lines 13 - 14, Add a backward-compatible "fix"
npm script that mirrors the existing "lint:fix" behavior so callers of npm run
fix continue to work; update the package.json "scripts" section to include a
"fix" entry that either duplicates the "lint:fix" command or forwards to it
(e.g., run the same eslint args or invoke "npm run lint:fix"), ensuring the new
"fix" script name coexists with "lint" and "lint:fix".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@webapp/package.json`:
- Around line 13-14: Add a backward-compatible "fix" npm script that mirrors the
existing "lint:fix" behavior so callers of npm run fix continue to work; update
the package.json "scripts" section to include a "fix" entry that either
duplicates the "lint:fix" command or forwards to it (e.g., run the same eslint
args or invoke "npm run lint:fix"), ensuring the new "fix" script name coexists
with "lint" and "lint:fix".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6a203336-78e2-46f4-8d37-3378516171e4

📥 Commits

Reviewing files that changed from the base of the PR and between e1dbdd2 and 846a1f3.

📒 Files selected for processing (5)
  • Makefile
  • standalone/.eslintignore
  • standalone/package.json
  • webapp/.eslintignore
  • webapp/package.json

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 24.05%. Comparing base (e1dbdd2) to head (846a1f3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1145      +/-   ##
==========================================
- Coverage   24.12%   24.05%   -0.08%     
==========================================
  Files         237      237              
  Lines       13540    13540              
  Branches     1611     1611              
==========================================
- Hits         3267     3257      -10     
- Misses       9964     9975      +11     
+ Partials      309      308       -1     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@M-ZubairAhmed M-ZubairAhmed added the 2: Dev Review Requires review by a core committer label Mar 31, 2026
@M-ZubairAhmed M-ZubairAhmed requested review from carlisgg and removed request for agarciamontoro April 2, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2: Dev Review Requires review by a core committer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants