Skip to content

A shareable ESLint configuration for TypeScript projects at Plato.

License

Notifications You must be signed in to change notification settings

plato-app/eslint-config-ts

Repository files navigation

@plato/eslint-config-ts

A shareable ESLint configuration for TypeScript projects at Plato.

Setup

Configuration

First, install this package, along with ESLint, TypeScript, and associated plugins, as development dependencies:

yarn add @plato/eslint-config-ts eslint typescript @typescript-eslint/eslint-plugin @typescript-eslint/parser --dev

ℹ️ Since the command above can be difficult to visually parse, the required development dependencies are:

Next, add the ESLint configuration (which simply extends @plato/eslint-config-ts) to your project's package.json file:

{
	"eslintConfig": {
		"extends": "@plato/eslint-config-ts"
	}
}

ℹ️ You may also specify the ESLint configuration in a separate .eslintrc.json file.

Run the Linter

To easily run the linter from a shell, add a lint command to the scripts property of your project's package.json file:

{
	"scripts": {
		"lint": "eslint path/to/lint --ext .ts"
	}
}

Now you can run yarn lint to lint the project's code.

Editor Integration

Many editors support ESLint. Here are some common editors and associated ESLint plugins.

Example Configuration

A complete package.json might look similar to the following:

{
	"name": "my-package",
	"version": "0.1.0",
	"scripts": {
		"build": "tsc",
		"lint": "eslint path/to/lint --ext .ts"
	},
	"devDependencies": {
		"@plato/eslint-config-ts": "^0.3.0",
		"@typescript-eslint/eslint-plugin": "^4.13.0",
		"@typescript-eslint/parser": "^4.13.0",
		"eslint": "^7.17.0",
		"typescript": "^4.1.3"
	},
	"eslintConfig": {
		"extends": "@plato/eslint-config-ts"
	}
}

About

A shareable ESLint configuration for TypeScript projects at Plato.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published