Socket
Socket
Sign inDemoInstall

eslint-config-typescript-airbnb

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-config-typescript-airbnb

Eslint airbnb configuration configuration for typescript


Version published
Weekly downloads
171
Maintainers
1
Weekly downloads
 
Created
Source

eslint-config-typescript-airbnb

This package provides Airbnb's JS .eslintrc as an extensible shared config.

Usage

  1. Install correct version of each package, which are listed by the command:
npm info "eslint-config-typescript-airbnb@latest" peerDependencies

if you using npm 5+, use this shortcut

npx install-peerdeps --dev eslint-config-typescript-airbnb

This will work with yarn, npx will detect that you are using yarn and install dependencies via yarn.

  1. Add "extends": "typescript-airbnb" to your .eslintrc.

  2. For non React applications use "extends": "typescript-airbnb/base"

Linting your project

Edit package.json file and following scripts

yarn

  "lint": "eslint --ext .ts,.tsx 'src/**/*.ts?'"
  "lint:fix": "yarn lint --fix",

npm

  "lint": "eslint --ext .ts,.tsx 'src/**/*.ts?'"
  "lint:fix": "npm run lint -- --fix",

Editor setup

Webstorm

  • Disable tslint
  • Enable eslint
  • Under help > find actions
  • Add ts,tsx to eslint.additional.file.extensions

Eslint for typescript[BUG]

Webstorm cannot have eslint fix on save

VS Code

You should uninstall tslint and Prettier from extensions.

  • Install eslint extension
  • Under File > Preferences > Settings
  • Open Edit in settings.json
  • Add following lines
"eslint.validate": [
  "javascript",
  "javascriptreact",
  {
    "language": "typescript",
    "autoFix": true
  },
  {
    "language": "typescriptreact",
    "autoFix": true
  }
]
  • Optionally you can enable/disable Eslint: Auto Fix On Save
    • This will enable more code style functionality than basic prettier

Credits

This config was inspired by eslint-config-react-app and eslint-config-airbnb.

Keywords

FAQs

Package last updated on 27 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc