TypeScript
Install on Mac
Use nvm to install and manage node & npm versions.
ESLint and Prettier
npx eslint --init
npm i --save-dev prettier eslint-config-prettier eslint-plugin-prettier
Next, add prettier
to extends
and plugins
in the eslint config. Also, add a rule that prettier rules are reported as errors:
{
"extends": [
"prettier",
],
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": "error"
}
}
Tweak the prettier config to your likings:
module.exports = {
trailingComma: 'es5',
semi: true,
tabWidth: 2,
singleQuote: true,
}
If you are using VS Code, create a file .vscode/settings.json
with this content:
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
}
Potential eslint rules to disable for use with TypeScript
{
rules: {
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
}
Benchmarks
- benchmark.js does not work with browserify at the moment, Chuhai is a wrapper and contains a workaround.