Skip to content

[Feature Request]: Emit warnings for invalid pure annotations #8898

@h-a-n-a

Description

@h-a-n-a

What problem does this feature solve?

It's good to have warnings in some scenario where pure annotations are not able
to be interpreted due to the position of the comment.

For example, pure annotation in the example down below is not able
to be interpreted due to position and it's ignored by the parser.

/* #__PURE__ */ React.createElement;

whereas, rollup would emit this warning to help people adjust the placement of pure annotation.

Rollup completed with warnings:
main.js (1:0): A comment "/* #__PURE__ */" in "main.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues. [(link)](https://rollupjs.org/configuration-options/#pure)
/main.js (1:0)
1: /* #__PURE__ */ React.createElement;

https://rollupjs.org/repl/?version=4.59.0&shareable=eyJleGFtcGxlIjpudWxsLCJtb2R1bGVzIjpbeyJjb2RlIjoiLyogI19fUFVSRV9fICovIFJlYWN0LmNyZWF0ZUVsZW1lbnQ7IiwiaXNFbnRyeSI6dHJ1ZSwibmFtZSI6Im1haW4uanMifV0sIm9wdGlvbnMiOnt9fQ==

Original issue: oxc-project/oxc#20334

What does the proposed API look like?

No need

Metadata

Metadata

Assignees

Priority

None yet

Start date

None yet

Target date

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions