Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add atomic values in API messages #91

Closed
regseb opened this issue Sep 21, 2023 · 1 comment · Fixed by #92
Closed

Add atomic values in API messages #91

regseb opened this issue Sep 21, 2023 · 1 comment · Fixed by #92

Comments

@regseb
Copy link
Contributor

regseb commented Sep 21, 2023

Actual

The JavaScript API returns messages with the following data:

messages: [
  {
    message: 'Element disallowed\n  At node \x1B[1m<line>\x1B[22m (16:7)',
    type: 'error'
  }
]

Processing this data is complicated by the fact that the message property contains a lot of information and is adapted to be displayed in the console.

Expected

The data would have to be extracted and returned in other properties:

messages: [
  {
    message: 'Element disallowed\n  At node \x1B[1m<line>\x1B[22m (16:7)',
    type: 'error',
    reason: 'Element disallowed at node <line>',
    line: 16,
    column: 7
  }
]

Extra information

I'm developing Metalint, a tool that aggregates the results of several linters. I'd like to integrate SVGLint, but I can't convert SVGLint results into a Metalint specific format.

Here's an example of how I convert HTMLHint results: metalint/src/core/wrapper/htmlhint.js

@ericcornelissen
Copy link
Contributor

ericcornelissen commented Sep 21, 2023

Thanks for the request, this seems like a reasonable thing to do. I think it's indeed important to keep the message and type unchanged to avoid breaking changes, but adding new values should be fine.

I'm too out of touch with this project to say how hard/easy this would be to achieve - in particular I'm unsure how this change would play with custom rules. In any case, I'd be happy to have a look at a Pull Request if you want to make a contribution (otherwise this project is somewhat dormant so you might not see this being implemented for a while...).


Off topic

I'm developing Metalint, a tool that aggregates the results of several linters. I'd like to integrate SVGLint, but I can't convert SVGLint results into a Metalint specific format.

Cool project 😉 For the package.json linting I'd suggest considering publint and arethetypeswrong. I also wonder what you'd think of including tools like type-coverage or licensee with it, as they're not conventional linters but could be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants