提交 800dfb4c 编写于 作者: S Sergey Petushkov

Remove excessive newlines; Fix CONTRIBUTING.md; Fix some linting errors

上级 2925a102
......@@ -30,7 +30,11 @@ Please also give the code of conduct a read.
## How do I set up the project?
To make development process easier, you could use a sandbox provided in this repo.
Run `npm install` and edit code in the `src/` folder. It's luckily very simple! :wink:
## How do I verify and test my changes?
To make development process easier, you could use a sandbox provided in this repo.
To use the sandbox, follow these steps:
1. Go to sandbox folder: `cd sandbox`
......@@ -41,13 +45,10 @@ To use the sandbox, follow these steps:
Now you should have the sandbox running on `localhost:3000`
In the sandbox `styled-components` is an alias to `styled-components/src` folder, so you can edit the source directly and dev-server will handle
rebuilding the source and livereloading your sandbox after the build is done.
Sandbox supports client-side and server-side rendering.
You can use an interactive editor, powered by [`react-live`](https://react-live.philpl.com/), to test your changes. But if you want more control,
you can edit the sandbox itseft:
You can use an interactive editor, powered by [`react-live`](https://react-live.philpl.com/), to
test your changes. But if you want more control, you can edit the sandbox itseft:
- Root `<App>` componens is located at `styled-components/sandbox/src/App.js` file
......@@ -55,6 +56,10 @@ you can edit the sandbox itseft:
- Server-side entry point is at `styled-components/sandbox/src/server.js`
In the sandbox source, `styled-components` is an alias to `styled-components/src` folder,
so you can edit the source directly and dev-server will handle rebuilding the source and
livereloading your sandbox after the build is done.
When you commit our pre-commit hook will run, which executes `lint-staged`. It will run
the linter automatically and warn you, if the code you've written doesn't comply with our
code style.
/* eslint-disable flowtype/require-valid-file-annotation */
const fs = require('fs')
const path = require('path')
const express = require('express')
const webpackDevMiddleware = require('webpack-dev-middleware')
const webpack = require('webpack')
const { CONFIG, logger } = require('./util')
const webpackConfig = require('./webpack.config.dev')
const livereloadMiddleware = require('./livereload/middleware')
const compiler = webpack(webpackConfig)
......@@ -40,6 +34,7 @@ app.get('*', (req, res) => {
)
// Then we evaluate this script to get prerendered content
// WARN: This is a hacky solution, that should be refactored to somethig better.
const { html, css } = eval(serverScript) // eslint-disable-line no-eval
// Replace placeholders in index.html template
......
/* eslint-disable flowtype/require-valid-file-annotation */
import React from 'react'
import { hydrate } from 'react-dom'
import App from './App'
......
/* eslint-disable flowtype/require-valid-file-annotation */
import React from 'react'
import { renderToString } from 'react-dom/server'
import { ServerStyleSheet } from 'styled-components'
......
......@@ -2,9 +2,11 @@
import type { Interpolation, Target } from '../types'
export default (css: Function) => {
const constructWithOptions = (componentConstructor: Function,
tag: Target,
options: Object = {}) => {
const constructWithOptions = (
componentConstructor: Function,
tag: Target,
options: Object = {},
) => {
if (typeof tag !== 'string' && typeof tag !== 'function') {
// $FlowInvalidInputTest
throw new Error(`Cannot create styled-component for component: ${tag}`)
......
......@@ -19,7 +19,7 @@ const createBroadcast = (initialState: mixed): Broadcast => {
function publish(nextState: mixed) {
state = nextState
// eslint-disable-next-line guard-for-in, no-restricted-syntax
// eslint-disable-next-line guard-for-in, no-restricted-syntax
for (const key in listeners) {
const listener = listeners[key]
if (listener === undefined) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册