Skip to content

feat: add JSDoc type-checking and declaration emission#1312

Open
alexander-akait wants to merge 1 commit into
mainfrom
claude/add-jsdoc-types-linting-ldGMv
Open

feat: add JSDoc type-checking and declaration emission#1312
alexander-akait wants to merge 1 commit into
mainfrom
claude/add-jsdoc-types-linting-ldGMv

Conversation

@alexander-akait
Copy link
Copy Markdown
Member

Mirror the JSDoc + tsc pattern used in webpack/webpack-dev-middleware so
sass-loader can be type-checked from JSDoc and ship .d.ts declarations.

  • Add tsconfig.json (allowJs, checkJs, strict, declaration,
    emitDeclarationOnly) writing to ./types
  • Add lint:types (tsc --noEmit) and build:types scripts; build now runs
    build:code and build:types in parallel; clean removes types
  • Add @types/node devDependency and types/index.d.ts entry point
  • Flesh out @typedef blocks (LoaderContext, Importer, ResolveFactory,
    Resolver, ResolutionMap, SassCompileFunction, RawSourceMap, SassError,
    EXPECTED_ANY) and tighten parameter/return types in src/index.js and
    src/utils.js so tsc --strict passes

https://claude.ai/code/session_01UgvxAaf3W9xymtJRAyk7QB

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 9, 2026

CLA Not Signed

@alexander-akait alexander-akait force-pushed the claude/add-jsdoc-types-linting-ldGMv branch from a283064 to 21cd4a9 Compare May 9, 2026 13:32
@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

❌ Patch coverage is 94.87179% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.39%. Comparing base (243d68e) to head (21cd4a9).

Files with missing lines Patch % Lines
src/utils.js 94.00% 3 Missing ⚠️
src/index.js 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1312      +/-   ##
==========================================
+ Coverage   94.13%   94.39%   +0.26%     
==========================================
  Files           3        3              
  Lines         409      428      +19     
  Branches      154      162       +8     
==========================================
+ Hits          385      404      +19     
  Misses         22       22              
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Mirror the JSDoc + tsc setup used in webpack/webpack-dev-middleware so
sass-loader can be type-checked from JSDoc and ship .d.ts declarations.

- tsconfig.json (allowJs, checkJs, strict, declaration, emitDeclarationOnly)
  writes to ./types
- lint:types (tsc --noEmit) and build:types scripts; build runs build:code
  and build:types in parallel; clean removes types
- @types/node devDependency, types/index.d.ts entry point
- Replace the previous Sass / SassEmbedded ambient typedefs with structural
  ones (SourceLocation, SourceSpan, LoggerWarnOptions, Logger, CompileResult,
  ModernImporter, AsyncCompiler, SassImplementation) so the emitted .d.ts
  has no `import("sass")` / `import("sass-embedded")` references and end
  users with either peer dep installed get clean types
- SassOptions is parameterised by @template T extends SassImplementation and
  derives the options shape from T's compileStringAsync signature -- no
  manual property enumeration
- getSassOptions, getWebpackResolver, getModernWebpackImporter, getCompileFn
  are generic on T so the implementation type flows through without
  package-specific imports
- Adapt to the post-legacy / post-node-sass main: only modern + modern-
  compiler API paths remain (no LegacyImporter, LegacyResult,
  LegacyImporterResult, LegacyImporterThis, proxyCustomImporters, render
  branch, nodeSassJobQueue, or neo-async typings)

Verified: all four lint scripts pass, build:types emits clean .d.ts with no
real `import("sass")` references, and existing jest suites still pass.

https://claude.ai/code/session_01UgvxAaf3W9xymtJRAyk7QB
@alexander-akait alexander-akait force-pushed the claude/add-jsdoc-types-linting-ldGMv branch from 21cd4a9 to 904ba17 Compare May 12, 2026 19:44
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 12, 2026

⚠️ No Changeset found

Latest commit: 904ba17

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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