Skip to content

Instantly share code, notes, and snippets.

View AdamRamberg's full-sized avatar
💻

Adam Ramberg AdamRamberg

💻
View GitHub Profile
@AdamRamberg
AdamRamberg / .editorconfig
Created July 21, 2018 16:01
react-from-scratch .editorconfig
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@AdamRamberg
AdamRamberg / prettier.config.js
Created July 21, 2018 16:03
react-from-scratch prettier.config.js
module.exports = {
printWidth: 80,
semi: true,
singleQuote: true,
trailingComma: 'all',
};
@AdamRamberg
AdamRamberg / .eslintrc.js
Created July 21, 2018 16:04
react-from-scratch .eslintrc.js
const prettierOptions = require('./prettier.config');
module.exports = {
parser: 'babel-eslint',
extends: ['airbnb', 'prettier', 'prettier/react'],
plugins: ['prettier', 'react', 'jsx-a11y'],
env: {
browser: true,
node: true,
jest: true,
@AdamRamberg
AdamRamberg / index.js
Created July 21, 2018 16:06
react-from-scratch index.js
import React from 'react';
import ReactDOM from 'react-dom';
const App = () => <div>Howdy traveller!</div>;
ReactDOM.render(<App />, document.getElementById('root'));
@AdamRamberg
AdamRamberg / index.html
Created July 21, 2018 16:06
react-from-scratch index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- Make mobile compatible -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My React app</title>
</head>
@AdamRamberg
AdamRamberg / babel.config.js
Created July 21, 2018 16:07
react-from-scratch babel.config.js
module.exports = api => {
api.cache.invalidate(() => process.env.NODE_ENV === 'production');
return {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
},
],
@AdamRamberg
AdamRamberg / .browserlistrc
Created July 21, 2018 16:08
react-from-scratch .browserlistrc
> 0.25%
not dead
@AdamRamberg
AdamRamberg / webpack.base.js
Created July 21, 2018 16:09
react-from-scratch webpack.base.js
const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const plugins = [
new HtmlWebPackPlugin({
inject: true,
template: path.join(process.cwd(), 'src/index.html'),
}),
];
@AdamRamberg
AdamRamberg / webpack.dev.js
Created July 21, 2018 16:10
react-from-scratch webpack.dev.js
const webpack = require('webpack');
const plugins = [new webpack.HotModuleReplacementPlugin()];
module.exports = require('./webpack.base')({
mode: 'development',
devServer: {
hot: true,
port: 3000,
},
@AdamRamberg
AdamRamberg / webpack.prod.js
Created July 21, 2018 16:11
react-from-scratch webpack.prod.js
const path = require('path');
const plugins = [];
module.exports = require('./webpack.base')({
mode: 'production',
devServer: {
port: 3000,
contentBase: path.join(process.cwd(), 'dist/'),
},
plugins,