Skip to content
Steel Brain edited this page Feb 22, 2016 · 4 revisions

In the recent versions of linter, linter is only the base package now and even the UI is handled by external packages. Linter UI API allows people to use/write their own UIs for linters to make it fit their tastes.

Defining a provider

You will need to add this to your package.json file

"providedServices": {
  "linter-ui": {
    "versions": {
      "1.0.0": "provideLinterUI"
    }
  }
}

Here's an example package returning a linter UI provider

Note: You can return more than one provider at once by wrapping them in an Array.

'use babel'
module.exports = {
  activate() {
    console.log('My package was activated')
  },
  deactivate() {
    console.log('My package was deactivated')
  },
  provideLinterUI() {
    const provider = {
      name: 'Fancy UI',
      activate() {
        console.log('add panels and other stuff here')
      },
      didCalculateMessages({added, removed, messages}) {
        console.log('new messages', added)
        console.log('removed messages', removed)
        console.log('all messages', messages)
      },
      didBeginLinting(linter, filePath) {
        console.log('linter ', linter.name || 'Unknown', 'started linting', filePath)
      },
      didFinishLinting(linter, filePath) {
        console.log('linter', linter.name || 'Unknown', 'finished linting', filePath)
      },
      dispose() {
        console.log('remove the panels here')
      }
    }
    return provider
  }
}
Clone this wiki locally