Skip to content

Instantly share code, notes, and snippets.

@kodeFant
Last active August 12, 2018 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kodeFant/98bd5dae58d7e114b7e81f3059b2fffb to your computer and use it in GitHub Desktop.
Save kodeFant/98bd5dae58d7e114b7e81f3059b2fffb to your computer and use it in GitHub Desktop.
Laravel 5.6 API / React 16 / Visual Studio Code setup

Set React Scaffolding for Laravel Project

php artisan preset react && npm install && npm run dev 

Adding create-react-app-linter options to any React Project

Reference https://www.npmjs.com/package/eslint-config-react-app

npm install --save-dev eslint-config-react-app babel-eslint@^7.2.3 eslint@^4.1.1 eslint-plugin-flowtype@^2.34.1 eslint-plugin-import@^2.6.0 eslint-plugin-jsx-a11y@^5.1.1 eslint-plugin-react@^7.1.0 babel-preset-env babel-preset-react-app

Installing dependencies for autoformatting (Prettier) based on eslint

npm install --save-dev eslint-config-prettier@^2.9.0 eslint-plugin-prettier@^2.6.0 prettier@^1.11.1 pretty-quick@^1.4.1
{
"presets": [
[
"env",
{
"modules": false
}
],
"react-app"
]
}
{
"extends": ["react-app", "plugin:prettier/recommended"]
}
{
"scripts": {
"precommit": "pretty-quick --staged"
}
{
"editor.formatOnSave": true,
"[javascript]": {
"editor.formatOnSave": false
},
"eslint.autoFixOnSave": true,
"eslint.alwaysShowStatus": true,
"prettier.disableLanguages": [
"js"
],
"files.autoSave": "onFocusChange",
}
// routes/web.php
// Direct all routes to index.bladde.php
// and lets React Router do rest of the routing
Route::get('/{path?}', function () {
return view('index');
})->where('path', '.*');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment