TypeScript plugin for ESLint
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github [CHORE] Run Prettier on the other files in the project (#237) Dec 18, 2018
.vscode [CHORE] Run Prettier on the other files in the project (#237) Dec 18, 2018
docs/rules [CHORE] Run Prettier on the other files in the project (#237) Dec 18, 2018
lib [CHORE] enable eslint-plugin/require-meta-type (#247) Dec 18, 2018
tests [FEAT] [no-this-alias] Add rule (#232) Dec 17, 2018
tools [FEAT] Add tool to generate recommended config (#204) Dec 17, 2018
.editorconfig [CHORE] Run Prettier on the other files in the project (#237) Dec 18, 2018
.eslintrc [CHORE] enable eslint-plugin/require-meta-type (#247) Dec 18, 2018
.gitattributes [CHORE] Fix issue with line ending chars in .gitattributes (#252) Dec 19, 2018
.gitignore [CHORE] Add vscode debug config Dec 4, 2018
.npmignore [CHORE] add parser.js to npmignore (#200) Dec 2, 2018
.npmrc Chore: Upgrade deps to eslint 4 and typescript-parser 4. Update linti… Jul 11, 2017
.prettierignore [CHORE] switched to prettier-eslint and added vscode config (#182) Nov 27, 2018
.prettierrc.yml [CHORE] Run Prettier on the other files in the project (#237) Dec 18, 2018
.travis.yml [CHORE] Run Prettier on the other files in the project (#237) Dec 18, 2018
CONTRIBUTING.md [CHORE] Run Prettier on the other files in the project (#237) Dec 18, 2018
LICENSE New: Initial commit Aug 22, 2016
README.md [CHORE] Add shields to readme (#253) Dec 19, 2018
ROADMAP.md [DOCS] List jsdoc-format replacement for eslint (#246) Dec 18, 2018
package.json [CHORE] Run Prettier on the other files in the project (#237) Dec 18, 2018
parser.js chore: update package dependencies (fixes #184) (#186) Nov 28, 2018
yarn.lock [CHORE] Run Prettier on the other files in the project (#237) Dec 18, 2018

README.md

eslint-plugin-typescript

NPM version NPM downloads TravisCI

TypeScript support for ESLint. (This is still in the very early stages, so please be patient.)

The below readme is for the upcoming 1.0.0 release. Please see this tag for the current NPM version (0.14.0)

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Last, install eslint-plugin-typescript:

$ npm install eslint-plugin-typescript --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-typescript globally.

Usage

Add eslint-plugin-typescript/parser to the parser field and typescript to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "parser": "eslint-plugin-typescript/parser",
    "plugins": ["typescript"]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "typescript/rule-name": "error"
    }
}

Note: The plugin provides its own version of the typescript-eslint-parser via eslint-plugin-typescript/parser. This guarantees 100% compatibility between the plugin and the parser.

Supported Rules

Key: ✔️ = recommended, 🔧 = fixable

Name Description ✔️ 🔧
typescript/adjacent-overload-signatures Require that member overloads be consecutive (adjacent-overload-signatures from TSLint)
typescript/array-type Requires using either T[] or Array<T> for arrays (array-type from TSLint) 🔧
typescript/ban-types Enforces that types will not to be used (ban-types from TSLint) 🔧
typescript/camelcase Enforce camelCase naming convention
typescript/class-name-casing Require PascalCased class and interface names (class-name from TSLint) ✔️
typescript/explicit-function-return-type Require explicit return types on functions and class methods
typescript/explicit-member-accessibility Require explicit accessibility modifiers on class properties and methods (member-access from TSLint)
typescript/generic-type-naming Enforces naming of generic type variables
typescript/indent Enforce consistent indentation (indent from TSLint) ✔️ 🔧
typescript/interface-name-prefix Require that interface names be prefixed with I (interface-name from TSLint)
typescript/member-delimiter-style Require a specific member delimiter style for interfaces and type literals 🔧
typescript/member-naming Enforces naming conventions for class members by visibility.
typescript/member-ordering Require a consistent member declaration order (member-ordering from TSLint)
typescript/no-angle-bracket-type-assertion Enforces the use of as Type assertions instead of <Type> assertions (no-angle-bracket-type-assertion from TSLint)
typescript/no-array-constructor Disallow generic Array constructors 🔧
typescript/no-empty-interface Disallow the declaration of empty interfaces (no-empty-interface from TSLint)
typescript/no-explicit-any Disallow usage of the any type (no-any from TSLint)
typescript/no-extraneous-class Forbids the use of classes as namespaces (no-unnecessary-class from TSLint)
typescript/no-inferrable-types Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean. (no-inferrable-types from TSLint) 🔧
typescript/no-misused-new Enforce valid definition of new and constructor. (no-misused-new from TSLint)
typescript/no-namespace Disallow the use of custom TypeScript modules and namespaces (no-namespace from TSLint)
typescript/no-non-null-assertion Disallows non-null assertions using the ! postfix operator (no-non-null-assertion from TSLint)
typescript/no-object-literal-type-assertion Forbids an object literal to appear in a type assertion expression (no-object-literal-type-assertion from TSLint)
typescript/no-parameter-properties Disallow the use of parameter properties in class constructors. (no-parameter-properties from TSLint)
typescript/no-this-alias Disallow aliasing this (no-this-assignment from TSLint)
typescript/no-triple-slash-reference Disallow /// <reference path="" /> comments (no-reference from TSLint)
typescript/no-type-alias Disallow the use of type aliases (interface-over-type-literal from TSLint)
typescript/no-unused-vars Prevent TypeScript-specific constructs from being erroneously flagged as unused ✔️
typescript/no-use-before-define Disallow the use of variables before they are defined
typescript/no-var-requires Disallows the use of require statements except in import statements (no-var-requires from TSLint)
typescript/prefer-interface Prefer an interface declaration over a type literal (type T = { ... }) (interface-over-type-literal from TSLint) 🔧
typescript/prefer-namespace-keyword Require the use of the namespace keyword instead of the module keyword to declare custom TypeScript modules. (no-internal-module from TSLint) 🔧
typescript/type-annotation-spacing Require consistent spacing around type annotations (typedef-whitespace from TSLint) 🔧