This commit is contained in:
@@ -31,7 +31,7 @@ registerHooks({
|
||||
- Node runs the `.ts` script directly (type stripping), so no build step.
|
||||
- Import the package entry, or spawn the package's bin with
|
||||
`node:child_process`, rather than `await import("lit-analyzer/cli.js")`.
|
||||
`project/no-asset-imports` allows `.js` subpaths, but the CLI file runs on
|
||||
`project/no-asset-imports` allows `.js` (and `.mts`/`.mjs`) subpaths, but the CLI file runs on
|
||||
import and bypasses the package's public entry.
|
||||
- CI runs `npm run lit-check` as its own step.
|
||||
- It is tooling under `scripts/`: no tests; a narrow `overrides` entry for it
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
description: Every file is .ts (no js/mjs/cjs/jsx/tsx, configs included); imports name only .ts files or .js package subpaths; CSS comes from HTML, JSON/SVG become .ts modules
|
||||
description: Every file is .ts (no js/mjs/cjs/jsx/tsx, configs included); imports name only .ts files or .js/.mts/.mjs package subpaths; CSS comes from HTML, JSON/SVG become .ts modules
|
||||
---
|
||||
|
||||
The user's rule, from the Deno days and restated for Node (2026-10-12): "No
|
||||
@@ -12,19 +12,22 @@ plain `.ts`. Build output in a gitignored folder is the only JS.
|
||||
`noUncheckedIndexedAccess`). If a tool or framework seems to need a JS or TSX
|
||||
file, stop and flag it instead of adding one.
|
||||
|
||||
## No asset imports (2026-10-14, widened 2026-10-16)
|
||||
## No asset imports (2026-10-14, widened 2026-10-16 and 2026-10-17)
|
||||
|
||||
`.ts` and `.js` imports are allowed: our own files stay `.ts`, and `.js`
|
||||
covers package subpaths such as `lit/decorators.js`.
|
||||
`project/no-asset-imports` (in `scripts/project-lint.ts`) fails:
|
||||
`project/no-asset-imports` (in `scripts/project-lint.ts`; it was
|
||||
`no-non-ts-imports` before 2026-10-16) fails:
|
||||
|
||||
- a relative, absolute, `#`, or package-subpath specifier whose last segment
|
||||
has any other extension: `.css`, `.json`, `.svg`, `.mjs`, `.tsx`;
|
||||
has an extension other than `.ts`, `.js`, `.mts`, or `.mjs`: `.css`,
|
||||
`.json`, `.svg`, `.jsx`, `.tsx`, and every other asset;
|
||||
- any `?query` suffix (`?raw`, `?url`, `?inline`);
|
||||
- any import attributes (`with { type: "json" }`, `with { type: "text" }`).
|
||||
|
||||
Bare packages (`lit`, `@types/json-schema`, `lodash.debounce`), `#` aliases,
|
||||
and `node:` builtins pass. `@fortawesome/x/svgs/a.svg` fails.
|
||||
`.js`, `.mts`, and `.mjs` are allowed (user decision, 2026-10-17) for package
|
||||
subpaths such as `lit/decorators.js` or `pdfjs-dist/legacy/build/pdf.mjs`;
|
||||
our own files are still `.ts` only. `.jsx` and `.tsx` stay banned. Bare
|
||||
packages (`lit`, `@types/json-schema`, `lodash.debounce`), `#` aliases, and
|
||||
`node:` builtins pass. `@fortawesome/x/svgs/a.svg` fails.
|
||||
|
||||
```ts
|
||||
import "./theme.css"; // no
|
||||
|
||||
Reference in New Issue
Block a user