An opinionated ESLint configuration for TypeScript and Preact projects
- No semi-colons a la Standard
- Auto-formatting with Prettier
- Auto-sorting of
import
statements - Auto-sorting of object keys and JSX
prop
keys - Rules for hooks
Install:
$ npm install --save-dev eslint@8 prettier@3 typescript@5
$ npm install --save-dev --save-exact \
eslint-config-yuanqing \
@typescript-eslint/eslint-plugin@8.0.1 \
eslint-plugin-import@2.29.1 \
eslint-plugin-prettier@5.2.1 \
eslint-plugin-react@7.35.0 \
eslint-plugin-react-hooks@4.6.2 \
eslint-plugin-simple-import-sort@12.1.1 \
eslint-plugin-sort-keys-fix@1.1.2
Then, update package.json
as follows:
{
"scripts": {
"fix": "eslint --fix 'src/**/*.{ts,tsx}'",
"lint": "eslint 'src/**/*.{ts,tsx}'"
},
"eslintConfig": {
"extends": "yuanqing",
"root": true
},
"prettier": "eslint-config-yuanqing/prettier"
}