runem / lit-analyzer

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

Make maxInternalDepth and maxExternalDepth configurable. #116

Closed FelixSchuSi closed 4 years ago

FelixSchuSi commented 4 years ago

I made maxInternalDepth and maxExternalDepth configurable. The values can now be set under the name "moduleTraversalDepthInternal" and "moduleTraversalDepthExternal" via CLI argument, tsconfig or VSCode setting.

The default values stayed the same ("moduleTraversalDepthInternal" defaults to Infinity and "moduleTraversalDepthExternal" defaults to one).

Handling the value Infinity in JSON is tricky since it is not supported by the JSON format. I decided to allow string values and cast them to number when loading the config, so that the value Infinity can be represented with the string "Infinity".

I am not completely satisfied with the variable names and the descriptions. Please tell me what you think about them. Once we have agreed on the variable names I will add documentation.

runem commented 4 years ago

Infinity

I think using the string "Infinity" could become a bit inconvenient. What do you think about using -1 instead of "Infinity"?

Naming

I actually really like the description you made for the configs :-)

Here are some thoughts about the naming of the configs:

Here are some suggestions (unordered list) of what it could be called. What do you think?

Documentation

When you add documentation you will need to:

  1. Edit ./docs/readme/config-table.md
  2. npm run readme
  3. npm run prettier:write
FelixSchuSi commented 4 years ago

Thanks for the feedback!

Using -1 instead of "Infinity" is definitely a nicer way, I will change that soon!

For the names of the configs i found maxNodeModuleImportDepth & maxProjectImportDepth to be my favourite. I think that "NodeModule" and "Project" are a bit more intuitive than "internal" and "external".

runem commented 4 years ago

I also like them. Let's go with those two then!

runem commented 4 years ago

It looks great now, - I'll merge this in a couple of hours!