Skip to content

Instantly share code, notes, and snippets.

@haykerman
Created November 18, 2019 23:35
Show Gist options
  • Save haykerman/caadc955b04cd166e986fb3428fedb17 to your computer and use it in GitHub Desktop.
Save haykerman/caadc955b04cd166e986fb3428fedb17 to your computer and use it in GitHub Desktop.
A config file for ESLint.
module.exports = {
env: {
browser: true,
es6: true,
},
parser: 'babel-eslint',
extends: ['airbnb', 'prettier', 'prettier/react'],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parserOptions: {
ecmaFeatures: {
jsx: true,
modules: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['react', 'prettier'],
rules: {
'prettier/prettier': 'error',
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'react/forbid-prop-types': [0, { forbid: ['any'] }],
'react/prop-types': 0,
},
env: {
jest: true,
browser: true,
node: true,
},
};
@gwpantazes
Copy link

I was reading https://medium.com/@haykerman/setting-up-eslint-prettier-for-react-app-in-vscode-8662de2d9a96 when I think I noticed an error.
There are two env objects, and the one at the end will overwrite the one at the beginning. The overwrite will retain browser because both env objects have browser: true, but es6: true will get wiped away by the overwrite.
Can you please verify if there is an error here, of if the two separate env properties are indeed meant to be separate?

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