Using Ts-Standard linting, JSDoc comment at beginning of file triggers "This rule requires the `strictNullChecks` compiler option" error Using Ts-Standard linting, JSDoc comment at beginning of file triggers "This rule requires the `strictNullChecks` compiler option" error

I'm using Typescript and the TS-standard version of StandardJS's ESlint plugin and extension for VSCode. I have been using JSDoc-style comment blocks (/** Some text */) at the beginning of javascript and now typescript files to indicate things like author and give a general overview of the contents of the file. I was using the standardJS eslint plugin already, but it generally didn't work properly on my code library, never figured out why.

Recently I started upgrading my codebase to Typescript, and now I'm getting this error on all of these comment blocks: This rule requires the `strictNullChecks` compiler option to be turned on to function correctly. (@typescript-eslint/strict-boolean-expressions)ts-standard(@typescript-eslint/strict-boolean-expressions) I tried turning on the strictNullChecks option, and it did indeed clear that error, but is also a nightmare for certain places where I know values aren't going to be null if the object exists at all (and using the ? operator doesn't always seem to disable the "object might be null!" panic), so I disabled it again.

But why does this error populate for a doc comment at the beginning of the file anyway? This makes no sense. What do strict null checks have to do with a doc comment? Is there any other way around this error?



from Stackoverflow

Comments

Popular posts from this blog

\\u0000 cannot be converted to text error \\u0000 cannot be converted to text error

How to extract items from a subarray and push them to the main array