Skip to content

Conversation

@ricokahler
Copy link

@ricokahler ricokahler commented Mar 31, 2025

Motivation

This PR updates the project's linting setup to use ESLint's modern "Flat Config" system (eslint.config.mjs) and standardizes on pnpm as the package manager. This provides a more explicit and potentially more maintainable configuration structure, aligns with the direction of the ESLint ecosystem, and ensures consistent dependency management.

This is the foundational change in a series of PRs aimed at refactoring and improving the codebase.

Key Changes:

  1. ESLint Flat Config Migration:

    • Removed the legacy .eslintrc.js and .eslintignore files.
    • Introduced a new eslint.config.mjs file using tseslint.config().
    • Configured ESLint using recommended presets (eslint.configs.recommended, eslintPluginPrettierRecommended, tseslint.configs.recommended).
    • Defined baseline rules directly within the config (e.g., @typescript-eslint/no-explicit-any: 'off', no-console: 'error', basic unused vars handling).
    • Added an ignores array in the config to specify files/directories to exclude from linting (replacing .eslintignore).
  2. Switch to pnpm:

    • Replaced package-lock.json with pnpm-lock.yaml.
    • Updated the GitHub Actions workflow (.github/workflows/test.yml) to use pnpm for installing dependencies and running scripts (pnpm install, pnpm run lint, pnpm test, pnpm run build).
    • Added pnpm/action-setup to the CI workflow for efficient pnpm caching.
  3. Dependency Cleanup:

    • Removed eslint-config-sanity and eslint-plugin-simple-import-sort as linting configuration is now handled directly or via standard recommended sets. (More specific import linting will be added in a subsequent PR).
  4. Script Updates:

    • Added a lint script (eslint .) to package.json.
    • Updated CI workflow to run the new lint script instead of the previous prettify-check.
  5. .gitignore Update:

    • Added .tap to ignore tap test snapshot/output directories.

Impact

  • Standardizes the project on pnpm for dependency management.
  • Modernizes the ESLint configuration to the Flat Config system.
  • Provides a clearer base for future linting rule additions.
  • Removes some now-unused dev dependencies.
  • Requires developers working on the project to use pnpm.
  • This change primarily affects the development tooling and setup; it should have no impact on the runtime behavior or the published package for consumers.

BREAKING CHANGE: The minimum Node.js engine requirement has been bumped from >=14 to >=18.6.0 to match tap's minimum engine requirement. This ensures compatibility with our test suite.

- Update tap from 16.3.10 to 21.1.0
- Update various dev dependencies
- Clean up linting rules and improve code quality
Copy link
Author

ricokahler commented Mar 31, 2025

@socket-security
Copy link

socket-security bot commented Mar 31, 2025

New, updated, and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@microsoft/[email protected]7.52.2 Transitive: environment, eval, filesystem, shell, unsafe +44 12.8 MB odspnpm
npm/@sanity/[email protected]1.0.5 None 0 0 B
npm/@sanity/[email protected]7.2.2 Transitive: eval, filesystem, network, shell, unsafe +217 33.4 MB sanity-io
npm/@typescript-eslint/[email protected]8.29.0 Transitive: environment, filesystem +35 3.12 MB
npm/@typescript-eslint/[email protected]8.29.0 Transitive: environment, filesystem +27 1.36 MB
npm/[email protected]4.4.0 None +1 49.5 kB qix
npm/[email protected]10.1.1 None 0 58.4 kB jounqin
npm/[email protected] Transitive: filesystem +8 358 kB alexgorbatchev, bradzacher, jounqin
npm/[email protected]5.2.5 None +5 273 kB jounqin
npm/[email protected]9.23.0 Transitive: eval, shell, unsafe +83 10.2 MB eslintbot
npm/[email protected]3.5.3 None 0 0 B
npm/[email protected]24.2.3 Transitive: eval, filesystem, shell, unsafe +271 36 MB semantic-release-bot
npm/[email protected]7.7.1 None 0 96.7 kB npm-cli-ops
npm/[email protected]21.1.0 None +281 56.2 MB isaacs
npm/[email protected]4.19.3 Transitive: environment, filesystem, network, shell +3 691 kB hirokiosame
npm/[email protected] Transitive: environment, filesystem +30 1.85 MB jameshenry
npm/[email protected], 5.7.25.8.2 None 0 22.9 MB typescript-bot

🚮 Removed packages: npm/@types/[email protected], npm/[email protected], npm/[email protected]

View full report↗︎

@ricokahler ricokahler changed the title chore!: bump minimum Node.js engine to 18.6.0 chore!: update devDeps and bump node engine to 18.6.0 Mar 31, 2025
@socket-security
Copy link

socket-security bot commented Mar 31, 2025

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
License Policy Violation npm/[email protected]
  • License: unrecognized license (package/ThirdPartyNoticeText.txt)
⚠︎
License Policy Violation npm/[email protected]
  • License: unrecognized license (package/ThirdPartyNoticeText.txt)
⚠︎
License Policy Violation npm/[email protected]
  • License: unrecognized license (package/LICENSE.md)
⚠︎

View full report↗︎

Next steps

What is a license policy violation?

This package is not allowed per your license policy. Review the package's license to ensure compliance.

Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@ricokahler ricokahler marked this pull request as ready for review March 31, 2025 20:57
- Changed test assertions in `parse.test.ts` and `typeEvaluate.test.ts` from `t.matchSnapshot` to `t.same` for improved clarity and consistency in output comparison.
- Removed unused snapshot files from `tap-snapshots/test/` to clean up the repository.
- Updated the test command in `package.json` to remove coverage report generation for simplicity.
- Modified the test command in `package.json` to use `tap run` for improved execution.
- Added configuration options for coverage reporting and incomplete coverage handling in the `tap` section of `package.json`.
- Replaced instances of `TAP` with a derived `Test` type for improved type safety and clarity in `typeEvaluateCompare.test.ts` and `typeEvaluateObjects.test.ts`.
- This change enhances the maintainability of the test code by ensuring consistent type usage across test cases.
- Removed the deprecated "lts/-1" version from the Node.js version matrix in the GitHub Actions workflow configuration.
- This change ensures that the CI pipeline tests against the latest supported Node.js versions.
- Removed `package-lock.json` and added `pnpm-lock.yaml` for better dependency management with pnpm.
- Updated `package.json` to specify the pnpm version and ensure compatibility with the new lockfile.
- Modified CI configuration to use pnpm for installing dependencies and running scripts, enhancing the build process.
- Replaced the `prettify-check` command with `lint` in the GitHub Actions workflow to ensure code quality checks are performed during the CI process.
…onfig include

- Added `@microsoft/api-extractor` as a development dependency in `package.json` for improved API documentation generation.
- Updated `tsconfig.json` to include TypeScript files in the `src` directory for better type checking and compilation.
@ricokahler ricokahler changed the title chore!: update devDeps and bump node engine to 18.6.0 chore: Migrate to ESLint Flat Config and pnpm Apr 1, 2025
@ricokahler ricokahler changed the title chore: Migrate to ESLint Flat Config and pnpm chore: migrate to ESLint Flat Config and pnpm Apr 1, 2025
@ricokahler ricokahler changed the title chore: migrate to ESLint Flat Config and pnpm chore: migrate to ESLint flat config and pnpm Apr 1, 2025
@ricokahler ricokahler requested a review from judofyr April 1, 2025 21:54
@judofyr judofyr assigned judofyr and ricokahler and unassigned judofyr Apr 8, 2025
cache: pnpm
- uses: pnpm/action-setup@v2
with:
version: 8
Copy link
Collaborator

Choose a reason for hiding this comment

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

package.json says that we're using PNPM v9 🤔

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