eslint-config-airbnb-typescript
Advanced tools
Comparing version 12.3.1 to 13.0.0
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', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
257
23490
12
135
+ Added@types/json-schema@7.0.15(transitive)
+ Added@typescript-eslint/eslint-plugin@4.33.0(transitive)
+ Added@typescript-eslint/experimental-utils@4.33.0(transitive)
+ Addedeslint-utils@3.0.0(transitive)
- Removed@typescript-eslint/parser@^4.4.1
- Removedeslint-config-airbnb@^18.2.0
- Removedeslint-config-airbnb-base@^14.2.0
- Removed@rtsao/scc@1.1.0(transitive)
- Removed@types/json5@0.0.29(transitive)
- Removedaria-query@5.1.3(transitive)
- Removedarray-buffer-byte-length@1.0.1(transitive)
- Removedarray-includes@3.1.8(transitive)
- Removedarray.prototype.findlast@1.2.5(transitive)
- Removedarray.prototype.findlastindex@1.2.5(transitive)
- Removedarray.prototype.flat@1.3.2(transitive)
- Removedarray.prototype.flatmap@1.3.2(transitive)
- Removedarray.prototype.tosorted@1.1.4(transitive)
- Removedarraybuffer.prototype.slice@1.0.3(transitive)
- Removedast-types-flow@0.0.8(transitive)
- Removedavailable-typed-arrays@1.0.7(transitive)
- Removedaxe-core@4.10.0(transitive)
- Removedaxobject-query@4.1.0(transitive)
- Removedcall-bind@1.0.7(transitive)
- Removedconfusing-browser-globals@1.0.11(transitive)
- Removeddamerau-levenshtein@1.0.8(transitive)
- Removeddata-view-buffer@1.0.1(transitive)
- Removeddata-view-byte-length@1.0.1(transitive)
- Removeddata-view-byte-offset@1.0.0(transitive)
- Removeddebug@3.2.7(transitive)
- Removeddeep-equal@2.2.3(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddefine-properties@1.2.1(transitive)
- Removeddoctrine@2.1.0(transitive)
- Removedemoji-regex@9.2.2(transitive)
- Removedes-abstract@1.23.3(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-get-iterator@1.1.3(transitive)
- Removedes-iterator-helpers@1.0.19(transitive)
- Removedes-object-atoms@1.0.0(transitive)
- Removedes-set-tostringtag@2.0.3(transitive)
- Removedes-shim-unscopables@1.0.2(transitive)
- Removedes-to-primitive@1.2.1(transitive)
- Removedeslint-config-airbnb@18.2.1(transitive)
- Removedeslint-config-airbnb-base@14.2.1(transitive)
- Removedeslint-import-resolver-node@0.3.9(transitive)
- Removedeslint-module-utils@2.11.0(transitive)
- Removedeslint-plugin-import@2.30.0(transitive)
- Removedeslint-plugin-jsx-a11y@6.10.0(transitive)
- Removedeslint-plugin-react@7.36.1(transitive)
- Removedeslint-plugin-react-hooks@4.6.2(transitive)
- Removedfor-each@0.3.3(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedfunction.prototype.name@1.1.6(transitive)
- Removedfunctions-have-names@1.2.3(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedget-symbol-description@1.0.2(transitive)
- Removedglobalthis@1.0.4(transitive)
- Removedgopd@1.0.1(transitive)
- Removedhas-bigints@1.0.2(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedinternal-slot@1.0.7(transitive)
- Removedis-arguments@1.1.1(transitive)
- Removedis-array-buffer@3.0.4(transitive)
- Removedis-async-function@2.0.0(transitive)
- Removedis-bigint@1.0.4(transitive)
- Removedis-boolean-object@1.1.2(transitive)
- Removedis-callable@1.2.7(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedis-data-view@1.0.1(transitive)
- Removedis-date-object@1.0.5(transitive)
- Removedis-finalizationregistry@1.0.2(transitive)
- Removedis-generator-function@1.0.10(transitive)
- Removedis-map@2.0.3(transitive)
- Removedis-negative-zero@2.0.3(transitive)
- Removedis-number-object@1.0.7(transitive)
- Removedis-regex@1.1.4(transitive)
- Removedis-set@2.0.3(transitive)
- Removedis-shared-array-buffer@1.0.3(transitive)
- Removedis-string@1.0.7(transitive)
- Removedis-symbol@1.0.4(transitive)
- Removedis-typed-array@1.1.13(transitive)
- Removedis-weakmap@2.0.2(transitive)
- Removedis-weakref@1.0.2(transitive)
- Removedis-weakset@2.0.3(transitive)
- Removedisarray@2.0.5(transitive)
- Removediterator.prototype@1.1.2(transitive)
- Removedjson5@1.0.2(transitive)
- Removedjsx-ast-utils@3.3.5(transitive)
- Removedlanguage-subtag-registry@0.3.23(transitive)
- Removedlanguage-tags@1.0.9(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedminimist@1.2.8(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedobject-inspect@1.13.2(transitive)
- Removedobject-is@1.1.6(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedobject.assign@4.1.5(transitive)
- Removedobject.entries@1.1.8(transitive)
- Removedobject.fromentries@2.0.8(transitive)
- Removedobject.groupby@1.0.3(transitive)
- Removedobject.values@1.2.0(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpossible-typed-array-names@1.0.0(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedreflect.getprototypeof@1.0.6(transitive)
- Removedregexp.prototype.flags@1.5.2(transitive)
- Removedresolve@1.22.82.0.0-next.5(transitive)
- Removedsafe-array-concat@1.1.2(transitive)
- Removedsafe-regex-test@1.0.3(transitive)
- Removedsemver@6.3.1(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedset-function-name@2.0.2(transitive)
- Removedside-channel@1.0.6(transitive)
- Removedstop-iteration-iterator@1.0.0(transitive)
- Removedstring.prototype.includes@2.0.0(transitive)
- Removedstring.prototype.matchall@4.0.11(transitive)
- Removedstring.prototype.repeat@1.0.0(transitive)
- Removedstring.prototype.trim@1.2.9(transitive)
- Removedstring.prototype.trimend@1.0.8(transitive)
- Removedstring.prototype.trimstart@1.0.8(transitive)
- Removedstrip-bom@3.0.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedtsconfig-paths@3.15.0(transitive)
- Removedtyped-array-buffer@1.0.2(transitive)
- Removedtyped-array-byte-length@1.0.1(transitive)
- Removedtyped-array-byte-offset@1.0.2(transitive)
- Removedtyped-array-length@1.0.6(transitive)
- Removedunbox-primitive@1.0.2(transitive)
- Removedwhich-boxed-primitive@1.0.2(transitive)
- Removedwhich-builtin-type@1.1.4(transitive)
- Removedwhich-collection@1.0.2(transitive)
- Removedwhich-typed-array@1.1.15(transitive)