Skip to content

Instantly share code, notes, and snippets.

@bilxio
Last active September 19, 2023 22:47
Show Gist options
  • Select an option

  • Save bilxio/a207668fbc8b0350545101bfc250e184 to your computer and use it in GitHub Desktop.

Select an option

Save bilxio/a207668fbc8b0350545101bfc250e184 to your computer and use it in GitHub Desktop.
Prettier + ESLint + TS + React
root = true
[*]
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
end_of_line=lf
[*.{ts,tsx,js,jsx,css,scss}]
indent_style = space
indent_size = 2
# don't ever lint node_modules
node_modules
# don't lint build output (make sure it's set to your correct build folder name)
dist
public
# don't lint nyc coverage output
coverage
build
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"tsconfigRootDir": "."
},
"plugins": ["@typescript-eslint"],
"extends": [
"plugin:prettier/recommended",
"airbnb-typescript",
"prettier",
"prettier/@typescript-eslint",
"prettier/react"
],
"rules": {
// Make prettier code formatting suggestions more verbose.
"prettier/prettier": ["warn"],
// Disable <Fragment> => <> replacement. Feel free to change
"react/jsx-fragments": "off",
// Disable prefer default export
"import/prefer-default-export": "off"
},
"overrides": [{
"files": ["**/*.tsx"],
"rules": {
"react/prop-types": "off",
"react/jsx-props-no-spreading": "off"
}
}]
}
.vscode-test/
out/
dist/
test-fixtures/
node_modules/
build
public
server/
docs/
src/assets/
{
"printWidth": 80,
"semi": false,
"singleQuote": true,
"trailingComma": "es5",
"tabWidth": 2
}
 npm i -D prettier eslint \
  eslint-config-airbnb-typescript \
  eslint-config-prettier \
  eslint-plugin-import \
  eslint-plugin-jsx-a11y@^6.2.3 \
  eslint-plugin-prettier \
  eslint-plugin-react \
  eslint-plugin-react-hooks
{
"scripts": {
"lint": "eslint --ext .js,.jsx,.ts,.tsx src --color",
"format": "prettier --write src/**/*.{ts,tsx,scss,css,json}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment