root = true
[*]
end_of_line = lf
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
yarn add eslint -D
yarn eslint --init
- check syntax, find problems, and enforce code style
- Javascript modules (import/export)
- React
- Browser
- Use a popular style guide
- Airbnb
- Javascript
- Y for all
yarn
yarn add prettier eslint-config-prettier eslint-plugin-prettier babel-eslint -D
module.exports = {
env: {
browser: true,
es6: true,
},
extends: [
'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'
},
};
{
"singleQuote": true,
"trailingComma": "es5"
}