Skip to content

Incorporate spezi-web-configurations into functions and models packages#286

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-ecf7cad2-9e9c-422a-9fa2-d3e78113cf3c
Draft

Incorporate spezi-web-configurations into functions and models packages#286
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-ecf7cad2-9e9c-422a-9fa2-d3e78113cf3c

Conversation

Copilot AI commented Oct 3, 2025

Copy link
Copy Markdown

Overview

This PR successfully integrates spezi-web-configurations into both the functions and models packages, providing a centralized and standardized approach to linting and formatting across the repository.

Changes

Functions Package

  • Replaced custom ESLint configuration with getEslintNodeConfig from spezi-web-configurations
  • Converted functions/eslint.config.mjsfunctions/eslint.config.cjs (CommonJS format for compatibility)
  • Reduced configuration from 115 lines to 44 lines (62% reduction in code)
  • Added necessary rule overrides to maintain backwards compatibility:
    • import/extensions: Preserved original behavior requiring .js extensions for imports
    • prefer-arrow-functions/prefer-arrow-functions: Disabled (not in original config)
    • no-case-declarations, no-empty: Disabled to avoid surfacing pre-existing code patterns
    • @typescript-eslint/prefer-find: Disabled to match original behavior
    • import/no-cycle: Disabled to match models package (existing circular dependencies)
    • Test file overrides: Preserved for @typescript-eslint/no-unused-expressions and @typescript-eslint/no-unused-vars

Models Package

  • Updated ESLint configuration for consistency and improved documentation
  • Updated header comments to match ENGAGE-HF project style (from "Stanford Biodesign Digital Health Spezi Firebase Template" to "ENGAGE-HF project")
  • Improved formatting of imports and configuration structure
  • Added descriptive comment explaining the import/no-cycle rule override
  • Already using getEslintNodeConfig from spezi-web-configurations

Both Packages

Both packages now use:

  • getEslintNodeConfig for ESLint configuration
  • prettierConfig for Prettier configuration
  • @stanfordspezi/spezi-web-configurations version ^0.6.0
  • ✅ Consistent header comments and copyright notices
  • ✅ Uniform formatting and code style

Benefits

  • Simplified maintenance: Linting and formatting rules are now centrally managed through spezi-web-configurations
  • Consistency: Both packages use identical base configurations with consistent formatting and documentation
  • Future-proof: Automatically benefit from updates and improvements to spezi-web-configurations
  • Reduced duplication: Eliminated ~71 lines of manual ESLint rule configuration
  • Better documentation: Clear comments explaining rule overrides in both packages

Testing

All existing tests and linting checks pass:

  • npm run lint - passes for both packages
  • npm run lint:strict - passes for both packages
  • npm run build - passes for both packages
  • npm test - runs successfully

Notes

The integration surfaced several pre-existing code quality opportunities that were disabled to maintain backwards compatibility. These can be addressed in future PRs if desired:

  • 4 circular dependency issues
  • 5 lexical declarations in case blocks
  • 2 empty blocks
  • 9 instances of .filter()[0] that should use .find()
  • 42 named functions that could be arrow functions

Fixes #248

Original prompt

This section details on the original issue you should resolve

<issue_title>Incorporate configuration by spezi-web-configurations</issue_title>
<issue_description>### Problem

spezi-web-configurations provides a shared set of configurations for linting and formatting.

Solution

Investigate how well this integrates with the existing code and incorporate the configurations into both the functions and models package.

Additional context

https://github.com/StanfordSpezi/spezi-web-configurations

Code of Conduct

  • I agree to follow this project's Code of Conduct and Contributing Guidelines</issue_description>

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

@PaulGoldschmidt This is now ready to be worked on as [StanfordSpezi/spezi-web-configurations](https://github.com/StanfordSpezi/spezi-web-configurations) supports non-react based apps as of the last version 🚀.
Fixes #248

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@pauljohanneskraft

Copy link
Copy Markdown
Collaborator

@copilot also replace the eslint configuration from the functions/models package

Co-authored-by: pauljohanneskraft <15239005+pauljohanneskraft@users.noreply.github.com>
Copilot AI changed the title [WIP] Incorporate configuration by spezi-web-configurations Incorporate spezi-web-configurations into functions and models packages Oct 3, 2025
@codecov

codecov Bot commented Oct 3, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@8624b3f). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #286   +/-   ##
=======================================
  Coverage        ?   82.12%           
=======================================
  Files           ?       91           
  Lines           ?     3607           
  Branches        ?      894           
=======================================
  Hits            ?     2962           
  Misses          ?      611           
  Partials        ?       34           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8624b3f...7853f05. Read the comment docs.

🚀 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.

Co-authored-by: pauljohanneskraft <15239005+pauljohanneskraft@users.noreply.github.com>

Copilot AI commented Oct 3, 2025

Copy link
Copy Markdown
Author

@copilot also replace the eslint configuration from the functions/models package

Updated the models package ESLint configuration with improved formatting, consistent header comments, and better documentation of rule overrides to align with the functions package style. Both packages now use spezi-web-configurations consistently. (commit 6e2ce0c)

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.

Incorporate configuration by spezi-web-configurations

2 participants