 module.exports =
 class AutoIndent
   constructor: (@editor) ->
-    # Eslint rules to use as default overidden by .eslintrc
-    # N.B. that this is not the same as the eslint rules in that
-    # the tab-spaces and 'tab's in eslintrc are converted to tabs based upon
-    # the Atom editor tab spacing.
-    # e.g. eslint indent [1,4] with an Atom tab spacing of 2 becomes indent [1,2]
-    @eslintIndentOptions  =
-      jsxClosingBracketLocation: [
-        1,
-        selfClosing: TAGALIGNED
-        nonEmpty: TAGALIGNED
-      ]
-      jsxIndent: [1,1]            # 1 = enabled, 1=#tabs
-      jsxIndentProps: [1,1]       # 1 = enabled, 1=#tabs
-
+    @autoJsx = atom.config.get('language-babel').autoIndentJSX
     # regex to search for tag open/close tag and close tag
     @JSXREGEXP = /(<)([$_A-Za-z](?:[$_.:\-A-Za-z0-9])*)|(\/>)|(<\/)([$_A-Za-z](?:[$._:\-A-Za-z0-9])*)(>)|(>)|({)|(})|(\?)|(:)/g
-
     @mouseUp = true
     @multipleCursorTrigger = 1
-
     @disposables = new CompositeDisposable()
-
-    @autoJsx = atom.config.get('language-babel').autoIndentJSX
+    @eslintIndentOptions = @getIndentOptions()
 
     @disposables.add atom.commands.add 'atom-text-editor',
-      'language-babel:auto-indent-jsx-on': (event) =>  @autoJsx = true
+      'language-babel:auto-indent-jsx-on': (event) =>
+        @autoJsx = true
+        @eslintIndentOptions = @getIndentOptions()
+
     @disposables.add atom.commands.add 'atom-text-editor',
       'language-babel:auto-indent-jsx-off': (event) =>  @autoJsx = false
+
     @disposables.add atom.commands.add 'atom-text-editor',
-      'language-babel:toggle-auto-indent-jsx': (event) =>  @autoJsx = not @autoJsx
+      'language-babel:toggle-auto-indent-jsx': (event) =>
+        @autoJsx = not @autoJsx
+        if @autoJsx then @eslintIndentOptions = @getIndentOptions()
 
     document.addEventListener 'mousedown', => @mouseUp = false
     document.addEventListener 'mouseup', => @mouseUp = true
 
     @disposables.add @editor.onDidChangeCursorPosition (event) => @changedCursorPosition(event)
     @disposables.add @editor.onDidStopChanging () => @didStopChanging()
-
-    if @eslintrcFilename = @getEslintrcFilename()
-      @eslintrcFilename = new File(@eslintrcFilename)
-      @readEslintrcOptions(@eslintrcFilename.getPath())
-      # watch eslintrc for changes
-      @disposables.add @eslintrcFilename.onDidChange =>
-        return unless @autoJsx
-        @readEslintrcOptions(@eslintrcFilename.getPath())
 
   destroy: () ->
     @disposables.dispose()

      return @editor.indentationForBufferRow row if  /.*\S/.test line
    return 0

  # return text string of a project based .eslintrc file if one exists
  getEslintrcFilename: () ->
    projectContainingSource = atom.project.relativizePath @editor.getPath()

                  parentTokenIdx? and
                  tokenStack[parentTokenIdx].type is BRACE_OPEN and
                  tokenStack[parentTokenIdx].row is ( row - 1)
                    tagIndentation = firstCharIndentation =
                      @eslintIndentOptions.jsxIndent[1] + @getIndentOfPreviousRow row
                    indentRecalc = @indentRow({row: row, blockIndent: firstCharIndentation})
              else if parentTokenIdx?
                indentRecalc = @indentRow({row: row, blockIndent: tokenStack[parentTokenIdx].firstCharIndentation, jsxIndent: 1 } )
