rokucommunity / bslint

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

Lint crashes due to out-of-date brighterscript #51

Closed regan-karlewicz closed 2 years ago

regan-karlewicz commented 2 years ago

Issue

I've ran into an issue where the linter crashes. I've determined the root cause is an out-of-date version of brighterscript as a dependency of bslint. My codebase is using brighterscript v0.41.6 and bslint v0.6.0. The version of brighterscript installed as the dependency of bslint is 0.40.1.

The code I am trying to lint that causes the crash can be found in this gist: https://gist.github.com/regan-karlewicz/f2295851e57778eaa9321e1aaefc572a

The stack trace:

> bslint

[12:09:19:1730 PM]  Using config file: "/Users/regankarlewicz/workspace/roku/roku-white-label/bsconfig.json"
[12:09:19:1770 PM]  Loading 1 plugins for cwd "/Users/regankarlewicz/workspace/roku/roku-white-label"
[12:09:19:1910 PM]  Parsing files
[12:09:19:9080 PM]  Parsing files finished. (1.687ms)
[12:09:19:9080 PM]  Validating project
TypeError: Cannot read properties of undefined (reading 'pathAbsolute')
    at Scope.detectVariableNamespaceCollisions (/Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Scope.js:433:116)
    at /Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Scope.js:399:18
    at Scope.enumerateBrsFiles (/Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Scope.js:256:17)
    at Scope._validate (/Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Scope.js:394:14)
    at /Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Scope.js:381:18
    at Logger.time (/Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Logger.js:139:20)
    at Scope.validate (/Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Scope.js:359:29)
    at /Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Program.js:436:27
    at Logger.time (/Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Logger.js:139:20)
    at /Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Program.js:433:25
TypeError: Cannot read properties of undefined (reading 'pathAbsolute')
    at Scope.detectVariableNamespaceCollisions (/Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Scope.js:433:116)
    at /Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Scope.js:399:18
    at Scope.enumerateBrsFiles (/Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Scope.js:256:17)
    at Scope._validate (/Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Scope.js:394:14)
    at /Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Scope.js:381:18
    at Logger.time (/Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Logger.js:139:20)
    at Scope.validate (/Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Scope.js:359:29)
    at /Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Program.js:436:27
    at Logger.time (/Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Logger.js:139:20)
    at /Users/regankarlewicz/workspace/roku/roku-white-label/node_modules/@rokucommunity/bslint/node_modules/brighterscript/dist/Program.js:433:25

Temporary Solution

I was able to resolve the issue on my end by manually patching my package-lock to have bslint use brighterscript version 0.41.6.

Solution

This can be fixed by updating the version of brighterscript used in this project