Variable: js-jsx-attribute-offset

js-jsx-attribute-offset is a customizable variable defined in js.el.gz.

Value

0

Documentation

Specifies a delta for JSXAttribute indentation.

Let js-indent-level be 2. When this variable is also set to 0, JSXAttribute indentation looks like this:

  <element
    attribute="value">
  </element>

Alternatively, when this variable is also set to 2, JSXAttribute indentation looks like this:

  <element
      attribute="value">
  </element>

This variable is like sgml-attribute-offset.

This variable was added, or its default value changed, in Emacs 27.1.

Probably introduced at or before Emacs version 27.1.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
;; This is how indentation behaved out-of-the-box until Emacs 27.  JSX
;; indentation was controlled with `sgml-basic-offset', which defaults
;; to 2, whereas `js-indent-level' defaults to 4.  Users who had the
;; same values configured for both their HTML and JS indentation would
;; luckily get consistent JSX indentation; most others were probably
;; unhappy.  I’d be surprised if anyone actually wants different
;; indentation levels, but just in case, here’s a way back to that.

(defcustom js-jsx-attribute-offset 0
  "Specifies a delta for JSXAttribute indentation.

Let `js-indent-level' be 2.  When this variable is also set to 0,
JSXAttribute indentation looks like this:

  <element
    attribute=\"value\">
  </element>

Alternatively, when this variable is also set to 2, JSXAttribute
indentation looks like this:

  <element
      attribute=\"value\">
  </element>

This variable is like `sgml-attribute-offset'."
  :version "27.1"
  :type 'integer
  :safe 'integerp)