microsoft / sarif-js-sdk

JavaScript code and supporting files for working with the 'Static Analysis Results Interchange Format' (SARIF, see https://github.com/oasis-tcs/sarif-spec)
MIT License
26 stars 13 forks source link

TypeError: Cannot read property 'description' of undefined when running @microsoft/eslint-formatter-sarif #26

Closed zhanwang626 closed 3 years ago

zhanwang626 commented 3 years ago

When I running eslint -f @microsoft/eslint-formatter-sarif foo.js in a project met below error:

TypeError: Cannot read property 'description' of undefined
    at node_modules/@microsoft/eslint-formatter-sarif/sarif.js:152:57
    at Array.forEach (<anonymous>)

The line that caused above error is here

I found reason why I encounter this error is that some of the rulesMeta do not the property named docs e.g.

  'ember-best-practices/no-lifecycle-events': {
    message: 'Do not use events for lifecycle hooks. Please use the actual hooks instead: https://github.com/ember-best-practices/eslint-plugin-ember-best-practices/blob/master/guides/rules/no-lifecycle-events.md'
  },
  'ember-best-practices/no-observers': {
    message: 'Do not use observers. Consider using computed properties instead. Please see following guide for more information: https://github.com/ember-best-practices/eslint-plugin-ember-best-practices/blob/master/guides/rules/no-observers.md'
  },
  'ember-best-practices/no-send-action': {
    message: 'Do not use send action. Consider using closure actions to work with JS functions instead of relying on the old action system. Please see following guide for more information: https://github.com/ember-best-practices/eslint-plugin-ember-best-practices/blob/master/guides/rules/no-send-action.md'
  },

This will cause the command eslint -f @microsoft/eslint-formatter-sarif failed and can not output sarif.

scalvert commented 3 years ago

Hey @zhanwang626. We're currently moving the eslint formatter over to https://github.com/microsoft/sarif-js-sdk. Feel free to open this issue again in that repository.

eddynaka commented 3 years ago

@scalvert , i will move to sarif-js-sdk :)

eddynaka commented 3 years ago

@zhanwang626 , with your last pr, that fixes this issue, right?

zhanwang626 commented 3 years ago

@zhanwang626 , with your last pr, that fixes this issue, right?

Yes, I think so.

eddynaka commented 3 years ago

based on that, i will close the issue. thank you for the contribution :)