Skip to content

@stylistic/eslint-plugin ​

Stylistic rules for ESLint, works for both JavaScript, TypeScript and JSX.

This plugin provides all rules from:

With this plugin, you no longer need to mainly disable JavaScript in favor of TypeScript. Rules work for both languages.

Shared Configurations ​

This plugin provides some built-in configurations that you can use out of the box. Learn more about shared configurations.

Install ​

npm i -D @stylistic/eslint-plugin

Add @stylistic to your plugins list, and prefix stylistic rules with @stylistic:

// eslint.config.js
import stylistic from '@stylistic/eslint-plugin'

export default [
    plugins: {
      '@stylistic': stylistic
    rules: {
      'indent': ['error', 2],
      '@stylistic/indent': ['error', 2],
      // ...
// .eslintrc.js
module.exports = {
  plugins: [
  rules: {
    'indent': ['error', 2],
    '@stylistic/indent': ['error', 2],
    // ...

Check out the migration guide for more details.

Rules ​

Each rule has emojis denoting:
The rule is part of the shared configuration
Some problems reported are fixable by the --fix command line option
array-bracket-newlineEnforce linebreaks after opening and before closing array bracketsπŸ”§
array-bracket-spacingEnforce consistent spacing inside array bracketsπŸ’ΌπŸ”§
array-element-newlineEnforce line breaks after each array elementπŸ”§
arrow-parensRequire parentheses around arrow function argumentsπŸ’ΌπŸ”§
arrow-spacingEnforce consistent spacing before and after the arrow in arrow functionsπŸ’ΌπŸ”§
block-spacingDisallow or enforce spaces inside of blocks after opening block and before closing blockπŸ’ΌπŸ”§
brace-styleEnforce consistent brace style for blocksπŸ’ΌπŸ”§
comma-dangleRequire or disallow trailing commasπŸ’ΌπŸ”§
comma-spacingEnforce consistent spacing before and after commasπŸ’ΌπŸ”§
comma-styleEnforce consistent comma styleπŸ’ΌπŸ”§
computed-property-spacingEnforce consistent spacing inside computed property bracketsπŸ’ΌπŸ”§
dot-locationEnforce consistent newlines before and after dotsπŸ’ΌπŸ”§
eol-lastRequire or disallow newline at the end of filesπŸ’ΌπŸ”§
func-call-spacingRequire or disallow spacing between function identifiers and their invocations. Alias of `function-call-spacing`.πŸ”§
function-call-argument-newlineEnforce line breaks between arguments of a function callπŸ”§
function-call-spacingRequire or disallow spacing between function identifiers and their invocationsπŸ”§
function-paren-newlineEnforce consistent line breaks inside function parenthesesπŸ”§
generator-star-spacingEnforce consistent spacing around `*` operators in generator functionsπŸ”§
implicit-arrow-linebreakEnforce the location of arrow function bodiesπŸ”§
indentEnforce consistent indentationπŸ’ΌπŸ”§
indent-binary-opsIndentation for binary operatorsπŸ’ΌπŸ”§
jsx-child-element-spacingEnforce or disallow spaces inside of curly braces in JSX attributes and expressions
jsx-closing-bracket-locationEnforce closing bracket location in JSXπŸ’ΌπŸ”§
jsx-closing-tag-locationEnforce closing tag location for multiline JSXπŸ’ΌπŸ”§
jsx-curly-brace-presenceDisallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributesπŸ’ΌπŸ”§
jsx-curly-newlineEnforce consistent linebreaks in curly braces in JSX attributes and expressionsπŸ’ΌπŸ”§
jsx-curly-spacingEnforce or disallow spaces inside of curly braces in JSX attributes and expressionsπŸ’ΌπŸ”§
jsx-equals-spacingEnforce or disallow spaces around equal signs in JSX attributesπŸ’ΌπŸ”§
jsx-first-prop-new-lineEnforce proper position of the first property in JSXπŸ’ΌπŸ”§
jsx-indentEnforce JSX indentationπŸ’ΌπŸ”§
jsx-indent-propsEnforce props indentation in JSXπŸ’ΌπŸ”§
jsx-max-props-per-lineEnforce maximum of props on a single line in JSXπŸ’ΌπŸ”§
jsx-newlineRequire or prevent a new line after jsx elements and expressions.πŸ”§
jsx-one-expression-per-lineRequire one JSX element per lineπŸ’ΌπŸ”§
jsx-pascal-caseEnforce PascalCase for user-defined JSX components
jsx-props-no-multi-spacesDisallow multiple spaces between inline JSX propsπŸ”§
jsx-quotesEnforce the consistent use of either double or single quotes in JSX attributesπŸ’ΌπŸ”§
jsx-self-closing-compDisallow extra closing tags for components without childrenπŸ”§
jsx-sort-propsEnforce props alphabetical sortingπŸ”§
jsx-tag-spacingEnforce whitespace in and around the JSX opening and closing bracketsπŸ’ΌπŸ”§
jsx-wrap-multilinesDisallow missing parentheses around multiline JSXπŸ’ΌπŸ”§
key-spacingEnforce consistent spacing between keys and values in object literal propertiesπŸ’ΌπŸ”§
keyword-spacingEnforce consistent spacing before and after keywordsπŸ’ΌπŸ”§
linebreak-styleEnforce consistent linebreak styleπŸ”§
lines-around-commentRequire empty lines around commentsπŸ”§
lines-between-class-membersRequire or disallow an empty line between class membersπŸ’ΌπŸ”§
max-lenEnforce a maximum line length
max-statements-per-lineEnforce a maximum number of statements allowed per lineπŸ’Ό
member-delimiter-styleRequire a specific member delimiter style for interfaces and type literalsπŸ’ΌπŸ”§
multiline-ternaryEnforce newlines between operands of ternary expressionsπŸ’ΌπŸ”§
new-parensEnforce or disallow parentheses when invoking a constructor with no argumentsπŸ’ΌπŸ”§
newline-per-chained-callRequire a newline after each call in a method chainπŸ”§
no-confusing-arrowDisallow arrow functions where they could be confused with comparisonsπŸ”§
no-extra-parensDisallow unnecessary parenthesesπŸ’ΌπŸ”§
no-extra-semiDisallow unnecessary semicolonsπŸ”§
no-floating-decimalDisallow leading or trailing decimal points in numeric literalsπŸ’ΌπŸ”§
no-mixed-operatorsDisallow mixed binary operatorsπŸ’Ό
no-mixed-spaces-and-tabsDisallow mixed spaces and tabs for indentationπŸ’Ό
no-multi-spacesDisallow multiple spacesπŸ’ΌπŸ”§
no-multiple-empty-linesDisallow multiple empty linesπŸ’ΌπŸ”§
no-tabsDisallow all tabsπŸ’Ό
no-trailing-spacesDisallow trailing whitespace at the end of linesπŸ’ΌπŸ”§
no-whitespace-before-propertyDisallow whitespace before propertiesπŸ’ΌπŸ”§
nonblock-statement-body-positionEnforce the location of single-line statementsπŸ”§
object-curly-newlineEnforce consistent line breaks after opening and before closing bracesπŸ”§
object-curly-spacingEnforce consistent spacing inside bracesπŸ’ΌπŸ”§
object-property-newlineEnforce placing object properties on separate linesπŸ”§
one-var-declaration-per-lineRequire or disallow newlines around variable declarationsπŸ”§
operator-linebreakEnforce consistent linebreak style for operatorsπŸ’ΌπŸ”§
padded-blocksRequire or disallow padding within blocksπŸ’ΌπŸ”§
padding-line-between-statementsRequire or disallow padding lines between statementsπŸ”§
quote-propsRequire quotes around object literal property namesπŸ’ΌπŸ”§
quotesEnforce the consistent use of either backticks, double, or single quotesπŸ’ΌπŸ”§
rest-spread-spacingEnforce spacing between rest and spread operators and their expressionsπŸ’ΌπŸ”§
semiRequire or disallow semicolons instead of ASIπŸ’ΌπŸ”§
semi-spacingEnforce consistent spacing before and after semicolonsπŸ’ΌπŸ”§
semi-styleEnforce location of semicolonsπŸ”§
space-before-blocksEnforce consistent spacing before blocksπŸ’ΌπŸ”§
space-before-function-parenEnforce consistent spacing before `function` definition opening parenthesisπŸ’ΌπŸ”§
space-in-parensEnforce consistent spacing inside parenthesesπŸ’ΌπŸ”§
space-infix-opsRequire spacing around infix operatorsπŸ’ΌπŸ”§
space-unary-opsEnforce consistent spacing before or after unary operatorsπŸ’ΌπŸ”§
spaced-commentEnforce consistent spacing after the `//` or `/*` in a commentπŸ’ΌπŸ”§
switch-colon-spacingEnforce spacing around colons of switch statementsπŸ”§
template-curly-spacingRequire or disallow spacing around embedded expressions of template stringsπŸ’ΌπŸ”§
template-tag-spacingRequire or disallow spacing between template tags and their literalsπŸ’ΌπŸ”§
type-annotation-spacingRequire consistent spacing around type annotationsπŸ’ΌπŸ”§
type-generic-spacingEnforces consistent spacing inside TypeScript type genericsπŸ’ΌπŸ”§
type-named-tuple-spacingExpect space before the type declaration in the named tupleπŸ’ΌπŸ”§
wrap-iifeRequire parentheses around immediate `function` invocationsπŸ’ΌπŸ”§
wrap-regexRequire parenthesis around regex literalsπŸ”§
yield-star-spacingRequire or disallow spacing around the `*` in `yield*` expressionsπŸ’ΌπŸ”§
92 rules in total.

Released under the MIT License.