https://github.com/weirdpattern/eslint-config-typescript
An opinionated set of ESLint rules for TypeScript projects
https://github.com/weirdpattern/eslint-config-typescript
Last synced: 10 months ago
JSON representation
An opinionated set of ESLint rules for TypeScript projects
- Host: GitHub
- URL: https://github.com/weirdpattern/eslint-config-typescript
- Owner: weirdpattern
- License: mit
- Created: 2017-09-10T02:46:38.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T01:18:54.000Z (about 3 years ago)
- Last Synced: 2025-03-27T01:01:41.079Z (10 months ago)
- Language: JavaScript
- Size: 918 KB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-config-typescript
An opinionated set of ESLint rules for TypeScript projects
## Installation
Install eslint-config-typescript:
```bash
$ npm install --save-dev eslint-config-typescript
```
Then, add eslint-config-typescript to the "extends" array in your ESLint file.
Make sure to put it last, so it gets the chance to override other configs.
```json
{
"extends": [
"typescript"
]
}
```
A few ESLint plugins are supported as well:
```json
{
"extends": [
"typescript",
"typescript/react",
"typescript/prettier",
"typescript/prettier-react"
]
}
```
Note: `typescript/prettier-react` will automatically import `typescript/prettier`.
## Example configuration
Using default prettier configurations:
```json
{
"extends": [
"typescript",
"typescript/prettier"
],
"plugins": ["filenames", "jest"],
"env": {
"jest": true,
"node": true
},
"rules": {
"filenames/no-index": "error",
"filenames/match-exported": ["error", "kebab"],
"jest/no-disabled-tests": "error",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/valid-expect": "error"
}
}
```
Using specific react configurations:
```json
{
"extends": [
"typescript",
"typescript/react",
"typescript/prettier-react"
],
"plugins": ["filenames", "jest"],
"env": {
"jest": true,
"node": true
},
"rules": {
"filenames/no-index": "error",
"filenames/match-exported": ["error", "kebab"],
"jest/no-disabled-tests": "error",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/valid-expect": "error",
"prettier/prettier": [
"error",
{
"semi": false,
"tabWidth": 4,
"singleQuote": true
}
]
}
}
```