Skip to content

Instantly share code, notes, and snippets.

@raphaeljcm
Last active June 17, 2023 21:05
Show Gist options
  • Save raphaeljcm/cf439ddd5bcab27a0a0588d071696d75 to your computer and use it in GitHub Desktop.
Save raphaeljcm/cf439ddd5bcab27a0a0588d071696d75 to your computer and use it in GitHub Desktop.
eslint and prettier config
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
*/.js
node_modules
dist
webpack/*.js
.webpack
out
module.exports = {
env: {
browser: true,
es2021: true,
jest: true,
},
extends: [
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
globals: {
React: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: [
'react',
'react-hooks',
'jsx-a11y',
'@typescript-eslint',
'prettier',
],
rules: {
'prettier/prettier': 'error',
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
},
settings: {
react: {
version: 'detect',
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
},
},
};
*/.js
node_modules
build
dist
out
confs
public
webpack/*.js
.webpack
.vs
.gitlab-ci.yml
*.md
.vercel
@typescript-eslint/eslint-plugin @typescript-eslint/parser
eslint eslint-config-prettier eslint-plugin-jsx-a11y
eslint-plugin-prettier eslint-plugin-react eslint-plugin-react-hooks prettier
When using tailwind, also install: prettier-plugin-tailwindcss
module.exports = {
printWidth: 80,
tabWidth: 2,
singleQuote: true,
trailingComma: 'all',
arrowParens: 'avoid',
plugins: [require('prettier-plugin-tailwindcss')], // when using tailwindcss
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment