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", | |
"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.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 \ | |
@trivago/prettier-plugin-sort-imports |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Next.js example https://github.com/vercel/next.js/blob/canary/examples/with-typescript-eslint-jest/.eslintrc.json