@stylistic/eslint-plugin
Stylistic rules for ESLint, works for both JavaScript, TypeScript and JSX.
This plugin provides the rules from:
Install
sh
npm i -D @stylistic/eslint-plugin
npm i -D @stylistic/eslint-plugin
Add @stylistic
to your plugins list, and prefix stylistic rules with @stylistic
:
js
// .eslintrc.js
module.exports = {
plugins: [
'@stylistic'
],
rules: {
'indent': ['error', 2],
'@stylistic/indent': ['error', 2],
// ...
}
}
// .eslintrc.js
module.exports = {
plugins: [
'@stylistic'
],
rules: {
'indent': ['error', 2],
'@stylistic/indent': ['error', 2],
// ...
}
}
Check out the migration guide for more details.
Rules
array-bracket-newline | Enforce linebreaks after opening and before closing array brackets |
array-bracket-spacing | Enforce consistent spacing inside array brackets |
array-element-newline | Enforce line breaks after each array element |
arrow-parens | Require parentheses around arrow function arguments |
arrow-spacing | Enforce consistent spacing before and after the arrow in arrow functions |
block-spacing | Disallow or enforce spaces inside of blocks after opening block and before closing block |
brace-style | Enforce consistent brace style for blocks |
comma-dangle | Require or disallow trailing commas |
comma-spacing | Enforce consistent spacing before and after commas |
comma-style | Enforce consistent comma style |
computed-property-spacing | Enforce consistent spacing inside computed property brackets |
dot-location | Enforce consistent newlines before and after dots |
eol-last | Require or disallow newline at the end of files |
func-call-spacing | Require or disallow spacing between function identifiers and their invocations. Alias of `function-call-spacing`. |
function-call-argument-newline | Enforce line breaks between arguments of a function call |
function-call-spacing | Require or disallow spacing between function identifiers and their invocations |
function-paren-newline | Enforce consistent line breaks inside function parentheses |
generator-star-spacing | Enforce consistent spacing around `*` operators in generator functions |
implicit-arrow-linebreak | Enforce the location of arrow function bodies |
indent | Enforce consistent indentation |
jsx-quotes | Enforce the consistent use of either double or single quotes in JSX attributes |
key-spacing | Enforce consistent spacing between keys and values in object literal properties |
keyword-spacing | Enforce consistent spacing before and after keywords |
linebreak-style | Enforce consistent linebreak style |
lines-around-comment | Require empty lines around comments |
lines-between-class-members | Require or disallow an empty line between class members |
max-len | Enforce a maximum line length |
max-statements-per-line | Enforce a maximum number of statements allowed per line |
multiline-ternary | Enforce newlines between operands of ternary expressions |
new-parens | Enforce or disallow parentheses when invoking a constructor with no arguments |
newline-per-chained-call | Require a newline after each call in a method chain |
no-confusing-arrow | Disallow arrow functions where they could be confused with comparisons |
no-extra-parens | Disallow unnecessary parentheses |
no-extra-semi | Disallow unnecessary semicolons |
no-floating-decimal | Disallow leading or trailing decimal points in numeric literals |
no-mixed-operators | Disallow mixed binary operators |
no-mixed-spaces-and-tabs | Disallow mixed spaces and tabs for indentation |
no-multi-spaces | Disallow multiple spaces |
no-multiple-empty-lines | Disallow multiple empty lines |
no-tabs | Disallow all tabs |
no-trailing-spaces | Disallow trailing whitespace at the end of lines |
no-whitespace-before-property | Disallow whitespace before properties |
nonblock-statement-body-position | Enforce the location of single-line statements |
object-curly-newline | Enforce consistent line breaks after opening and before closing braces |
object-curly-spacing | Enforce consistent spacing inside braces |
object-property-newline | Enforce placing object properties on separate lines |
one-var-declaration-per-line | Require or disallow newlines around variable declarations |
operator-linebreak | Enforce consistent linebreak style for operators |
padded-blocks | Require or disallow padding within blocks |
padding-line-between-statements | Require or disallow padding lines between statements |
quote-props | Require quotes around object literal property names |
quotes | Enforce the consistent use of either backticks, double, or single quotes |
rest-spread-spacing | Enforce spacing between rest and spread operators and their expressions |
semi | Require or disallow semicolons instead of ASI |
semi-spacing | Enforce consistent spacing before and after semicolons |
semi-style | Enforce location of semicolons |
space-before-blocks | Enforce consistent spacing before blocks |
space-before-function-paren | Enforce consistent spacing before `function` definition opening parenthesis |
space-in-parens | Enforce consistent spacing inside parentheses |
space-infix-ops | Require spacing around infix operators |
space-unary-ops | Enforce consistent spacing before or after unary operators |
spaced-comment | Enforce consistent spacing after the `//` or `/*` in a comment |
switch-colon-spacing | Enforce spacing around colons of switch statements |
template-curly-spacing | Require or disallow spacing around embedded expressions of template strings |
template-tag-spacing | Require or disallow spacing between template tags and their literals |
wrap-iife | Require parentheses around immediate `function` invocations |
wrap-regex | Require parenthesis around regex literals |
yield-star-spacing | Require or disallow spacing around the `*` in `yield*` expressions |
member-delimiter-style | Require a specific member delimiter style for interfaces and type literals |
type-annotation-spacing | Require consistent spacing around type annotations |
jsx-child-element-spacing | Enforce or disallow spaces inside of curly braces in JSX attributes and expressions |
jsx-closing-bracket-location | Enforce closing bracket location in JSX |
jsx-closing-tag-location | Enforce closing tag location for multiline JSX |
jsx-curly-brace-presence | Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes |
jsx-curly-newline | Enforce consistent linebreaks in curly braces in JSX attributes and expressions |
jsx-curly-spacing | Enforce or disallow spaces inside of curly braces in JSX attributes and expressions |
jsx-equals-spacing | Enforce or disallow spaces around equal signs in JSX attributes |
jsx-first-prop-new-line | Enforce proper position of the first property in JSX |
jsx-indent | Enforce JSX indentation |
jsx-indent-props | Enforce props indentation in JSX |
jsx-max-props-per-line | Enforce maximum of props on a single line in JSX |
jsx-newline | Require or prevent a new line after jsx elements and expressions. |
jsx-one-expression-per-line | Require one JSX element per line |
jsx-props-no-multi-spaces | Disallow multiple spaces between inline JSX props |
jsx-self-closing-comp | Disallow extra closing tags for components without children |
jsx-sort-props | Enforce props alphabetical sorting |
jsx-tag-spacing | Enforce whitespace in and around the JSX opening and closing brackets |
jsx-wrap-multilines | Disallow missing parentheses around multiline JSX |