stoplightio / spectral

A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v3.1, v3.0, and v2.0 as well as AsyncAPI v2.x.
https://stoplight.io/spectral
Apache License 2.0
2.43k stars 235 forks source link

Numbers in message also show colon between the two number by default #2487

Open EPKLISN opened 1 year ago

EPKLISN commented 1 year ago

If having numbers in message from a function, it will always put in a ":" between the two first numbers by default.

The function: module.exports = (targetVal) => { var str = "0 1 2 3 4 5"; return [{ message: ${str}}]; };

The rule: numbers: description: " " message: "{{error}}" given:

The result: 1:1 error numbers 0:1 2 3 4 5

Environment (remove any that are not applicable):

Expectation: The colon should not be shown.

EPKLISN commented 1 year ago

Some clarification, it is between the "0" and "1" the colon should not appear.

P0lip commented 1 year ago

The issue is most likely caused by https://github.com/stoplightio/spectral/blob/develop/packages/formatters/src/stylish.ts#L85.