unicorn
unicorn/better-regex docs
Improve regexes by making them shorter, consistent, and safer.
Not configured in any preset
unicorn/catch-error-name docs
Enforce a specific parameter name in catch clauses.
Not configured in any preset
unicorn/consistent-destructuring docs
Use destructured variables over properties.
Not configured in any preset
unicorn/consistent-function-scoping docs
Move function definitions to the highest possible scope.
Not configured in any preset
unicorn/error-message docs
Enforce passing a message value when creating a built-in error.
Configured in
unicorn/escape-case docs
Require escape sequences to use uppercase values.
Not configured in any preset
unicorn/expiring-todo-comments docs
Add expiration conditions to TODO comments.
Not configured in any preset
unicorn/explicit-length-check docs
Enforce explicitly comparing the length or size property of a value.
Not configured in any preset
unicorn/filename-case docs
Enforce a case style for filenames.
Not configured in any preset
unicorn/import-style docs
Enforce specific import styles per module.
Not configured in any preset
unicorn/new-for-builtins docs
Enforce the use of new for all builtins, except String, Number, Boolean, Symbol and BigInt.
Configured in
unicorn/no-abusive-eslint-disable docs
Enforce specifying rules to disable in eslint-disable comments.
Not configured in any preset
unicorn/no-array-callback-reference docs
Prevent passing a function reference directly to iterator methods.
Not configured in any preset
unicorn/no-array-for-each docs
Prefer for…of over the forEach method.
Not configured in any preset
unicorn/no-array-method-this-argument docs
Disallow using the this argument in array methods.
Configured in
unicorn/no-array-push-push docs
Enforce combining multiple Array#push() into one call.
Not configured in any preset
unicorn/no-array-reduce docs
Disallow Array#reduce() and Array#reduceRight().
Not configured in any preset
unicorn/no-await-expression-member docs
Disallow member access from await expression.
Not configured in any preset
unicorn/no-console-spaces docs
Do not use leading/trailing space between console.log parameters.
Not configured in any preset
unicorn/no-document-cookie docs
Do not use document.cookie directly.
Not configured in any preset
unicorn/no-empty-file docs
Disallow empty files.
Not configured in any preset
unicorn/no-for-loop docs
Do not use a for loop that can be replaced with a for-of loop.
Not configured in any preset
unicorn/no-hex-escape docs
Enforce the use of Unicode escapes instead of hexadecimal escapes.
Not configured in any preset
unicorn/no-instanceof-array docs
Require Array.isArray() instead of instanceof Array.
unicorn/no-invalid-remove-event-listener docs
Prevent calling EventTarget#removeEventListener() with the result of an expression.
unicorn/no-keyword-prefix docs
Disallow identifiers starting with new or class.
Not configured in any preset
unicorn/no-lonely-if docs
Disallow if statements as the only statement in if blocks without else.
Not configured in any preset
unicorn/no-negated-condition docs
Disallow negated conditions.
Not configured in any preset
unicorn/no-new-array docs
Disallow new Array().
Not configured in any preset
unicorn/no-new-buffer docs
Enforce the use of Buffer.from() and Buffer.alloc() instead of the deprecated new Buffer().
Not configured in any preset
unicorn/no-null docs
Disallow the use of the null literal.
Not configured in any preset
unicorn/no-object-as-default-parameter docs
Disallow the use of objects as default parameters.
Not configured in any preset
unicorn/no-process-exit docs
Disallow process.exit().
Not configured in any preset
unicorn/no-static-only-class docs
Disallow classes that only have static members.
Not configured in any preset
unicorn/no-thenable docs
Disallow then property.
Not configured in any preset
unicorn/no-this-assignment docs
Disallow assigning this to a variable.
Not configured in any preset
unicorn/no-typeof-undefined docs
Disallow comparing undefined using typeof.
Not configured in any preset
unicorn/no-unnecessary-await docs
Disallow awaiting non-promise values.
Not configured in any preset
unicorn/no-unreadable-array-destructuring docs
Disallow unreadable array destructuring.
Not configured in any preset
unicorn/no-unreadable-iife docs
Disallow unreadable IIFEs.
Not configured in any preset
unicorn/no-unsafe-regex docs
Disallow unsafe regular expressions.
Not configured in any preset
unicorn/no-unused-properties docs
Disallow unused object properties.
Not configured in any preset
unicorn/no-useless-fallback-in-spread docs
Disallow useless fallback when spreading in object literals.
Configured in
unicorn/no-useless-length-check docs
Disallow useless array length check.
Not configured in any preset
unicorn/no-useless-promise-resolve-reject docs
Disallow returning/yielding Promise.resolve/reject() in async functions or promise callbacks
Configured in
unicorn/no-useless-spread docs
Disallow unnecessary spread.
Configured in
unicorn/no-useless-switch-case docs
Disallow useless case in switch statements.
Configured in
unicorn/no-useless-undefined docs
Disallow useless undefined.
Not configured in any preset
unicorn/no-zero-fractions docs
Disallow number literals with zero fractions or dangling dots.
Not configured in any preset
unicorn/numeric-separators-style docs
Enforce the style of numeric separators by correctly grouping digits.
Not configured in any preset
unicorn/prefer-add-event-listener docs
Prefer .addEventListener() and .removeEventListener() over on-functions.
Not configured in any preset
unicorn/prefer-array-find docs
Prefer .find(…) and .findLast(…) over the first or last element from .filter(…).
Not configured in any preset
unicorn/prefer-array-flat-map docs
Prefer .flatMap(…) over .map(…).flat().
Not configured in any preset
unicorn/prefer-array-flat docs
Prefer Array#flat() over legacy techniques to flatten arrays.
Not configured in any preset
unicorn/prefer-array-index-of docs
Prefer Array#{indexOf,lastIndexOf}() over Array#{findIndex,findLastIndex}() when looking for the index of an item.
Not configured in any preset
unicorn/prefer-array-some docs
Prefer .some(…) over .filter(…).length check and .{find,findLast}(…).
Not configured in any preset
unicorn/prefer-at docs
Prefer .at() method for index access and String#charAt().
Not configured in any preset
unicorn/prefer-code-point docs
Prefer String#codePointAt(…) over String#charCodeAt(…) and String.fromCodePoint(…) over String.fromCharCode(…).
Not configured in any preset
unicorn/prefer-date-now docs
Prefer Date.now() to get the number of milliseconds since the Unix Epoch.
Not configured in any preset
unicorn/prefer-default-parameters docs
Prefer default parameters over reassignment.
Not configured in any preset
unicorn/prefer-dom-node-append docs
Prefer Node#append() over Node#appendChild().
Not configured in any preset
unicorn/prefer-dom-node-dataset docs
Prefer using .dataset on DOM elements over calling attribute methods.
Not configured in any preset
unicorn/prefer-dom-node-remove docs
Prefer childNode.remove() over parentNode.removeChild(childNode).
Not configured in any preset
unicorn/prefer-dom-node-text-content docs
Prefer .textContent over .innerText.
Not configured in any preset
unicorn/prefer-event-target docs
Prefer EventTarget over EventEmitter.
Not configured in any preset
unicorn/prefer-export-from docs
Prefer export…from when re-exporting.
Configured in
unicorn/prefer-includes docs
Prefer .includes() over .indexOf() and Array#some() when checking for existence or non-existence.
Not configured in any preset
unicorn/prefer-json-parse-buffer docs
Prefer reading a JSON file as a buffer.
Not configured in any preset
unicorn/prefer-keyboard-event-key docs
Prefer KeyboardEvent#key over KeyboardEvent#keyCode.
Not configured in any preset
unicorn/prefer-logical-operator-over-ternary docs
Prefer using a logical operator over a ternary.
Not configured in any preset
unicorn/prefer-math-trunc docs
Enforce the use of Math.trunc instead of bitwise operators.
Not configured in any preset
unicorn/prefer-modern-dom-apis docs
Prefer .before() over .insertBefore(), .replaceWith() over .replaceChild(), prefer one of .before(), .after(), .append() or .prepend() over insertAdjacentText() and insertAdjacentElement().
Not configured in any preset
unicorn/prefer-modern-math-apis docs
Prefer modern Math APIs over legacy patterns.
Not configured in any preset
unicorn/prefer-module docs
Prefer JavaScript modules (ESM) over CommonJS.
Not configured in any preset
unicorn/prefer-native-coercion-functions docs
Prefer using String, Number, BigInt, Boolean, and Symbol directly.
Not configured in any preset
unicorn/prefer-negative-index docs
Prefer negative index over .length - index when possible.
Not configured in any preset
unicorn/prefer-node-protocol docs
Prefer using the node: protocol when importing Node.js builtin modules.
Not configured in any preset
unicorn/prefer-number-properties docs
Prefer Number static properties over global ones.
Not configured in any preset
unicorn/prefer-object-from-entries docs
Prefer using Object.fromEntries(…) to transform a list of key-value pairs into an object.
Not configured in any preset
unicorn/prefer-optional-catch-binding docs
Prefer omitting the catch binding parameter.
Not configured in any preset
unicorn/prefer-prototype-methods docs
Prefer borrowing methods from the prototype instead of the instance.
Configured in
unicorn/prefer-query-selector docs
Prefer .querySelector() over .getElementById(), .querySelectorAll() over .getElementsByClassName() and .getElementsByTagName().
Not configured in any preset
unicorn/prefer-reflect-apply docs
Prefer Reflect.apply() over Function#apply().
Not configured in any preset
unicorn/prefer-regexp-test docs
Prefer RegExp#test() over String#match() and RegExp#exec().
Not configured in any preset
unicorn/prefer-set-has docs
Prefer Set#has() over Array#includes() when checking for existence or non-existence.
Not configured in any preset
unicorn/prefer-set-size docs
Prefer using Set#size instead of Array#length.
Not configured in any preset
unicorn/prefer-spread docs
Prefer the spread operator over Array.from(…), Array#concat(…), Array#{slice,toSpliced}() and String#split('').
Not configured in any preset
unicorn/prefer-string-replace-all docs
Prefer String#replaceAll() over regex searches with the global flag.
Not configured in any preset
unicorn/prefer-string-slice docs
Prefer String#slice() over String#substr() and String#substring().
Not configured in any preset
unicorn/prefer-string-starts-ends-with docs
Prefer String#startsWith() & String#endsWith() over RegExp#test().
Not configured in any preset
unicorn/prefer-string-trim-start-end docs
Prefer String#trimStart() / String#trimEnd() over String#trimLeft() / String#trimRight().
Not configured in any preset
unicorn/prefer-switch docs
Prefer switch over multiple else-if.
Not configured in any preset
unicorn/prefer-ternary docs
Prefer ternary expressions over simple if-else statements.
Not configured in any preset
unicorn/prefer-top-level-await docs
Prefer top-level await over top-level promises and async function calls.
Not configured in any preset
unicorn/prefer-type-error docs
Enforce throwing TypeError in type checking conditions.
Not configured in any preset
unicorn/prevent-abbreviations docs
Prevent abbreviations.
Not configured in any preset
unicorn/relative-url-style docs
Enforce consistent relative URL style.
Not configured in any preset
unicorn/require-array-join-separator docs
Enforce using the separator argument with Array#join().
Configured in
unicorn/require-number-to-fixed-digits-argument docs
Enforce using the digits argument with Number#toFixed().
Configured in
unicorn/require-post-message-target-origin docs
Enforce using the targetOrigin argument with window.postMessage().
Not configured in any preset
unicorn/string-content docs
Enforce better string content.
Not configured in any preset
unicorn/switch-case-braces docs
Enforce consistent brace style for case clauses.
Not configured in any preset
unicorn/template-indent docs
Fix whitespace-insensitive template indentation.
Not configured in any preset
unicorn/text-encoding-identifier-case docs
Enforce consistent case for text encoding identifiers.
Not configured in any preset
unicorn/throw-new-error docs
Require new when throwing an error.
Not configured in any preset
unicorn/import-index docs
no description
Not configured in any preset
unicorn/no-array-instanceof docs
no description
Not configured in any preset
unicorn/no-fn-reference-in-iterator docs
no description
Not configured in any preset
unicorn/no-reduce docs
no description
Not configured in any preset
unicorn/prefer-dataset docs
no description
Not configured in any preset
unicorn/prefer-event-key docs
no description
Not configured in any preset
unicorn/prefer-exponentiation-operator docs
no description
Not configured in any preset
unicorn/prefer-flat-map docs
no description
Not configured in any preset
unicorn/prefer-node-append docs
no description
Not configured in any preset
unicorn/prefer-node-remove docs
no description
Not configured in any preset
unicorn/prefer-object-has-own docs
no description
Not configured in any preset
unicorn/prefer-replace-all docs
no description
Not configured in any preset
unicorn/prefer-starts-ends-with docs
no description
Not configured in any preset
unicorn/prefer-text-content docs
no description
Not configured in any preset
unicorn/prefer-trim-start-end docs
no description
Not configured in any preset
unicorn/regex-shorthand docs
no description
Not configured in any preset