chore: migrate to ESLint flat config and pnpm
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:
-
ESLint Flat Config Migration:
- Removed the legacy
.eslintrc.jsand.eslintignorefiles. - Introduced a new
eslint.config.mjsfile usingtseslint.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
ignoresarray in the config to specify files/directories to exclude from linting (replacing.eslintignore).
- Removed the legacy
-
Switch to pnpm:
- Replaced
package-lock.jsonwithpnpm-lock.yaml. - Updated the GitHub Actions workflow (
.github/workflows/test.yml) to usepnpmfor installing dependencies and running scripts (pnpm install,pnpm run lint,pnpm test,pnpm run build). - Added
pnpm/action-setupto the CI workflow for efficient pnpm caching.
- Replaced
-
Dependency Cleanup:
- Removed
eslint-config-sanityandeslint-plugin-simple-import-sortas linting configuration is now handled directly or via standard recommended sets. (More specific import linting will be added in a subsequent PR).
- Removed
-
Script Updates:
- Added a
lintscript (eslint .) topackage.json. - Updated CI workflow to run the new
lintscript instead of the previousprettify-check.
- Added a
-
.gitignoreUpdate:- Added
.tapto ignore tap test snapshot/output directories.
- Added
Impact
- Standardizes the project on
pnpmfor 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.
-
#281
-
#280
-
#279
๐ (View in Graphite)
-
v2
This stack of pull requests is managed by Graphite. Learn more about stacking.
New, updated, and removed dependencies detected. Learn more about Socket for GitHub โ๏ธ
๐ฎ Removed packages: npm/@types/[email protected], npm/[email protected], npm/[email protected]
๐จ 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 | Note | Source | CI |
|---|---|---|---|---|
| License Policy Violation | npm/[email protected] |
| โ ๏ธ | |
| License Policy Violation | npm/[email protected] |
| โ ๏ธ | |
| License Policy Violation | npm/[email protected] |
| โ ๏ธ |
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
@SocketSecurity ignore npm/[email protected]@SocketSecurity ignore npm/[email protected]@SocketSecurity ignore npm/[email protected]