UNPKG

eslint-plugin-styled-component-jsx-attributes

Version:

A simple plugin for enforcing the use of the id attribute on styled components.

13 lines (11 loc) 696 B
"use strict"; var _require = require('./constants'), __UNKNOWN_IDENTIFER__ = _require.__UNKNOWN_IDENTIFER__; module.exports = function (_ref) { var key = _ref.key, value = _ref.value; return (// we set all attributes which are variable identifiers as '__UNKNOWN_IDENTIFER__' just so there can be some value for the kv pair since we have no way of knowing the real value. // thus, here we want to just plug that string in without any quotes so the linter treats it just like a variable would have been handled normally "".concat(key, "=").concat(typeof value !== 'string' || value === __UNKNOWN_IDENTIFER__ ? "{".concat(value, "}") : "\"".concat(value, "\""), " ") ); };