my-jetbrains-settings/templates/React.xml

202 lines
14 KiB
XML

<templateSet group="React">
<template name="rccp" value="import React, { Component } from 'react';&#10;import PropTypes from 'prop-types';&#10;&#10;class $componentName$ extends Component {&#10; render() {&#10; return (&#10; &lt;div&gt;&#10; $END$&#10; &lt;/div&gt;&#10; );&#10; }&#10;}&#10;&#10;$componentName$.propTypes = {&#10;&#10;};&#10;&#10;export default $componentName$;&#10;" description="Creates a React component class with PropTypes and ES6 module system" toReformat="true" toShortenFQNames="true">
<variable name="componentName" expression="" defaultValue="&quot;MyComponent&quot;" alwaysStopAt="true" />
<context />
</template>
<template name="rrc" value="import React, { Component } from 'react';&#10;import { connect } from 'react-redux';&#10; &#10;class $componentName$ extends Component {&#10; render() {&#10; return (&#10; &lt;div&gt;&#10; $END$&#10; &lt;/div&gt;&#10; );&#10; }&#10;}&#10; &#10;function mapStateToProps(state) {&#10; return {&#10; &#10; };&#10;} &#10; &#10;export default connect(&#10; mapStateToProps,&#10;)($componentName$);&#10;" description="Creates a React component class connected to redux" toReformat="true" toShortenFQNames="true">
<variable name="componentName" expression="" defaultValue="&quot;MyComponent&quot;" alwaysStopAt="true" />
<context>
<option name="TypeScript" value="true" />
</context>
</template>
<template name="rcfc" value="import React, { Component } from 'react';&#10;import PropTypes from 'prop-types';&#10;&#10;class $componentName$ extends Component {&#10; constructor(props) {&#10; super(props);&#10; }&#10; &#10; componentWillMount() {&#10; &#10; }&#10; &#10; componentDidMount() {&#10; &#10; }&#10; &#10; componentWillReceiveProps(nextProps) {&#10; &#10; }&#10; &#10; shouldComponentUpdate(nextProps, nextState) {&#10; &#10; }&#10; &#10; componentWillUpdate(nextProps, nextState) {&#10; &#10; }&#10; &#10; componentDidUpdate(prevProps, prevState) {&#10; &#10; }&#10; &#10; componentWillUnmount() {&#10; &#10; }&#10; &#10; render() {&#10; return (&#10; &lt;div&gt;&#10; $END$&#10; &lt;/div&gt;&#10; );&#10; }&#10;}&#10;&#10;$componentName$.propTypes = {&#10;&#10;};&#10;&#10;export default $componentName$;&#10;" description="Creates a React component class with PropTypes and all lifecycle methods and ES6 module system" toReformat="true" toShortenFQNames="true">
<variable name="componentName" expression="" defaultValue="&quot;MyComponent&quot;" alwaysStopAt="true" />
<context />
</template>
<template name="rsc" value="import React from 'react';&#10;&#10;const $componentName$ = () =&gt; {&#10; return (&#10; &lt;div&gt;&#10; $END$&#10; &lt;/div&gt;&#10; );&#10;};&#10;&#10;export default $componentName$;&#10;" description="Creates a stateless React component without PropTypes and ES6 module system" toReformat="true" toShortenFQNames="true">
<variable name="componentName" expression="" defaultValue="&quot;MyComponent&quot;" alwaysStopAt="true" />
<context />
</template>
<template name="rscp" value="import React from 'react';&#10;import PropTypes from 'prop-types';&#10;&#10;const $componentName$ = props =&gt; {&#10; return (&#10; &lt;div&gt;&#10; &#10; &lt;/div&gt;&#10; );&#10;};&#10;&#10;$componentName$.propTypes = {&#10; $END$&#10;};&#10;&#10;export default $componentName$;&#10;" description="Creates a stateless React component with PropTypes and ES6 module system" toReformat="true" toShortenFQNames="true">
<variable name="componentName" expression="" defaultValue="&quot;MyComponent&quot;" alwaysStopAt="true" />
<context />
</template>
<template name="con" value="constructor(props) {&#10; super(props);&#10; $END$&#10;}&#10;" description="Adds a default constructor for the class that contains props as arguments" toReformat="true" toShortenFQNames="true">
<context />
</template>
<template name="conc" value="constructor(props, context) {&#10; super(props, context);&#10; $END$&#10;}&#10;" description="Adds a default constructor for the class that contains props and context as arguments" toReformat="true" toShortenFQNames="true">
<context />
</template>
<template name="cwm" value="componentWillMount() {&#10; $END$&#10;}&#10;" description="Invoked once, both on the client and server, immediately before the initial rendering occurs" toReformat="true" toShortenFQNames="true">
<context />
</template>
<template name="cdm" value="&#10;componentDidMount() {&#10; $END$&#10;}&#10;" description="Invoked once, only on the client (not on the server), immediately after the initial rendering occurs." toReformat="true" toShortenFQNames="true">
<context />
</template>
<template name="cwr" value="componentWillReceiveProps(nextProps) {&#10; $END$&#10;}&#10;" description="Invoked when a component is receiving new props. This method is not called for the initial render." toReformat="true" toShortenFQNames="true">
<context />
</template>
<template name="scu" value="&#10;shouldComponentUpdate(nextProps, nextState) {&#10; $END$&#10;}&#10;" description="Invoked before rendering when new props or state are being received." toReformat="true" toShortenFQNames="true">
<context>
<option name="JS_EXPRESSION" value="true" />
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="cwup" value="componentWillUpdate(nextProps, nextState) {&#10; $END$&#10;}&#10;" description="Invoked immediately before rendering when new props or state are being received." toReformat="true" toShortenFQNames="true">
<context />
</template>
<template name="cdup" value="&#10;componentDidUpdate(prevProps, prevState) {&#10; $END$&#10;}&#10;" description="Invoked immediately after the component's updates are flushed to the DOM." toReformat="true" toShortenFQNames="true">
<context />
</template>
<template name="cwun" value="componentWillUnmount() {&#10; $END$&#10;}&#10;" description="Invoked immediately before a component is unmounted from the DOM." toReformat="true" toShortenFQNames="true">
<context />
</template>
<template name="ren" value="&#10;render() {&#10; return (&#10; &lt;div&gt;&#10; $END$&#10; &lt;/div&gt;&#10; );&#10;}&#10;" description="When called, it should examine this.props and this.state and return a single child element." toReformat="true" toShortenFQNames="true">
<context />
</template>
<template name="ssf" value="&#10;this.setState((state, props) =&gt; { &#10; return {&#10; $END$ &#10; };&#10;});&#10;" description="Performs a shallow merge of nextState into current state" toReformat="false" toShortenFQNames="true">
<context />
</template>
<template name="pta" value="PropTypes.array," description="Array prop type" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_EXPRESSION" value="false" />
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptar" value="PropTypes.array.isRequired," description="Array prop type required" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptb" value="PropTypes.bool," description="Bool prop type" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptbr" value="PropTypes.bool.isRequired," description="Bool prop type required" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptf" value="PropTypes.func," description="Func prop type" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptfr" value="PropTypes.func.isRequired," description="Func prop type required" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptn" value="PropTypes.number," description="Number prop type" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptnr" value="PropTypes.number.isRequired," description="Number prop type required" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="pto" value="PropTypes.object," description="Object prop type" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptor" value="PropTypes.object.isRequired," description="Object prop type required" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="pts" value="PropTypes.string," description="String prop type" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptsr" value="PropTypes.string.isRequired," description="String prop type required" toReformat="false" toShortenFQNames="true">
<context />
</template>
<template name="ptnd" value="PropTypes.node," description="Anything that can be rendered: numbers, strings, elements or an array" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptndr" value="PropTypes.node.isRequired," description="Anything that can be rendered: numbers, strings, elements or an array required" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptel" value="PropTypes.element," description="React element prop type" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptelr" value="PropTypes.element.isRequired," description="React element prop type required" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="pti" value="PropTypes.instanceOf($END$)," description="Is an instance of a class prop type" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptir" value="PropTypes.instanceOf($0).isRequired," description="Is an instance of a class prop type required" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="pte" value="PropTypes.oneOf(['$END$'])," description="Prop type limited to specific values by treating it as an enum" toReformat="true" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="pter" value="PropTypes.oneOf(['$END$']).isRequired," description="Prop type limited to specific values by treating it as an enum required" toReformat="true" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptet" value="PropTypes.oneOfType([&#10; $END$&#10;])," description="An object that could be one of many types" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptetr" value="PropTypes.oneOfType([&#10; $END$&#10;]).isRequired," description="An object that could be one of many types required" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptao" value="PropTypes.arrayOf($END$)," description="An array of a certain type" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptaor" value="PropTypes.arrayOf($END$).isRequired," description="An array of a certain type required" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptoo" value="PropTypes.objectOf($END$)," description="An object with property values of a certain type" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptoor" value="PropTypes.objectOf($END$).isRequired," description="An object with property values of a certain type required" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ptsh" value="PropTypes.shape({&#10; $END$&#10;})," description="An object taking on a particular shape" toReformat="false" toShortenFQNames="true">
<context>
<option name="JS_EXPRESSION" value="false" />
<option name="TS_EXPRESSION" value="true" />
</context>
</template>
<template name="ptshr" value="PropTypes.shape({&#10; $END$&#10;}).isRequired," description="An object taking on a particular shape required" toReformat="false" toShortenFQNames="true">
<context />
</template>
<template name="rcc" value="import React, { Component } from 'react';&#10;&#10;class $TM_FILENAME_BASE$ extends Component {&#10; render() {&#10; return (&#10; &lt;div&gt;&#10; $END$&#10; &lt;/div&gt;&#10; );&#10; }&#10;}&#10;&#10;export default $TM_FILENAME_BASE$;" description="Creates a A higher-order component" toReformat="true" toShortenFQNames="true">
<variable name="TM_FILENAME_BASE" expression="capitalize(camelCase(fileNameWithoutExtension()))" defaultValue="&quot;&quot;" alwaysStopAt="true" />
<context />
</template>
</templateSet>