Skip to content

Commit

Permalink
Before react basic configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
criaturaExperimental committed Feb 15, 2020
1 parent f8d19b7 commit aa4b1de
Show file tree
Hide file tree
Showing 8 changed files with 7,790 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
env: {
browser: true,
es6: true
},
extends: ['plugin:react/recommended', 'airbnb'],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2018,
sourceType: 'module'
},
plugins: ['react', '@typescript-eslint'],
rules: {
'comma-dangle': ['error', 'never'],
'arrow-parens': ['error', 'as-needed']
}
};
5 changes: 5 additions & 0 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import sum from '../src/index';

test('Testing test suite', () => {
expect(sum(1, 1)).toBe(2);
});
8 changes: 8 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* eslint-disable no-unused-vars */
module.exports = api => {
const isTest = api.env('test');

return {
presets: ['@babel/preset-env']
};
};
49 changes: 49 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "diecision-maker",
"version": "1.0.0",
"description": "Let the roll decide",
"main": "index.js",
"author": "Lucas deGomez <[email protected]>",
"scripts": {
"start": "webpack-dev-server",
"build": "webpack",
"test": "jest"
},
"license": "MPL-2.0",
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/preset-env": "^7.8.4",
"@types/react": "^16.9.19",
"@types/react-dom": "^16.9.5",
"@typescript-eslint/eslint-plugin": "^2.19.2",
"@typescript-eslint/parser": "^2.19.2",
"babel-loader": "^8.0.6",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-react-hooks": "^1.7.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^25.1.0",
"prettier": "^1.19.1",
"source-map-loader": "^0.2.4",
"ts-loader": "^6.2.1",
"typescript": "^3.7.5",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
},
"dependencies": {
"react": "^16.12.0",
"react-dom": "^16.12.0"
},
"jest": {
"moduleFileExtensions": ["js", "jsx"],
"moduleDirectories": ["node_modules", "shared"],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less|scss)$": "identity-obj-proxy"
}
}
}
15 changes: 15 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello world</title>
</head>

<body>
<h1>Loading ...</h1>
<script src="bundle.js"></script>
</body>

</html>
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
console.log('Hello from webpack');

function sum(a, b) {
return a + b;
}

module.exports = sum;
32 changes: 32 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const path = require('path');
const webpack = require('webpack');

module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: {
app: './src/index.js'
},
devServer: {
contentBase: './public',
port: 4000,
watchContentBase: true,
open: true,
hot: true
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
}
]
},
plugins: [new webpack.HotModuleReplacementPlugin()],
output: {
path: path.resolve(__dirname, 'public'),
filename: 'bundle.js'
}
};
Loading

0 comments on commit aa4b1de

Please sign in to comment.