Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Standard ESLint for Create React App
- My linting setup for create-react-app applications using JavaScript Standard Style with support for experimental javascript features.
- ## Dependencies
- - create-react-app installed globally
- - VS Code ESLint extension (if using VS Code)
- ## Project Setup
- 1. Generate new React using `create-react-app <app-name>` and `cd <app-name>` into application directory.
- 2. Install linting packages
- `npm install --save-dev eslint standard eslint-config-standard eslint-config-standard-react eslint-plugin-promise eslint-plugin-react eslint-plugin-standard`
- 3. Create file `.eslintrc.js` in application root with the following (suggested) contents
- 4. ```javascript
- module.exports = {
- extends: ['standard', 'standard-react'],
- parser: 'babel-eslint',
- rules: {
- 'comma-dangle': ['error', 'always-multiline'],
- 'react/self-closing-comp': ['error', { "component": true, "html": false }],
- }
- }
- ```
- 5. VS Code Only: Open workspace preferences and turn on eslint.autoFixOnSave
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement