rokucommunity / bslint

A linter for BrightScript and BrighterScript.
MIT License
27 stars 14 forks source link

Cannot filter out LINT1001 #110

Closed max-curzi closed 1 month ago

max-curzi commented 1 month ago

I've added a simple bslint.json with everything disabled, except for unsafe-path-loop which returns a very useful LINT1003 error.

However, bslint still returns LINT1001 errors. Note that these look different than the 1001 errors displayed when not using the bslint plugin.

image

I can filter the (1001) with bsconfig.json diagnosticFilters, but I don't know how to filter out the LINT1001 ones, maybe the "rules" section is incomplete?

This is my bslint.json

{
    "rules": {
      "aa-comma-style": "off",
      "anon-function-style": "off",
      "assign-all-paths": "off",
      "block-if-style": "off",
      "case-sensitivity": "off",
      "condition-style": "off",
      "consistent-return": "off",
      "eol-last": "off",
      "inline-if-style": "off",
      "named-function-style": "off",
      "no-print": "off",
      "no-stop": "off",
      "no-todo": "off",
      "todo-pattern": "TODO|todo|FIXME",
      "type-annotations": "off",
      "unreachable-code": "off",
      "unsafe-iterators": "off",
      "unsafe-path-loop": "error",
      "unused-variable": "off"
    },
    "globals": [],
    "ignores": []
  }
TwitchBronBron commented 1 month ago

The paths in diagnosticFilters are a little unique. I think they're relative to rootDir rather than relative to the folder where the bsconfig.json resides. Can you try rewriting the diagnosticFilters with that in mind, see if that works? diagnosticFilters definitely apply to bslint diagnostics as well.

image

max-curzi commented 1 month ago

I tried all sorts of paths in bsconfig.json (with and without the "src" field in diagnosticFilters).

diagnosticFilters: [
        {"src": <many different path variations>, "codes": [1001]}
]

and tried moving bsconfig+bslint in the root folder (rather than the relevant subfolder), adjusting paths as I went.

I did notice that when I had file mappings like

"files": [        {
            "src": "../foo/Foo.brs",
            "dest": "foobar/foo.brs"
        },

then in diagnosticFilters I had to use {"src": "../foo/**", "codes": [1001]}

but that only worked for the brs(1001) and not the brs(LINT1001) errors.

TwitchBronBron commented 1 month ago

You need to specify the lint code too:


{"src": "../foo/**", "codes": [1001, "LINT1001"]}
max-curzi commented 1 month ago

ah that didn't work originally, but that was before I tweaked the "src"! I think I got it right now, thanks!

TwitchBronBron commented 1 month ago

Great! Glad you got it working.