Skip to content

Instantly share code, notes, and snippets.

@jwestarb
Last active February 23, 2020 20:40
Show Gist options
  • Save jwestarb/d82943a3c4d1036f601dffd36da8b086 to your computer and use it in GitHub Desktop.
Save jwestarb/d82943a3c4d1036f601dffd36da8b086 to your computer and use it in GitHub Desktop.
Init React Web project without pwa

yarn create react-app nome_do_projeto

rm README.md rm public/manifest.json rm public/logo192.png rm public/logo512.png rm src/App.css rm src/App.test.js rm src/index.css rm src/logo.svg rm src/serviceWorker.js rm src/setupTests.js

create .editorconfig file: root = true

[*] indent_style = space indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true

yarn add eslint -D yarn eslint --init

To check syntax, find problems, and enforce code style JavaScript modules (import/export) React ? Does your project use TypeScript? (y/N) N (*) Browser Use a popular style guide Airbnb: https://github.com/airbnb/javascript JavaScript ? Would you like to install them now with npm? (Y/n) Y

rm package-lock.json yarn yarn add prettier eslint-config-prettier eslint-plugin-prettier babel-eslint -D

Edit .eslintrc.js

module.exports = { env: { browser: true, es6: true, }, extends: [ 'plugin:react/recommended', 'airbnb', 'prettier', 'prettier/react' ], globals: { Atomics: 'readonly', SharedArrayBuffer: 'readonly', }, parser: 'babel-eslint', parserOptions: { ecmaFeatures: { jsx: true, }, ecmaVersion: 2018, sourceType: 'module', }, plugins: [ 'react', 'prettier' ], rules: { 'prettier/prettier': 'error', 'react/jsx-filename-extension': [ 'warn', { extensions: ['.jsx', '.js'] } ], 'import/prefer-default-export': 'off', 'react/state-in-constructor': 'off' }, };

Create file .prettierrc

{ "singleQuote": true, "trailingComma": "es5" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment