stamen / mapbox-gl-style-build

Build Mapbox GL styles by composing layers
MIT License
5 stars 3 forks source link

Inaccurate "unused variable" warnings #25

Open aparlato opened 1 month ago

aparlato commented 1 month ago

We appear to be emitting incorrect warnings for unused variables.

While most are accurate, the script isn't set up to understand an object can be a value so treats everything within it as a nested variable.

For example in:

source: {
      coolSource: {
        type: 'vector',
        tiles: [
          'https://url.mvt',
        ],
        maxzoom: 10,
      },
    }

everything under cool-source is in fact the variable, but the script sees the path to source.coolSource.maxzoom as a separate variable as well.

There are additional inaccuracies I have yet to get to the bottom of, so this ticket will require further investigation.

kateler commented 1 month ago

It would be awesome if you fixed this! I'm currently working around it by creating a whole unused stylesheet that contains all the "variables" like this. That suppresses the errors but is rather hacky.