Skip to content

Instantly share code, notes, and snippets.

@itkrt2y

itkrt2y/.eslintrc.js

Last active Feb 22, 2021
Embed
What would you like to do?
VSCode + TypeScript + ESLint + Prettier + React
/** @type import("eslint").Linter.Config */
module.exports = {
env: { browser: true, node: true },
parser: '@typescript-eslint/parser',
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"prettier",
],
rules: {
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"react/prefer-stateless-function": "error",
"import/order": ["error", { alphabetize: { order: "asc" } }],
// https://github.com/basarat/typescript-book/blob/master/docs/tips/defaultIsBad.md
// https://twitter.com/dan_abramov/status/1255229440860262400
"import/no-default-export": "error",
},
settings: { react: { version: "detect" } }
};
// .vscode/settings.json
{
"editor.codeActionsOnSave": ["source.fixAll"],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
yarn add -D \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser \
prettier \
eslint \
eslint-config-prettier \
eslint-plugin-react \
eslint-plugin-react-hooks \
eslint-plugin-import
@itkrt2y

This comment has been minimized.

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