Skip to content

Latest commit

Β 

History

History
311 lines (302 loc) Β· 246 KB

javascript.md

File metadata and controls

311 lines (302 loc) Β· 246 KB

javascript config

Default config, suitable for any JavaScript/TypeScript project.

πŸ—οΈ Setup

Refer to setup instructions in README.

πŸ“ Rules (290)

πŸ”§ Automatically fixable by the --fix CLI option.
πŸ’‘ Manually fixable by editor suggestions.
πŸ§ͺ🚫 Disabled for test files.
πŸ§ͺ⚠️ Severity lessened to warning for test files.

🚨 Errors (120)

Plugin Rule Options Autofix Overrides
constructor-super
Require super() calls in constructors
eqeqeq
Require the use of === and !==
always, null: never
[
  "always",
  {
    "null": "never"
  }
]
πŸ”§
for-direction
Enforce "for" loop update clause moving the counter in the right direction
getter-return
Enforce return statements in getters
guard-for-in
Require for-in loops to include an if statement
no-async-promise-executor
Disallow using an async function as a Promise executor
no-case-declarations
Disallow lexical declarations in case clauses
πŸ’‘
no-class-assign
Disallow reassigning class members
no-compare-neg-zero
Disallow comparing against -0
no-cond-assign
Disallow assignment operators in conditional expressions
no-const-assign
Disallow reassigning const variables
no-constant-binary-expression
Disallow expressions where the operation doesn't affect the value
no-constant-condition
Disallow constant expressions in conditions
no-control-regex
Disallow control characters in regular expressions
no-debugger
Disallow the use of debugger
no-delete-var
Disallow deleting variables
no-dupe-args
Disallow duplicate arguments in function definitions
no-dupe-class-members
Disallow duplicate class members
no-dupe-else-if
Disallow duplicate conditions in if-else-if chains
no-dupe-keys
Disallow duplicate keys in object literals
no-duplicate-case
Disallow duplicate case labels
no-empty
Disallow empty block statements
πŸ’‘
no-empty-character-class
Disallow empty character classes in regular expressions
no-empty-pattern
Disallow empty destructuring patterns
no-eval
Disallow the use of eval()
no-ex-assign
Disallow reassigning exceptions in catch clauses
no-extra-boolean-cast
Disallow unnecessary boolean casts
πŸ”§
no-fallthrough
Disallow fallthrough of case statements
no-func-assign
Disallow reassigning function declarations
no-global-assign
Disallow assignments to native objects or read-only global variables
no-import-assign
Disallow assigning to imported bindings
no-inner-declarations
Disallow variable or function declarations in nested blocks
no-invalid-regexp
Disallow invalid regular expression strings in RegExp constructors
no-irregular-whitespace
Disallow irregular whitespace
no-loss-of-precision
Disallow literal numbers that lose precision
no-misleading-character-class
Disallow characters which are made with multiple code points in character class syntax
πŸ’‘
no-new-native-nonconstructor
Disallow new operators with global non-constructor functions
no-nonoctal-decimal-escape
Disallow \8 and \9 escape sequences in string literals
πŸ’‘
no-obj-calls
Disallow calling global object properties as functions
no-octal
Disallow octal literals
no-param-reassign
Disallow reassigning function parameters
props: true
{
  "props": true
}
no-prototype-builtins
Disallow calling some Object.prototype methods directly on objects
πŸ’‘
no-redeclare
Disallow variable redeclaration
no-regex-spaces
Disallow multiple spaces in regular expressions
πŸ”§
no-self-assign
Disallow assignments where both sides are exactly the same
no-sequences
Disallow comma operators
no-setter-return
Disallow returning values from setters
no-shadow-restricted-names
Disallow identifiers from shadowing restricted names
no-sparse-arrays
Disallow sparse arrays
no-template-curly-in-string
Disallow template literal placeholder syntax in regular strings
no-this-before-super
Disallow this/super before calling super() in constructors
no-undef
Disallow the use of undeclared variables unless mentioned in /*global */ comments
no-unexpected-multiline
Disallow confusing multiline expressions
no-unreachable
Disallow unreachable code after return, throw, continue, and break statements
no-unreachable-loop
Disallow loops with a body that allows only one iteration
no-unsafe-finally
Disallow control flow statements in finally blocks
no-unsafe-negation
Disallow negating the left operand of relational operators
πŸ’‘
no-unsafe-optional-chaining
Disallow use of optional chaining in contexts where the undefined value is not allowed
no-unused-labels
Disallow unused labels
πŸ”§
no-unused-vars
Disallow unused variables
no-useless-backreference
Disallow useless backreferences in regular expressions
no-useless-catch
Disallow unnecessary catch clauses
no-useless-escape
Disallow unnecessary escape characters
πŸ’‘
no-var
Require let or const instead of var
πŸ”§
no-with
Disallow with statements
prefer-const
Require const declarations for variables that are never reassigned after declared
πŸ”§
prefer-rest-params
Require rest parameters instead of arguments
prefer-spread
Require spread operators instead of .apply()
require-yield
Require generator functions to contain yield
use-isnan
Require calls to isNaN() when checking for NaN
πŸ’‘
valid-typeof
Enforce comparing typeof expressions against valid strings
πŸ’‘
@typescript-eslint ban-ts-comment
Disallow @ts-<directive> comments or require descriptions after directives
πŸ’‘
@typescript-eslint no-array-constructor
Disallow generic Array constructors
πŸ”§
@typescript-eslint no-duplicate-enum-values
Disallow duplicate enum member values
@typescript-eslint no-empty-object-type
Disallow accidentally using the "empty object" type
πŸ’‘
@typescript-eslint no-explicit-any
Disallow the any type
πŸ”§, πŸ’‘ πŸ§ͺ🚫
@typescript-eslint no-extra-non-null-assertion
Disallow extra non-null assertions
πŸ”§
@typescript-eslint no-misused-new
Enforce valid definition of new and constructor
@typescript-eslint no-namespace
Disallow TypeScript namespaces
@typescript-eslint no-non-null-asserted-optional-chain
Disallow non-null assertions after an optional chain expression
πŸ’‘
@typescript-eslint no-require-imports
Disallow invocation of require()
@typescript-eslint no-this-alias
Disallow aliasing this
@typescript-eslint no-unnecessary-type-constraint
Disallow unnecessary constraints on generic types
πŸ’‘
@typescript-eslint no-unsafe-declaration-merging
Disallow unsafe declaration merging
@typescript-eslint no-unsafe-function-type
Disallow using the unsafe built-in Function type
πŸ”§
@typescript-eslint no-unused-vars
Disallow unused variables
argsIgnorePattern: ^, dest...
{
  "argsIgnorePattern": "^",
  "destructuredArrayIgnorePattern": "^_",
  "ignoreRestSiblings": true
}
@typescript-eslint no-wrapper-object-types
Disallow using confusing built-in primitive class wrappers
πŸ”§
@typescript-eslint prefer-as-const
Enforce the use of as const over literal type
πŸ”§, πŸ’‘
@typescript-eslint triple-slash-reference
Disallow certain triple slash directives in favor of ES6-style import declarations
import default
Ensure a default export is present, given a default import.
import export
Forbid any invalid exports, i.e. re-export of the same name.
import named
Ensure named imports correspond to a named export in the remote file.
import namespace
Ensure imported namespaces contain dereferenced properties as they are dereferenced.
import no-absolute-path
Forbid import of modules using absolute paths.
πŸ”§
import no-amd
Forbid AMD require and define calls.
import no-commonjs
Forbid CommonJS require calls and module.exports or exports.*.
import no-cycle
Forbid a module from importing a module with a dependency path back to itself.
import no-mutable-exports
Forbid the use of mutable exports with var or let.
import no-self-import
Forbid a module from importing itself.
import no-unresolved
Ensure imports point to a file/module that can be resolved.
promise always-return
Require returning inside each then() to create readable and reusable Promise chains.
ignoreLastCallback: true
{
  "ignoreLastCallback": true
}
promise catch-or-return
Enforce the use of catch() on un-returned promises.
πŸ§ͺ🚫
promise no-new-statics
Disallow calling new on a Promise static method.
πŸ”§
promise no-return-wrap
Disallow wrapping values in Promise.resolve or Promise.reject when not needed.
promise param-names
Enforce consistent param names and ordering when creating new promises.
sonarjs no-all-duplicated-branches
All branches in a conditional structure should not have exactly the same implementation
sonarjs no-collection-size-mischeck
Collection sizes and array length comparisons should make sense
πŸ’‘
sonarjs no-duplicated-branches
Two branches in a conditional structure should not have exactly the same implementation
sonarjs no-element-overwrite
Collection elements should not be replaced unconditionally
sonarjs no-empty-collection
Empty collections should not be accessed or iterated
sonarjs no-extra-arguments
Function calls should not pass extra arguments
sonarjs no-gratuitous-expressions
Boolean expressions should not be gratuitous
sonarjs no-identical-conditions
Related "if-else-if" and "switch-case" statements should not have the same condition
sonarjs no-identical-expressions
Identical expressions should not be used on both sides of a binary operator
sonarjs no-identical-functions
Functions should not have identical implementations
sonarjs no-ignored-return
Return values from functions without side effects should not be ignored
sonarjs no-one-iteration-loop
Loops with at most one iteration should be refactored
sonarjs no-unused-collection
Collection and array contents should be used
sonarjs no-use-of-empty-return-value
The output of functions that don't return anything should not be used
sonarjs non-existent-operator
Non-existent operators "=+", "=-" and "=!" should not be used
πŸ’‘

⚠️ Warnings (170)

Plugin Rule Options Autofix Overrides
arrow-body-style
Require braces around arrow function bodies
as-needed
"as-needed"
πŸ”§
complexity
Enforce a maximum cyclomatic complexity allowed in a program
curly
Enforce consistent brace style for all control statements
πŸ”§ πŸ§ͺ🚫
max-depth
Enforce a maximum depth that blocks can be nested
max-lines
Enforce a maximum number of lines per file
skipBlankLines: true, skipC...
{
  "skipBlankLines": true,
  "skipComments": true
}
πŸ§ͺ🚫
max-lines-per-function
Enforce a maximum number of lines of code in a function
skipBlankLines: true, skipC...
{
  "skipBlankLines": true,
  "skipComments": true
}
πŸ§ͺ🚫
max-nested-callbacks
Enforce a maximum depth that callbacks can be nested
max: 10
{
  "max": 10
}
no-bitwise
Disallow bitwise operators
no-console
Disallow the use of console
allow: error, warn, info
{
  "allow": [
    "error",
    "warn",
    "info"
  ]
}
πŸ’‘
no-duplicate-imports
Disallow duplicate module imports
no-empty-static-block
Disallow empty static blocks
no-undef-init
Disallow initializing variables to undefined
πŸ”§
no-unused-private-class-members
Disallow unused private class members
no-useless-computed-key
Disallow unnecessary computed property keys in objects and classes
πŸ”§
no-useless-rename
Disallow renaming import, export, and destructured assignments to the same name
πŸ”§
object-shorthand
Require or disallow method and property shorthand syntax for object literals
πŸ”§
prefer-template
Require template literals instead of string concatenation
πŸ”§
radix
Enforce the consistent use of the radix argument when using parseInt()
πŸ’‘
yoda
Require or disallow "Yoda" conditions
πŸ”§
@typescript-eslint adjacent-overload-signatures
Require that function overload signatures be consecutive
@typescript-eslint array-type
Require consistently using either T[] or Array<T> for arrays
πŸ”§
@typescript-eslint ban-tslint-comment
Disallow // tslint:<rule-flag> comments
πŸ”§
@typescript-eslint class-methods-use-this
Enforce that class methods utilize this
@typescript-eslint consistent-generic-constructors
Enforce specifying generic type arguments on type annotation or constructor name of a constructor call
πŸ”§
@typescript-eslint consistent-type-definitions
Enforce type definitions to consistently use either interface or type
type
"type"
πŸ”§
@typescript-eslint default-param-last
Enforce default parameters to be last
@typescript-eslint max-params
Enforce a maximum number of parameters in function definitions
max: 4
{
  "max": 4
}
@typescript-eslint method-signature-style
Enforce using a particular method signature syntax
πŸ”§
@typescript-eslint no-confusing-non-null-assertion
Disallow non-null assertion in locations that may be confusing
πŸ’‘
@typescript-eslint no-empty-function
Disallow empty functions
allow: private-constructors...
{
  "allow": [
    "private-constructors",
    "protected-constructors",
    "decoratedFunctions",
    "overrideMethods"
  ]
}
πŸ§ͺ🚫
@typescript-eslint no-import-type-side-effects
Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers
πŸ”§
@typescript-eslint no-magic-numbers
Disallow magic numbers
ignore: -1, 0, 1, 2, 7, 10,...
{
  "ignore": [
    -1,
    0,
    1,
    2,
    7,
    10,
    24,
    60,
    100,
    1000,
    3600
  ],
  "ignoreClassFieldInitialValues": true,
  "ignoreDefaultValues": true,
  "ignoreEnums": true,
  "ignoreNumericLiteralTypes": true,
  "ignoreReadonlyClassProperties": true,
  "ignoreTypeIndexes": true,
  "enforceConst": true,
  "detectObjects": true
}
πŸ§ͺ🚫
@typescript-eslint no-shadow
Disallow variable declarations from shadowing variables declared in the outer scope
@typescript-eslint no-unused-expressions
Disallow unused expressions
@typescript-eslint prefer-function-type
Enforce using function types instead of interfaces with call signatures
πŸ”§
@typescript-eslint prefer-namespace-keyword
Require using namespace keyword over module keyword to declare custom TypeScript modules
πŸ”§
functional no-let
Disallow mutable variables.
πŸ§ͺ🚫
functional no-loop-statements
Disallow imperative loops.
import max-dependencies
Enforce the maximum number of dependencies a module can have.
ignoreTypeImports: true
{
  "ignoreTypeImports": true
}
import no-anonymous-default-export
Forbid anonymous values as default exports.
import no-duplicates
Forbid repeated import of the same module in multiple places.
πŸ”§
import no-named-as-default
Forbid use of exported name as identifier of default export.
import no-named-as-default-member
Forbid use of exported name as property of default export.
import no-named-default
Forbid named default exports.
import no-unassigned-import
Forbid unassigned imports
import no-useless-path-segments
Forbid unnecessary path segments in import and require statements.
πŸ”§
promise no-callback-in-promise
Disallow calling cb() inside of a then() (use [nodeify][] instead).
exceptions: next
{
  "exceptions": [
    "next"
  ]
}
promise no-nesting
Disallow nested then() or catch() statements.
promise no-promise-in-callback
Disallow using promises inside of callbacks.
promise no-return-in-finally
Disallow return statements in finally().
promise valid-params
Enforces the proper number of arguments are passed to Promise functions.
sonarjs max-switch-cases
"switch" statements should not have too many "case" clauses
sonarjs no-collapsible-if
Collapsible "if" statements should be merged
sonarjs no-duplicate-string
String literals should not be duplicated
πŸ§ͺ🚫
sonarjs no-inverted-boolean-check
Boolean checks should not be inverted
πŸ”§, πŸ’‘
sonarjs no-nested-switch
"switch" statements should not be nested
sonarjs no-nested-template-literals
Template literals should not be nested
sonarjs no-redundant-boolean
Boolean literals should not be redundant
sonarjs no-redundant-jump
Jump statements should not be redundant
πŸ’‘
sonarjs no-same-line-conditional
Conditionals should start on new lines
πŸ’‘
sonarjs no-small-switch
"switch" statements should have at least 3 "case" clauses
sonarjs no-useless-catch
"catch" clauses should do more than rethrow
sonarjs prefer-immediate-return
Local variables should not be declared and then immediately returned or thrown
πŸ”§
sonarjs prefer-object-literal
Object literal syntax should be used
sonarjs prefer-single-boolean-return
Return of boolean expressions should not be wrapped into an "if-then-else" statement
πŸ’‘
sonarjs prefer-while
A "while" loop should be used instead of a "for" loop
πŸ”§
unicorn better-regex
Improve regexes by making them shorter, consistent, and safer.
sortCharacterClasses: false
{
  "sortCharacterClasses": false
}
πŸ”§
unicorn catch-error-name
Enforce a specific parameter name in catch clauses.
πŸ”§
unicorn consistent-destructuring
Use destructured variables over properties.
πŸ”§, πŸ’‘
unicorn consistent-function-scoping
Move function definitions to the highest possible scope.
checkArrowFunctions: false
{
  "checkArrowFunctions": false
}
πŸ§ͺ🚫
unicorn empty-brace-spaces
Enforce no spaces between braces.
πŸ”§
unicorn error-message
Enforce passing a message value when creating a built-in error.
unicorn escape-case
Require escape sequences to use uppercase values.
πŸ”§
unicorn expiring-todo-comments
Add expiration conditions to TODO comments.
unicorn explicit-length-check
Enforce explicitly comparing the length or size property of a value.
πŸ”§, πŸ’‘
unicorn filename-case
Enforce a case style for filenames.
unicorn import-style
Enforce specific import styles per module.
unicorn new-for-builtins
Enforce the use of new for all builtins, except String, Number, Boolean, Symbol and BigInt.
πŸ”§
unicorn no-abusive-eslint-disable
Enforce specifying rules to disable in eslint-disable comments.
unicorn no-array-callback-reference
Prevent passing a function reference directly to iterator methods.
πŸ’‘
unicorn no-array-for-each
Prefer for…of over the forEach method.
πŸ”§, πŸ’‘
unicorn no-array-method-this-argument
Disallow using the this argument in array methods.
πŸ”§, πŸ’‘
unicorn no-array-push-push
Enforce combining multiple Array#push() into one call.
πŸ”§, πŸ’‘
unicorn no-array-reduce
Disallow Array#reduce() and Array#reduceRight().
unicorn no-await-expression-member
Disallow member access from await expression.
πŸ”§
unicorn no-console-spaces
Do not use leading/trailing space between console.log parameters.
πŸ”§
unicorn no-document-cookie
Do not use document.cookie directly.
unicorn no-empty-file
Disallow empty files.
unicorn no-for-loop
Do not use a for loop that can be replaced with a for-of loop.
πŸ”§, πŸ’‘
unicorn no-hex-escape
Enforce the use of Unicode escapes instead of hexadecimal escapes.
πŸ”§
unicorn no-instanceof-array
Require Array.isArray() instead of instanceof Array.
πŸ”§
unicorn no-invalid-remove-event-listener
Prevent calling EventTarget#removeEventListener() with the result of an expression.
unicorn no-lonely-if
Disallow if statements as the only statement in if blocks without else.
πŸ”§
unicorn no-negated-condition
Disallow negated conditions.
πŸ”§
unicorn no-nested-ternary
Disallow nested ternary expressions.
πŸ”§
unicorn no-new-array
Disallow new Array().
πŸ”§, πŸ’‘
unicorn no-new-buffer
Enforce the use of Buffer.from() and Buffer.alloc() instead of the deprecated new Buffer().
πŸ”§, πŸ’‘
unicorn no-null
Disallow the use of the null literal.
πŸ”§, πŸ’‘
unicorn no-object-as-default-parameter
Disallow the use of objects as default parameters.
unicorn no-process-exit
Disallow process.exit().
unicorn no-static-only-class
Disallow classes that only have static members.
πŸ”§
unicorn no-thenable
Disallow then property.
unicorn no-this-assignment
Disallow assigning this to a variable.
unicorn no-typeof-undefined
Disallow comparing undefined using typeof.
πŸ”§, πŸ’‘
unicorn no-unnecessary-await
Disallow awaiting non-promise values.
πŸ”§
unicorn no-unnecessary-polyfills
Enforce the use of built-in methods instead of unnecessary polyfills.
unicorn no-unreadable-array-destructuring
Disallow unreadable array destructuring.
πŸ”§
unicorn no-unreadable-iife
Disallow unreadable IIFEs.
unicorn no-useless-fallback-in-spread
Disallow useless fallback when spreading in object literals.
πŸ”§
unicorn no-useless-length-check
Disallow useless array length check.
πŸ”§
unicorn no-useless-promise-resolve-reject
Disallow returning/yielding Promise.resolve/reject() in async functions or promise callbacks
πŸ”§
unicorn no-useless-spread
Disallow unnecessary spread.
πŸ”§
unicorn no-useless-switch-case
Disallow useless case in switch statements.
πŸ’‘
unicorn no-useless-undefined
Disallow useless undefined.
checkArguments: false
{
  "checkArguments": false
}
πŸ”§
unicorn no-zero-fractions
Disallow number literals with zero fractions or dangling dots.
πŸ”§
unicorn number-literal-case
Enforce proper case for numeric literals.
πŸ”§
unicorn numeric-separators-style
Enforce the style of numeric separators by correctly grouping digits.
πŸ”§
unicorn prefer-add-event-listener
Prefer .addEventListener() and .removeEventListener() over on-functions.
πŸ”§
unicorn prefer-array-find
Prefer .find(…) and .findLast(…) over the first or last element from .filter(…).
πŸ”§, πŸ’‘
unicorn prefer-array-flat
Prefer Array#flat() over legacy techniques to flatten arrays.
πŸ”§
unicorn prefer-array-flat-map
Prefer .flatMap(…) over .map(…).flat().
πŸ”§
unicorn prefer-array-index-of
Prefer Array#{indexOf,lastIndexOf}() over Array#{findIndex,findLastIndex}() when looking for the index of an item.
πŸ”§, πŸ’‘
unicorn prefer-array-some
Prefer .some(…) over .filter(…).length check and .{find,findLast}(…).
πŸ”§, πŸ’‘
unicorn prefer-at
Prefer .at() method for index access and String#charAt().
πŸ”§, πŸ’‘
unicorn prefer-blob-reading-methods
Prefer Blob#arrayBuffer() over FileReader#readAsArrayBuffer(…) and Blob#text() over FileReader#readAsText(…).
unicorn prefer-code-point
Prefer String#codePointAt(…) over String#charCodeAt(…) and String.fromCodePoint(…) over String.fromCharCode(…).
πŸ’‘
unicorn prefer-date-now
Prefer Date.now() to get the number of milliseconds since the Unix Epoch.
πŸ”§
unicorn prefer-default-parameters
Prefer default parameters over reassignment.
πŸ”§, πŸ’‘
unicorn prefer-dom-node-append
Prefer Node#append() over Node#appendChild().
πŸ”§
unicorn prefer-dom-node-dataset
Prefer using .dataset on DOM elements over calling attribute methods.
πŸ”§
unicorn prefer-dom-node-remove
Prefer childNode.remove() over parentNode.removeChild(childNode).
πŸ”§, πŸ’‘
unicorn prefer-dom-node-text-content
Prefer .textContent over .innerText.
πŸ’‘
unicorn prefer-event-target
Prefer EventTarget over EventEmitter.
unicorn prefer-export-from
Prefer export…from when re-exporting.
πŸ”§, πŸ’‘
unicorn prefer-includes
Prefer .includes() over .indexOf() and Array#some() when checking for existence or non-existence.
πŸ”§, πŸ’‘
unicorn prefer-keyboard-event-key
Prefer KeyboardEvent#key over KeyboardEvent#keyCode.
πŸ”§
unicorn prefer-logical-operator-over-ternary
Prefer using a logical operator over a ternary.
πŸ’‘
unicorn prefer-math-trunc
Enforce the use of Math.trunc instead of bitwise operators.
πŸ”§, πŸ’‘
unicorn prefer-modern-dom-apis
Prefer .before() over .insertBefore(), .replaceWith() over .replaceChild(), prefer one of .before(), .after(), .append() or .prepend() over insertAdjacentText() and insertAdjacentElement().
πŸ”§
unicorn prefer-modern-math-apis
Prefer modern Math APIs over legacy patterns.
πŸ”§
unicorn prefer-module
Prefer JavaScript modules (ESM) over CommonJS.
πŸ”§, πŸ’‘
unicorn prefer-native-coercion-functions
Prefer using String, Number, BigInt, Boolean, and Symbol directly.
πŸ”§
unicorn prefer-negative-index
Prefer negative index over .length - index when possible.
πŸ”§
unicorn prefer-node-protocol
Prefer using the node: protocol when importing Node.js builtin modules.
πŸ”§
unicorn prefer-number-properties
Prefer Number static properties over global ones.
πŸ”§, πŸ’‘
unicorn prefer-object-from-entries
Prefer using Object.fromEntries(…) to transform a list of key-value pairs into an object.
πŸ”§
unicorn prefer-optional-catch-binding
Prefer omitting the catch binding parameter.
πŸ”§
unicorn prefer-prototype-methods
Prefer borrowing methods from the prototype instead of the instance.
πŸ”§
unicorn prefer-query-selector
Prefer .querySelector() over .getElementById(), .querySelectorAll() over .getElementsByClassName() and .getElementsByTagName().
πŸ”§
unicorn prefer-reflect-apply
Prefer Reflect.apply() over Function#apply().
πŸ”§
unicorn prefer-regexp-test
Prefer RegExp#test() over String#match() and RegExp#exec().
πŸ”§, πŸ’‘
unicorn prefer-set-has
Prefer Set#has() over Array#includes() when checking for existence or non-existence.
πŸ”§, πŸ’‘
unicorn prefer-set-size
Prefer using Set#size instead of Array#length.
πŸ”§
unicorn prefer-spread
Prefer the spread operator over Array.from(…), Array#concat(…), Array#{slice,toSpliced}() and String#split('').
πŸ”§, πŸ’‘
unicorn prefer-string-replace-all
Prefer String#replaceAll() over regex searches with the global flag.
πŸ”§
unicorn prefer-string-slice
Prefer String#slice() over String#substr() and String#substring().
πŸ”§
unicorn prefer-string-starts-ends-with
Prefer String#startsWith() & String#endsWith() over RegExp#test().
πŸ”§, πŸ’‘
unicorn prefer-string-trim-start-end
Prefer String#trimStart() / String#trimEnd() over String#trimLeft() / String#trimRight().
πŸ”§
unicorn prefer-switch
Prefer switch over multiple else-if.
πŸ”§
unicorn prefer-ternary
Prefer ternary expressions over simple if-else statements.
πŸ”§
unicorn prefer-top-level-await
Prefer top-level await over top-level promises and async function calls.
πŸ’‘
unicorn prefer-type-error
Enforce throwing TypeError in type checking conditions.
πŸ”§
unicorn prevent-abbreviations
Prevent abbreviations.
πŸ”§
unicorn relative-url-style
Enforce consistent relative URL style.
πŸ”§, πŸ’‘
unicorn require-array-join-separator
Enforce using the separator argument with Array#join().
πŸ”§
unicorn require-number-to-fixed-digits-argument
Enforce using the digits argument with Number#toFixed().
πŸ”§
unicorn switch-case-braces
Enforce consistent brace style for case clauses.
avoid
"avoid"
πŸ”§
unicorn template-indent
Fix whitespace-insensitive template indentation.
πŸ”§
unicorn text-encoding-identifier-case
Enforce consistent case for text encoding identifiers.
πŸ”§, πŸ’‘
unicorn throw-new-error
Require new when throwing an error.
πŸ”§