quick-lint-js icon indicating copy to clipboard operation
quick-lint-js copied to clipboard

Error on EJS or PHP syntax

Open strager opened this issue 3 years ago • 5 comments

Example:

// Should report: EJS is not supported by quick-lint-js (similar to E0177)
window.audioRecordingBitRate = <%= audioRecordingBitRate %>;

In the lexer, if we see <% or <? (with no space), we can report a warning about EJS or PHP, respectively.

strager avatar Dec 22 '21 23:12 strager

i would like to work on this issue, can you please assign it to me.

itssachinkr avatar Jan 01 '24 10:01 itssachinkr

Hello @strager Thanks for assigning this issue to me I am a beginner, i would request you to guide me a little bit. I was going through the codebase, i think i need to add logic in the file: " src/quick-lint-js/fe/lex.h "

So what i am thinking is i have to Implement a rule that identifies the <% pattern (EJS) and <? pattern (PHP) and when the lexer detects the EJS or PHP pattern, i need to modify the code to report a warning.

itssachinkr avatar Jan 02 '24 09:01 itssachinkr

i think i need to add logic in the file: " src/quick-lint-js/fe/lex.h "

Likely lex.cpp, not lex.h. You'd need to modify lex.h if you add a new function, but logic goes in lex.cpp.

i have to Implement a rule that identifies the <% pattern (EJS) and <? pattern (PHP) and when the lexer detects the EJS or PHP pattern, i need to modify the code to report a warning.

The case '<': in Lexer::try_parse_current_token is probably where you should start poking: https://github.com/quick-lint/quick-lint-js/blob/b05e1cc45388d7302c790ae5cf3f00364130efdf/src/quick-lint-js/fe/lex.cpp#L434

Docs for creating a new diagnostic: https://quick-lint-js.com/contribute/create-diagnostic/

strager avatar Jan 03 '24 00:01 strager

Hello Sir @strager i have made changes. requesting you review the same and provide comments and also how would i check in real time link

itssachinkr avatar Jan 03 '24 10:01 itssachinkr

@pseudofool I suggest compiling your code and running the tests.

When you're done, please create a pull request in GitHub. There's a big green "Create pull request" button on the link you shared. Once you make a pull request, I can write comments directly on the patch.

strager avatar Jan 03 '24 19:01 strager