@totominc/eslint-config-typescript v0.1.10
@totominc/eslint-config-typescript
Personal ESLint config for TypeScript projects: AirBnB and Prettier pre-configured.
About this configuration
- Automatically setup your ESLint config to properly parse TypeScript with
@typescript-eslint/parserand@typescript-eslint/eslint-plugin. - Add
eslint-commentsplugin for better// eslintcomments control. - Add
airbnb-typescript/base(no React/JSX support), this includeseslint-config-airbnb-basewith tweaked rules for TypeScript. - Add
@typescript-eslint/eslint-recommendedandplugin:@typescript-eslint/recommended, better TypeScript defaults. - Add Prettier with pre-defined configuration (you can easily edit it in your own
.eslintrc).
Installation
Local/per-project installation
Install all peer-dependencies from this package, this includes modules that are required by the
@totominc/eslint-config-typescript:npx install-peerdeps --dev @totominc/eslint-config-typescript@latest --yarnCheck your
package.jsonfor a list of dev-dependencies.Create an
.eslintrc.jsfile configuration for ESLint in the root of your project. Then you can extend the ESLint configuration@totominc/eslint-config-typescript:module.exports = { extends: ['@totominc/typescript'], parserOptions: { project: './path/to/tsconfig.json', tsconfigRootDir: '.', }, settings: { 'import/resolver': { typescript: { 'directory': './tsconfig.json', }, } }, };
Note: you may want to configure your IDE to automatically fix on save. For VSCode, you can use the
vscode-eslint extension and configure
your settings.json like this:
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
]
}Global installation
Install all peer-dependencies from this package, this includes modules that are required by the
@totominc/eslint-config-typescript:npx install-peerdeps --global @totominc/eslint-config-typescript@latest --yarnCreate a global
.eslintrc.jsfile configuration for ESLint in your home folder (e.g.~/.eslintrc.js). Then you can extend one of the provided configurations from@totominc/eslint-config-typescript:module.exports = { extends: ['@totominc/typescript'], };