fluid-project / fluid-lint-all

Consolidated linting logic free from any particular build technology
BSD 3-Clause "New" or "Revised" License
0 stars 5 forks source link

JSON5 files with a different extension fail `json5lint` check with no error string. #7

Closed the-t-in-rtf closed 3 years ago

the-t-in-rtf commented 3 years ago

A valid JSON5 file with a different extension will fail the json5lint check with no error:

13:44:51.262:  Errors returned by json5lint:
13:44:51.262:  
13:44:51.262:    - tests/fixtures/json5/good.json5.with.extensions:
13:44:51.262:      Unexpected token ':'

It should correctly validate these files without error, and we should understand why there is no position information or message string.

the-t-in-rtf commented 3 years ago

This is the result of an implicit extension check in the path the json5 library provides to add JSON5 compatibility to require. The solution is to read the content ourselves and use JSON5.parse instead.