Skip to content

Instantly share code, notes, and snippets.

@belachkar
Last active May 13, 2021 01:48
Show Gist options
  • Save belachkar/348a7dda23f88420e6f6f28da166e0bf to your computer and use it in GitHub Desktop.
Save belachkar/348a7dda23f88420e6f6f28da166e0bf to your computer and use it in GitHub Desktop.

Eslint React Configuration

A simple example of .eslintrc configuration, with

  • max-len of 110 characters per line.
  • Parser babel-eslint for better support of new features.
  • Fix error: 'React' must be in scope when using JSX react/react-in-jsx-scope:

.eslintrc.json:

{
	"env": {
		"browser": true,
		"es2021": true
	},
	"extends": [
		"eslint:recommended",
		"plugin:react/recommended"
	],
	"parser": "babel-eslint",
	"parserOptions": {
		"ecmaFeatures": {
			"jsx": true
		},
		"ecmaVersion": 12,
		"sourceType": "module"
	},
	"plugins": [
		"react"
	],
	"rules": {
		"no-unused-vars": "warn",
		"react/react-in-jsx-scope": "off",
		"max-len": [
			1,
			110,
			2
		]
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment