groq-js icon indicating copy to clipboard operation
groq-js copied to clipboard

chore: migrate to ESLint flat config and pnpm

Open ricokahler opened this issue 1 year ago โ€ข 3 comments

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.

ricokahler avatar Mar 31 '25 20:03 ricokahler

This stack of pull requests is managed by Graphite. Learn more about stacking.

ricokahler avatar Mar 31 '25 20:03 ricokahler

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.2 โžœ 5.8.2 None 0 22.9 MB typescript-bot

๐Ÿšฎ Removed packages: npm/@types/[email protected], npm/[email protected], npm/[email protected]

View full reportโ†—๏ธŽ

socket-security[bot] avatar Mar 31 '25 20:03 socket-security[bot]

๐Ÿšจ 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

socket-security[bot] avatar Mar 31 '25 20:03 socket-security[bot]