added vscode settings and snippets

This commit is contained in:
Sebastian Sdorra
2018-07-12 08:49:41 +02:00
parent bf62eee4d5
commit 8bfef1616c
3 changed files with 108 additions and 1 deletions

10
scm-ui/.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,10 @@
{
"javascript.validate.enable": false,
// Set the default
"editor.formatOnSave": false,
// Enable per-language
"[javascript]": {
"editor.formatOnSave": true
},
"flow.pathToFlow": "${workspaceRoot}/node_modules/.bin/flow"
}

97
scm-ui/.vscode/snippets/javascript.json vendored Normal file
View File

@@ -0,0 +1,97 @@
{
"React default component": {
"prefix": "rdc",
"body": [
"//@flow",
"import React from \"react\";",
"",
"type Props = {};",
"",
"class $1 extends React.Component<Props> {",
" render() {",
" return <div />;",
" }",
"}",
"",
"export default $1;"
],
"description": "React default component with props"
},
"React styled component": {
"prefix": "rsc",
"body": [
"//@flow",
"import React from \"react\";",
"import injectSheet from \"react-jss\";",
"",
"const styles = {};",
"",
"type Props = {",
" classes: any",
"};",
"",
"class $1 extends React.Component<Props> {",
" render() {",
" const { classes } = this.props;",
" return <div />;",
" }",
"}",
"",
"export default injectSheet(styles)($1);"
],
"description": "React default component with props"
},
"React container component": {
"prefix": "rcc",
"body": [
"//@flow",
"import React from \"react\";",
"import { connect } from \"react-redux\";",
"",
"type Props = {};",
"",
"class $1 extends React.Component<Props> {",
" render() {",
" return <div />;",
" }",
"}",
"",
"const mapStateToProps = state => {",
" return {};",
"};",
"",
"const mapDispatchToProps = (dispatch) => {",
" return {};",
"};",
"",
"export default connect(",
" mapStateToProps,",
" mapDispatchToProps",
")($1);"
],
"description": "React component which is connected to the store"
},
"React component test": {
"prefix": "rct",
"body": [
"//@flow",
"import React from \"react\";",
"import { configure, shallow } from \"enzyme\";",
"import Adapter from \"enzyme-adapter-react-16\";",
"",
"import \"raf/polyfill\";",
"",
"configure({ adapter: new Adapter() });",
"",
"it(\"should render the component\", () => {",
" $0",
" //const label = shallow(<Label value=\"awesome\" />);",
" //expect(label.text()).toBe(\"awesome\");",
"});"
],
"description": "React component test with enzyme and jest"
}
}

View File

@@ -1,9 +1,9 @@
import React, { Component } from "react";
import type { ThunkDispatch } from "redux-thunk";
import Main from "./Main";
import Login from "./Login";
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
import { ThunkDispatch } from "redux-thunk";
import { fetchMe } from "../modules/me";
import "./App.css";