DEV Community

Discussion on: P42 for Visual Studio Code

Collapse
 
lgrammel profile image
Lars Grammel

Great questions! This is currently an alpha release and many features will be added going forward.

The customization is a great point. Ideally teams or project owners could define which best practices they want to use in their projects, similar to what ESLint offers.

The goal of the refactorings is to make the code easier to read and more modern, but often what is more legible is in the eye of the reader (e.g. some people prefer ternary statements, some don't) - so the customization you asked about earlier is very important.

Ignoring suggestions is currently not available. The suggestions are using a blue hint and are hopefully less intrusive than error or warning highlights.

Right now, the developer would need to be aware of the right ECMAScript versions, and the assumption is that transpilation and polyfilling is set up correctly. In the future, specification or detection are the goal.

Thanks for the questions / ideas :)

Collapse
 
nombrekeff profile image
Keff

Cool, thanks for the reply, I will try it out!

Yeah, I think the ability to turn on/off rules and/or hints would be really appreciated, as well as any other configurations.

I've used something similar with dart/flutter in VScode, and it's a really nice addition to typical linting.

No problem, I'm here for that!

Thread Thread
 
lgrammel profile image
Lars Grammel

Awesome, let me know how it goes :)

Thread Thread
 
lgrammel profile image
Lars Grammel • Edited

@nombrekeff I've released a new version, which supports some basic configuration through a "p42.toml" file in the workspace root.

To disable a refactoring, add a section with "refactoring.$refactoring-id" and set enabled to false, for example:

[refactoring.optional-chaining]
enabled = false
Enter fullscreen mode Exit fullscreen mode

The refactoring ids are displayed as grayed-out text in parentheses in the hover messages.

Thread Thread
 
nombrekeff profile image
Keff

Wow nice, such fast implementation, kudos to you!

I haven't been able to try it yet, but will do soon

Thread Thread
 
lgrammel profile image
Lars Grammel

It took a while longer, but excluding individual statements from the P42 analysis is now also possible with '// p42:ignore-next-statement'.

This small addition is super helpful beyond the VS Code plugin, in excluding unwanted suggestions in automated P42 pull request and commit reviews :)