Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

TypeScript plugin for ESLint

License

NotificationsYou must be signed in to change notification settings

bradzacher/eslint-plugin-typescript

Repository files navigation

eslint-plugin-typescript

NPM versionNPM downloadsTravisCI

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 installESLint:

$npm i eslint --save-dev

Next, installtypescript if you haven’t already:

$npm i typescript@~3.1.1 --save-dev

Last, installeslint-plugin-typescript:

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

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

Usage

Addeslint-plugin-typescript/parser to theparser field andtypescript to the plugins section of your.eslintrc configuration file:

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

Note: The plugin provides its own version of thetypescript-eslint-parser viaeslint-plugin-typescript/parser.This helps us guarantee 100% compatibility between the plugin and the parser.

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

{"parser":"eslint-plugin-typescript/parser","plugins": ["typescript"],"rules": {"typescript/rule-name":"error"    }}

You can also enable all the recommended rules at once. Addplugin:typescript/recommended in extends:

{"extends": ["plugin:typescript/recommended"]}

Supported Rules

Key: ✔️ = recommended, 🔧 = fixable

NameDescription✔️🔧
typescript/adjacent-overload-signaturesRequire that member overloads be consecutive (adjacent-overload-signatures from TSLint)✔️
typescript/array-typeRequires using eitherT[] orArray<T> for arrays (array-type from TSLint)✔️🔧
typescript/ban-typesEnforces that types will not to be used (ban-types from TSLint)✔️🔧
typescript/camelcaseEnforce camelCase naming convention✔️
typescript/class-name-casingRequire PascalCased class and interface names (class-name from TSLint)✔️
typescript/explicit-function-return-typeRequire explicit return types on functions and class methods✔️
typescript/explicit-member-accessibilityRequire explicit accessibility modifiers on class properties and methods (member-access from TSLint)✔️
typescript/generic-type-namingEnforces naming of generic type variables
typescript/indentEnforce consistent indentation (indent from TSLint)✔️🔧
typescript/interface-name-prefixRequire that interface names be prefixed withI (interface-name from TSLint)✔️
typescript/member-delimiter-styleRequire a specific member delimiter style for interfaces and type literals✔️🔧
typescript/member-namingEnforces naming conventions for class members by visibility.
typescript/member-orderingRequire a consistent member declaration order (member-ordering from TSLint)
typescript/no-angle-bracket-type-assertionEnforces the use ofas Type assertions instead of<Type> assertions (no-angle-bracket-type-assertion from TSLint)✔️
typescript/no-array-constructorDisallow genericArray constructors✔️🔧
typescript/no-empty-interfaceDisallow the declaration of empty interfaces (no-empty-interface from TSLint)✔️
typescript/no-explicit-anyDisallow usage of theany type (no-any from TSLint)✔️
typescript/no-extraneous-classForbids the use of classes as namespaces (no-unnecessary-class from TSLint)
typescript/no-inferrable-typesDisallows explicit type declarations for variables or parameters initialized to a number, string, or boolean. (no-inferrable-types from TSLint)✔️🔧
typescript/no-misused-newEnforce valid definition ofnew andconstructor. (no-misused-new from TSLint)✔️
typescript/no-namespaceDisallow the use of custom TypeScript modules and namespaces (no-namespace from TSLint)✔️
typescript/no-non-null-assertionDisallows non-null assertions using the! postfix operator (no-non-null-assertion from TSLint)✔️
typescript/no-object-literal-type-assertionForbids an object literal to appear in a type assertion expression (no-object-literal-type-assertion from TSLint)✔️
typescript/no-parameter-propertiesDisallow the use of parameter properties in class constructors. (no-parameter-properties from TSLint)✔️
typescript/no-this-aliasDisallow aliasingthis (no-this-assignment from TSLint)
typescript/no-triple-slash-referenceDisallow/// <reference path="" /> comments (no-reference from TSLint)✔️
typescript/no-type-aliasDisallow the use of type aliases (interface-over-type-literal from TSLint)
typescript/no-unused-varsDisallow unused variables (no-unused-variable from TSLint)✔️
typescript/no-use-before-defineDisallow the use of variables before they are defined✔️
typescript/no-var-requiresDisallows the use of require statements except in import statements (no-var-requires from TSLint)✔️
typescript/prefer-interfacePrefer an interface declaration over a type literal (type T = { ... }) (interface-over-type-literal from TSLint)✔️🔧
typescript/prefer-namespace-keywordRequire the use of thenamespace keyword instead of themodule keyword to declare custom TypeScript modules. (no-internal-module from TSLint)✔️🔧
typescript/type-annotation-spacingRequire consistent spacing around type annotations (typedef-whitespace from TSLint)✔️🔧

About

TypeScript plugin for ESLint

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors26


[8]ページ先頭

©2009-2025 Movatter.jp