eslint-config-typescript

3.0.0 • Public • Published

eslint-config-typescript

An opinionated set of ESLint rules for TypeScript projects

Installation

Install eslint-config-typescript:

$ 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.

{
  "extends": [
    "typescript"
  ]
}

A few ESLint plugins are supported as well:

{
  "extends": [
    "typescript",
    "typescript/react",
    "typescript/prettier",
    "typescript/prettier-react"
  ]
}

Note: typescript/prettier-react will automatically import typescript/prettier.

Example configuration

Using default prettier configurations:

{
  "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:

{
  "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
      }
    ]
  }
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.0.0
    40,077
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.0.0
    40,077
  • 2.0.0
    3,096
  • 1.1.0
    83
  • 1.0.2
    16
  • 1.0.1
    0
  • 1.0.0
    6

Package Sidebar

Install

npm i eslint-config-typescript

Weekly Downloads

34,769

Version

3.0.0

License

MIT

Unpacked Size

9.93 kB

Total Files

11

Last publish

Collaborators

  • weirdpattern