Socket
Socket
Sign inDemoInstall

eslint-config-airbnb-typescript

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-config-airbnb-typescript - npm Package Compare versions

Comparing version 12.3.1 to 13.0.0

2

base.js
module.exports = {
extends: ['eslint-config-airbnb-base', './lib/shared.js'].map(require.resolve),
extends: ['./lib/shared.js'].map(require.resolve),
};
// This file adds some React specific settings. Not using React? Use base.js instead.
module.exports = {
extends: ['eslint-config-airbnb', './lib/shared'].map(require.resolve),
extends: ['./lib/shared'].map(require.resolve),
settings: {

@@ -5,0 +5,0 @@ // Append 'ts' extensions to Airbnb 'import/resolver' setting

@@ -0,1 +1,2 @@

/* eslint-disable import/no-extraneous-dependencies */
const { rules: baseBestPracticesRules } = require('eslint-config-airbnb-base/rules/best-practices');

@@ -7,2 +8,3 @@ const { rules: baseErrorsRules } = require('eslint-config-airbnb-base/rules/errors');

const { rules: baseVariablesRules } = require('eslint-config-airbnb-base/rules/variables');
/* eslint-enable import/no-extraneous-dependencies */

@@ -9,0 +11,0 @@ module.exports = {

@@ -14,3 +14,3 @@ {

},
"version": "12.3.1",
"version": "13.0.0",
"scripts": {

@@ -25,19 +25,19 @@ "pre-commit": "lint-staged",

},
"dependencies": {
"@typescript-eslint/parser": "^4.4.1",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-airbnb-base": "^14.2.0"
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "4.14.2",
"doctoc": "2.0.0",
"eslint": "7.19.0",
"eslint-config-prettier": "7.2.0",
"eslint-plugin-import": "2.22.1",
"doctoc": "2.0.1",
"eslint": "7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.24.1",
"husky": "4.3.8",
"lint-staged": "10.5.4",
"lint-staged": "11.1.2",
"npm-run-all": "4.1.5",
"prettier": "2.2.1",
"prettier-package-json": "2.1.3",
"typescript": "4.1.3"
"prettier": "2.3.1",
"prettier-package-json": "2.6.0",
"typescript": "4.3.5"
},

@@ -44,0 +44,0 @@ "keywords": [

@@ -5,45 +5,37 @@ # eslint-config-airbnb-typescript

Airbnb's ESLint config with TypeScript support
Enhances Airbnb's ESLint config with TypeScript support
## Setup
### 1) Install
### 1) Setup regular Airbnb config
```
npm install eslint-config-airbnb-typescript --save-dev
```
Make sure you have the regular Airbnb config setup. See [eslint-config-airbnb](https://www.npmjs.com/package/eslint-config-airbnb), or [eslint-config-airbnb-base](https://www.npmjs.com/package/eslint-config-airbnb-base) if you're not using React.
### 2) Install ESLint plugins
### 2) Install this config (and peer dependencies)
ESLint plugins used by this config must also be installed within your project. This is a limitation within ESLint (see [RFC](https://github.com/eslint/rfcs/tree/master/designs/2019-config-simplification) and [progress](https://github.com/eslint/eslint/issues/13481)).
```bash
npm install eslint-plugin-import@^2.22.0 \
eslint-plugin-jsx-a11y@^6.3.1 \
eslint-plugin-react@^7.20.3 \
eslint-plugin-react-hooks@^4.0.8 \
@typescript-eslint/eslint-plugin@^4.4.1 \
npm install eslint-config-airbnb-typescript \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser \
--save-dev
```
If you don't need React support:
```bash
npm install eslint-plugin-import@^2.22.0 \
@typescript-eslint/eslint-plugin@^4.4.1 \
--save-dev
```
### 3) Configure ESLint
Add `"extends": "airbnb-typescript"` to your ESLint config file.
Within your ESLint config file:
If you don't need React support, add `"extends": "airbnb-typescript/base"` instead.
```diff
extends: [
'airbnb',
+ 'airbnb-typescript'
]
```
An example `.eslintrc.js`:
If you don't need React support:
```js
module.exports = {
extends: ['airbnb-typescript'],
};
```diff
extends: [
'airbnb-base',
+ 'airbnb-typescript/base'
]
```

@@ -60,8 +52,8 @@

```diff
module.exports = {
extends: ['airbnb-typescript'],
+ parserOptions: {
+ project: './tsconfig.json',
{
extends: ['airbnb', 'airbnb-typescript'],
+ parserOptions: {
+ project: './tsconfig.json'
+ }
};
}
```

@@ -83,6 +75,2 @@

### Does this work with JavaScript files too?
Yep! This config is a drop-in replacement for `eslint-config-airbnb`, decorating it with TypeScript support.
### I get this error when running ESLint: "The file must be included in at least one of the projects provided"

@@ -110,9 +98,11 @@

### I get peer dependency warnings for ESLint React plugins, but I'm using `airbnb-typescript/base`
### Why do I need the peer dependencies?
This is a known problem. Some suggestions exist in this [GitHub issue](https://github.com/iamturns/eslint-config-airbnb-typescript/issues/6).
`@typescript-eslint/eslint-plugin` is a peer dependency because of a limitation within ESLint. See [issue](https://github.com/eslint/eslint/issues/3458), [RFC](https://github.com/eslint/rfcs/tree/master/designs/2019-config-simplification), and [progress](https://github.com/eslint/eslint/issues/13481).
`@typescript-eslint/parser` is a peer dependency because the version number must match `@typescript-eslint/eslint-plugin`.
### I wish this config would support [...]
The goal of `eslint-config-airbnb-typescript` is to simply decorate `eslint-config-airbnb` with TypeScript support. It's not a single config to cater for all TypeScript linting requirements. For additional functionality, alter your ESLint config file. For example:
This config simply enhances the Airbnb with TypeScript support. It's not a single config to cater for all TypeScript linting requirements. For additional functionality, alter your ESLint config file. For example:

@@ -122,2 +112,3 @@ ```js

extends: [
'airbnb',
'airbnb-typescript',

@@ -124,0 +115,0 @@ 'airbnb/hooks',

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