runem / lit-analyzer

Monorepository for tools that analyze lit-html templates
MIT License
319 stars 38 forks source link

Improvements coming to lit-analyzer #70

Closed runem closed 4 years ago

runem commented 4 years ago

Here is an update on what I'm working on at the moment, and which improvement I plan on adding to lit-analyzer. Feel free to add your feedback if you have any features/improvement you really want to see come to this project :-)

During the last couple of weeks I've been working intensely on improving web-component-analyzer (read more in this issue: https://github.com/runem/web-component-analyzer/issues/125)

I've been focusing on these areas:

Next week I will be turning my focus to lit-analyzer. The update to WCA makes quite a bit possible here:

I will also be taking a look at the following features:

Thanks for reading through this update. Again, feel free to add your feedback if you have any features/improvement that you really want to see come to this project :+1:

43081j commented 4 years ago

what's the state of this? I see web-component-analyzer is quite far ahead now. It contains a lot of useful fixes lit-analyzer could use for new rules. is there a plan to update lit-analyzer's dependency in the near future?

runem commented 4 years ago

Hey, thanks for asking :-)

I've already done quite a lot of work on the 1.2.0 branch and the next step is to prepare the branch for a publish. This branch uses the newest version of WCA (so all the improvements), and makes it possible to have component level rules that for example check methods and private properties. In addition, I refactored a lot of code around handling of rules, some of which we discussed a couple of months ago. The branch also includes some performance fixes, but it will gain the most performance by making making it possible to evaluate SimpleType lazily (which would require a refactor in the ts-simple-type repo).

Unfortunately I had to pause all of my OS-work from late Januar to start March due to illness in close family. From March I changed my focus to adding some improvements to web-component-analyzer, so I paused the work on 1.2.0 while doing it.

My plan right now is to go through existing PRs/issues in lit-analyzer in order to merge and publish a new version of master. Afterwards I'll finalise the work on the 1.2.0 branch and publish v1.2.0 :-)

43081j commented 4 years ago

thanks for the quick response, its good to hear you've still found time to do these things. if you need any help don't hesitate to make issues and such to split it up a bit, im poking around a few repos lately in my spare lockdown time.

you said it will introduce the ability to visit members, too, what about arbitrary nodes? exposing the underlying javascript/typescript AST at some point would free rules up a bit and allow them to operate over the AST in whatever way they like rather than cherry-picked flavour-specific nodes we already filtered down to. similar to how eslint's rules can have visitors to specific AST node types.

i hope things are better with the family and what not too.

runem commented 4 years ago

Thank you so much for helping so much with this project, I really appreciate it! ❤️

Regarding visiting arbitrary nodes, I think it's an interesting path to explore, but it needs a really compelling use case in order to introduce. First of all, we already need to traverse the AST once to find custom elements and I want to keep the traversal of the AST at a minimum for performance reasons. In addition, I think the fact that rules operate on an abstraction simplifies the rule logic. LitAnalyzer is more specialised than ESLint, so I think it's a strength to operate on the abstraction. Again, I'm open for exploring it if you think it's important feature to have :+1:

Performance is also an area that I really want to improve, so I would also love some help setting up performance testing :-)

43081j commented 4 years ago

One example is #73 but really any potential rule which needs to operate on something more than what the WCA exposes can't really exist right now.

There will inevitably be some features of a file you don't want WCA to have explicit knowledge of (i.e. something that only matters to one rule).

Maybe though to keep things focused, the right way would be to introduce something to WCA however small/single-use-case.

runem commented 4 years ago

Version 1.2.0 has just been released :tada: This includes, among other things, a great improvement to type checking making the analyzer up to 15 times faster! You can read the changelog here: https://github.com/runem/lit-analyzer/releases/tag/v1.2.0