Détail du package

eslint-config-typescript

weirdpattern193.9kMIT3.0.0

A base set of recommended ESLint rules for TypeScript projects

eslint, config, eslintconfig, eslint-config

readme

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

changelog

v3.0.0

link

This release contains breaking changes

  • Update dependencies
  • Introduce overrides in configurations that are exclusive to typescript
    • This requires an upgrade to eslint 6.0.0 to support extends in overrides

v2.0.0

link

This release contains breaking changes

  • Move from manual configurations to plugin:*/recommended
  • Split prettier configuration in two
    • prettier.js will hold prettier + typescript configurations
    • prettier-react.js will hold prettier + typescript + react configurations
  • Update dependencies
  • Remove prettier and react from peer-dependencies
    • The dependencies are still required when using prettier and react configurations, but these way at least the user won't get the warning.
    • This comes handy when working on typescript projects that don't use react.

v1.1.0

link

  • Simplified eslint configurations
  • Simplified build configurations
  • Add new typescript rules

v1.0.2

link

  • Update eslint configuration file for the repository
  • Update use default prettier configuration
  • Update remove prettier configuration file
  • Lint code based on the new eslint configuration

v1.0.1

link

  • Chore lint code.
  • Chore update README.md
  • Update remove env specifics in typescript

v1.0.0

Initial Release