+{CompositeDisposable} = require 'atom'
 
 module.exports =
   config:

        filePath = textEditor.getPath()
        text = textEditor.getText()
        parameters = ['--reporter', reporter, '--filename', filePath]
        if lintInlineJavaScript is true and ~textEditor.getGrammar().scopeName.indexOf 'text.html'
          parameters.push('--extract', 'always')
        parameters.push('-')
        return helpers.exec(exePath, parameters, {stdin: text}).then (output) ->

      default: false
      description: 'Lint JavaScript inside `<script>` blocks in HTML or PHP files'

  activate: ->
    @scopes = []
    @subscriptions = new CompositeDisposable
    @subscriptions.add atom.config.observe 'linter-jshint.lintInlineJavaScript',
      (lintInlineJavaScript) =>
        @scopes = ['source.js', 'source.js.jsx']
        if lintInlineJavaScript is true
          @scopes.push('source.js.embedded.html')

  deactivate: ->
    @subscriptions.dispose()

  provideLinter: ->
    if process.platform is 'win32'
      jshintPath = require('path').join(__dirname, '..', 'node_modules', '.bin', 'jshint.cmd')
    else
      jshintPath = require('path').join(__dirname, '..', 'node_modules', '.bin', 'jshint')
    helpers = require('atom-linter')
    reporter = require('jshint-json') # a string path
    provider =
      grammarScopes: @scopes
      scope: 'file'
      lintOnFly: true
      lint: (textEditor) ->
