Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ export default [
]
```

ESLint processor behavior:

- real JS/TS diagnostics inside Pug expression sites such as `#{...}`, `${...}`, `tag= ...`, attribute expressions, and inline handler/function bodies are mapped back to the original Pug source
- formatting diagnostics for those embedded expression sites are linted against source-faithful JS wrappers rather than only against generated JSX
- autofixes and suggestions for those embedded expression sites are mapped back to the original Pug source
- diagnostics that originate only from synthetic generated helper code are filtered out
- the processor formats against the project's own `@stylistic` package when available so generated JSX converges to the same style engine the outer ESLint run uses

Current limitation:

- multiline unbuffered `- ...` statements that are authored across several Pug lines do not yet get the same source-faithful formatting-diagnostic surface as embedded expression sites
- diagnostics that arise only on the generated JSX surface of a transformed Pug region still do not map autofixes back; those remain report-only unless they come from an embedded source-faithful JS site
- the internal formatter still relies on deprecated `@stylistic/jsx-indent` / `@stylistic/jsx-indent-props` compatibility rules, so some dependency graphs may emit a one-time deprecation warning during an ESLint run

## VS Code Settings

- `pugReact.enabled`
Expand Down
2 changes: 1 addition & 1 deletion example/src/TypeScriptInPug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function TypeScriptInPug () {
if maybeTitle != null
p #{maybeTitle as string}

each item in (items as string[])
each item in items as string[]
Card(title=item!)
`
}
16 changes: 16 additions & 0 deletions packages/eslint-plugin-react-pug/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ treats JS files as JSX-capable and you want to skip JSX auto-detection.

Used `pug` import bindings are removed from the processor's transformed view automatically.

## Linting Contract

The processor is designed to preserve useful JavaScript/TypeScript diagnostics inside Pug regions:

- real JS/TS rule violations inside `#{...}`, `${...}`, `tag= ...`, attribute expressions, and inline handler/function bodies are reported back at the original Pug location
- formatting diagnostics for those embedded expression sites are linted against source-faithful JS wrappers rather than only against generated JSX
- autofixes and suggestions for those embedded expression sites are mapped back to the original Pug source
- diagnostics caused only by synthetic generated helper code are filtered out
- the formatter tries to converge to the consuming project's own `@stylistic` setup when that package is available locally

Current limitation:

- multiline unbuffered `- ...` statements that are authored across several Pug lines do not yet get the same source-faithful formatting-diagnostic surface as embedded expression sites
- diagnostics that arise only on the generated JSX surface of a transformed Pug region still do not map autofixes back; those remain report-only unless they come from an embedded source-faithful JS site
- the internal formatter still relies on deprecated `@stylistic/jsx-indent` / `@stylistic/jsx-indent-props` compatibility rules, so some dependency graphs may emit a one-time deprecation warning during an ESLint run

## Exports

- default ESLint plugin object
Expand Down
Loading
Loading