Skip to content

Instantly share code, notes, and snippets.

@itkrt2y

itkrt2y/.eslintrc.js

Last active Sep 2, 2020
Embed
What would you like to do?
VSCode + TypeScript + ESLint + Prettier + React
module.exports = {
env: { browser: true, node: true },
parser: '@typescript-eslint/parser',
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended",
"prettier/@typescript-eslint",
"prettier/react",
],
rules: {
"@typescript-eslint/no-unused-vars": [2, { argsIgnorePattern: "^_" }],
'react/prefer-stateless-function': 2,
// https://github.com/basarat/typescript-book/blob/master/docs/tips/defaultIsBad.md
// https://twitter.com/dan_abramov/status/1255229440860262400
'import/no-default-export': 2,
},
settings: { react: { version: "detect" } }
};
// .vscode/settings.json
{
"editor.codeActionsOnSave": [
"source.removeUnusedCode",
"source.addMissingImports",
"source.organizeImports",
"source.fixAll.eslint"
]
}
yarn add -D \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser \
prettier \
eslint \
eslint-config-prettier \
eslint-plugin-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
You can’t perform that action at this time.