UNPKG

2.7 kBMarkdownView Raw
1[![Build Status](https://travis-ci.com/standard/eslint-config-standard-with-typescript.svg?branch=master)](https://travis-ci.com/standard/eslint-config-standard-with-typescript)
2[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
3[![Releases](https://coderelease.io/badge/standard/eslint-config-standard-with-typescript)](https://coderelease.io/github/repository/standard/eslint-config-standard-with-typescript)
4
5# eslint-config-standard-with-typescript
6
7An [ESLint shareable config](https://eslint.org/docs/developer-guide/shareable-configs) for TypeScript that is based on [eslint-config-standard](https://github.com/standard/eslint-config-standard) and has TypeScript specific rules from [@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin).
8
9## Usage
10
11`npm@<7` does not automatically install `peerDependencies`,
12so if that's what you're using, install them manually.
13Here is an example, but use it only for reference,
14because your decisions regarding version ranges and range specifiers may vary.
15
16```
17npm install --save-dev \
18 typescript@^4 \
19 eslint@^7.12.1 \
20 eslint-plugin-promise@^5.0.0 \
21 eslint-plugin-import@^2.22.1 \
22 eslint-plugin-node@^11.1.0 \
23 @typescript-eslint/eslint-plugin@^4.0.1 \
24 eslint-config-standard-with-typescript@latest
25```
26
27Yes, this is a large number of packages. This is due to [a known limitation in ESLint](https://github.com/eslint/eslint/issues/3458).
28
29This list of dependencies is:
30
31- TypeScript, which you may already have installed
32- [ESLint](https://github.com/eslint/eslint)
33- 3 Peer dependencies of [eslint-config-standard](https://github.com/standard/eslint-config-standard)
34- [@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin); ESLint rules for TypeScript.
35- This package
36
37Here is an example `.eslintrc.js`:
38
39```js
40module.exports = {
41 extends: 'standard-with-typescript',
42 parserOptions: {
43 project: './tsconfig.json'
44 }
45}
46```
47
48Note: Please read some important instructions regarding the `project` option [here](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/README.md#configuration).
49
50There are [some more `parserOptions`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/README.md#configuration) you may care about.
51
52If you're using ESLint v6 make sure you read about [the `--ext` command line option](https://eslint.org/docs/user-guide/command-line-interface#ext).
53
54Example command line usage for ESLint v6:
55
56```
57$ npx eslint --ext .js,.ts .
58```
59
60Example command line usage for ESLint v7:
61
62```
63$ npx eslint .
64```