ni / ni/javascript-styleguide

TypeScript / package.json configurations

Open
#191 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
JavaScript
Stars
9
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Describe the issue

We should consider creating a package or documenting recommended TypeScript Config and package.json export configs. For now using this issue to capture some common guidance today:

  • use strict
  • Do not enable skipLibCheck: true, see: https://github.com/remcohaszing/skiplibcheck
  • Prefer "moduleResolution": "Node16" (or higher) for web+node / node-only libraries or "moduleResolution": "bundler" for web-only libraries. Related have a package.json structure of:
     "type": "module",
     "exports": {
      "./package.json": "./package.json",
      ".": {
        "types": "./dist/esm/index.d.ts",
        "import": "./dist/esm/index.js"
      },
      "./*": {
        "types": "./dist/esm/*.d.ts",
        "import": "./dist/esm/*/index.js"
      }
     },
     "typesVersions": {
      "*": {
        "*": [
          "dist/esm/*",
          "dist/esm/*/index.d.ts"
        ]
      }
     },
    
    Which enables base and secondary entrypoints from index files and is a file structure / package.json configuration compatible with modern and legacy node import behaviors.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the TypeScript and package.json guidance captured in the issue, then determine whether it belongs in a package or documentation. Done means the recommended strict, module-resolution, exports, and typesVersions configurations are documented or packaged with clear compatibility guidance for modern and legacy Node imports.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.