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

chore: improve linting, docs, and export structure

Open ricokahler opened this issue 1 year ago • 2 comments

Motivation

This PR introduces several tooling and structural improvements to enhance code quality, enforce documentation standards, and simplify the package's export configuration. These changes serve as preparatory work for the upcoming refactoring related to the synchronous evaluator, aiming for a cleaner and more maintainable codebase.

Key Changes:

  1. Enhanced Linting:

    • Added eslint-plugin-import-x and configured rules to enforce consistent import ordering, style, and prevent duplicates (import-x/order, import-x/consistent-type-specifier-style, import-x/no-duplicates, etc.).
    • Added eslint-plugin-tsdoc and enabled the tsdoc/syntax rule to validate TSDoc comment syntax, promoting better inline documentation.
    • Added general quality rules like no-console and no-warning-comments.
  2. Simplified Export Structure:

    • Removed the previous entry point src/1.ts.
    • Introduced a new centralized export file src/_exports/index.ts.
    • Updated package.json exports field:
      • The main "." entry point now correctly points to src/_exports/index.ts (source) and its corresponding dist files.
      • Removed the specific "./1" export entry.
    • Removed the typesVersions field from package.json as it's no longer needed after removing the specific ./1 export.
  3. API Extractor Configuration:

    • Disabled the ae-missing-release-tag rule in package.config.ts. TSDoc validation (@public, @internal within comments) will be the primary mechanism for controlling API surface visibility going forward.
  4. Dependency Updates:

    • Added eslint-plugin-import-x and eslint-plugin-tsdoc to devDependencies.
    • Updated pnpm-lock.yaml accordingly.

Impact

  • Improved code consistency through stricter linting, especially regarding imports.
  • Encourages better documentation practices via TSDoc validation.
  • Provides a clearer and more standard package export structure by using a single entry point file.
  • Removes the potentially confusing ./1 subpath export.

This PR primarily affects the developer experience and internal structure and should not introduce breaking changes for consumers using the main package entry point (import {...} from 'groq-js').

ricokahler avatar Mar 31 '25 23:03 ricokahler

[!WARNING] This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite. Learn more

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

ricokahler avatar Mar 31 '25 23:03 ricokahler

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] Transitive: environment, filesystem +48 3.65 MB jounqin
npm/[email protected] Transitive: environment, eval, filesystem, unsafe +15 4.8 MB odspnpm

View full report↗︎

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