Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. # Standard ESLint for Create React App
  2.  
  3. My linting setup for create-react-app applications using JavaScript Standard Style with support for experimental javascript features.
  4.  
  5. ## Dependencies
  6.  
  7. - create-react-app installed globally
  8.  
  9. - VS Code ESLint extension (if using VS Code)
  10.  
  11. ## Project Setup
  12.  
  13. 1. Generate new React using `create-react-app <app-name>` and `cd <app-name>` into application directory.
  14.  
  15. 2. Install linting packages
  16. `npm install --save-dev eslint standard eslint-config-standard eslint-config-standard-react eslint-plugin-promise eslint-plugin-react eslint-plugin-standard`
  17.  
  18. 3. Create file `.eslintrc.js` in application root with the following (suggested) contents
  19.  
  20. 4. ```javascript
  21. module.exports = {
  22. extends: ['standard', 'standard-react'],
  23. parser: 'babel-eslint',
  24. rules: {
  25. 'comma-dangle': ['error', 'always-multiline'],
  26. 'react/self-closing-comp': ['error', { "component": true, "html": false }],
  27. }
  28. }
  29. ```
  30.  
  31. 5. VS Code Only: Open workspace preferences and turn on eslint.autoFixOnSave
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement