npm package: @odg/eslint-config
Description: Linter for JavaScript And Typescript project
Author: Dragons Gamers
Latest version: 3.3.0

<h1 align="center">
  <a href="https://github.com/ODGodinho">
    <img src="public/images/quality.png" alt="Stanley Imagem" width="200"/>
  </a>
  <br>
  ODG Linter Js By Dragons Gamers
</h1>

<h4 align="center">✴️ Code Quality for typescript ✴️!</h4>

<p align="center">

  <img alt="Repository size" src="https://img.shields.io/github/repo-size/ODGodinho/ODG-Linter-Js">

  <a href="https://www.linkedin.com/in/victor-alves-odgodinho/">
    <img alt="Made by ODGodinho" src="https://img.shields.io/badge/made%20by-ODGodinho-%2304D361">
  </a>

  <a href="https://github.com/ODGodinho/ODG-Linter-Js/commits/master">
    <img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/ODGodinho/ODG-Linter-Js">
  </a>

  <img alt="License" src="https://img.shields.io/badge/license-MIT-brightgreen">

   <a href="https://github.com/ODGodinho/ODG-Linter-Js/stargazers">
    <img alt="Stargazers" src="https://img.shields.io/github/stars/ODGodinho/ODG-Linter-Js?style=social">
  </a>

</p>

# Standard Code

- [Introduction](#introduction)
  - [Installation](#installation)
- [File Name Convention](#file-name-convention)
- [Semi Rule](#semi-rule)
- [Cond Assign](#cond-assign)
- [Quotes Rule](#quotes-rule)
- [Indent Rule](#indent-rule)
- [Line Break Rule](#line-break-rule)
- [EOL last Rule](#eol-last-rule)
- [Max Line Len Rule](#max-line-len-rule)
- [Camel Case Rule](#camel-case-rule)
- [Strict](#strict)
- [Padded Block Rule](#padded-block-rule)
- [Object Shorthand](#object-shorthand)
- [No Unused Labels](#no-unused-labels)
- [Lines Between Class Members](#lines-between-class-members)
- [No Multi Assign Rule](#no-multi-assign-rule)
- [Explicit Member Accessibility Rule](#explicit-member-accessibility-rule)
- [Default Param Last Rule](#default-param-last-rule)
- [Space Before Function Paren](#space-before-function-paren)
- [Exception Handled](#exception-handled)
- [Array Space](#array-space)
- [Key Word Space](#key-word-space)
- [Space Format](#space-format)
- [UTF-8 Only](#utf-8-only)
- [No Space in Parentheses](#no-space-in-parentheses)
- [No Multiple Space](#no-multiple-space)
- [Useless String Concat](#useless-string-concat)
- [No Self Assign](#no-self-assign)
- [Force Return Type](#force-return-type)
- [Array Bracket Line](#array-bracket-line)
- [Unused Vars](#unused-vars)
- [Comma Spacing](#comma-spacing)
- [Comma Dangle](#comma-dangle)
- [Arrow Spacing](#arrow-spacing)
- [Prefer Arrow Function](#prefer-arrow-function)
- [Prefer Destructuring](#prefer-destructuring)
- [Arrow Function Body](#arrow-function-body)
- [Arrow Function Parentheses](#arrow-function-parentheses)
- [Arrow Function No Break Line](#arrow-function-no-break-line)
- [No Empty Block](#no-empty-block)
- [No Long Syntax](#no-long-syntax)
- [Useless Parens](#useless-parens)
- [Useless Boolean](#useless-boolean)
- [Useless Alias](#useless-alias)
- [Return New line](#return-new-line)
- [Comment Multi Line Prefer](#comment-multi-line-prefer)
- [No throw Literal](#no-throw-literal)
- [No Unreachable](#no-unreachable)
- [No Multiline String](#no-multiline-string)
- [No Unsafe Assign](#no-unsafe-assign)
- [Disallow Script Url](#disallow-script-url)
- [Disallow Undefined](#disallow-undefined)
- [Function Name](#function-name)
- [Function Name Match](#function-name-match)
- [No Use Future Reserved Words](#no-use-future-reserved-words)
- [No Generator Without Yield](#no-generator-without-yield)
- [Inverted Assertion Arguments](#inverted-assertion-arguments)
- [Max Union Size](#max-union-size)
- [No Redundant Optional](#no-redundant-optional)
- [Prefer Type Guard](#prefer-type-guard)
- [No Production Debug](#no-production-debug)
- [Unused Named Groups](#unused-named-groups)
- [Get And Setters](#get-and-setters)
- [Function Style](#function-style)
- [No Else Return](#no-else-return)
- [No Console Spaces](#no-console-spaces)
- [No Hex Escape](#no-hex-escape)
- [Prefer Array Flat Map](#prefer-array-flat-map)
- [Prefer String Slice](#prefer-string-slice)
- [Prefer Modern DOM](#prefer-modern-dom)
- [Prefer Prefix Number](#prefer-prefix-number)
- [Numeric Separators Style](#numeric-separators-style)
- [Prefer Default Parame](#prefer-default-parame)
- [No Avoid Reverse](#no-avoid-reverse)
- [Prefer Code Point](#prefer-code-point)
- [Bool Param Default](#bool-param-default)
- [Class Name Convention](#class-name-convention)
- [Comma Or Logical Or Case](#comma-or-logical-or-case)
- [No Constructor Bind](#no-constructor-bind)
- [No Thenable](#no-thenable)
- [No Unreadable Iife](#no-unreadable-iife)
- [Prefer Native Cast](#prefer-native-cast)
- [Prefer Logical Operator Over Ternary](#prefer-logical-operator-over-ternary)
- [Prefer Event Target](#prefer-event-target)
- [Prefer Object From Entries](#prefer-object-from-entries)
- [Prefer Array From Map](#prefer-array-from-map)
- [Prefer Array Flat](#prefer-array-flat)
- [This Pattern](#this-pattern)
- [Use Dot](#use-dot)
- [Use this](#use-this)
- [Use IsNan](#use-is-nan)
- [Dot Object Format](#dot-object-format)
- [No Trailing Space](#no-trailing-space)
- [Type Format](#type-format)
- [Max Statements Per Line](#max-statements-per-line)
- [No Constant Condition](#no-constant-condition)
- [No Debugger](#no-debugger)
- [No Console](#no-console)
- [No deprecated](#no-deprecated)
- [Not Duplicate Case](#not-duplicate-case)
- [Regex Block](#regex-block)
- [No Overwrite Exception](#no-overwrite-exception)
- [No Extra Semi](#no-extra-semi)
- [No Function Overwrite](#no-function-overwrite)
- [No Delete Var](#no-delete-var)
- [No Lone Blocks](#no-lone-blocks)
- [No Proto](#no-proto)
- [No Declare in Block](#no-declare-in-block)
- [No Nonoctal Decimal Escape](#no-nonoctal-decimal-escape)
- [No Import Absolute Path](#no-import-absolute-path)
- [No Webpack Loader Syntax](#no-webpack-loader-syntax)
- [No Magic Number](#no-magic-number)
- [Security Negation](#security-negation)
- [Regex Space](#regex-space)
- [Array No Space](#array-no-space)
- [Valid TypeOf](#valid-type-of)
- [Strict equality](#strict-equality)
- [No Label](#no-label)
- [Full Decimal Number](#full-decimal-number)
- [No Global Overwrite](#no-global-overwrite)
- [Not Used New](#not-used-new)
- [No New Function](#no-new-function)
- [No Redeclare](#no-redeclare)
- [No Self Compare](#no-self-compare)
- [Loop Valid](#loop-valid)
- [Useless Scape](#useless-scape)
- [No Yoda](#no-yoda)
- [No Undefined declare](#no-undefined-declare)
- [No New require](#no-new-require)
- [No New Object](#no-new-object)
- [No New Native Nonconstructor](#no-new-native-nonconstructor)
- [Var Size](#var-size)
- [Max Depth](#max-depth)
- [Max Params](#max-params)
- [Max Statements](#max-statements)
- [Operator Assignment](#operator-assignment)
- [Require Yield](#require-yield)
- [Prefer Rest Params](#prefer-rest-params)
- [Symbol Description](#symbol-description)
- [No Await Return](#no-await-return)
- [Max Class Per File](#max-class-per-file)
- [No Constructor Return](#no-constructor-return)
- [Prefer Exponentiation Operator](#prefer-exponentiation-operator)
- [Prefer Object Spread](#prefer-object-spread)
- [Accessor Pairs](#accessor-pairs)
- [Default Case Last](#default-case-last)
- [Prefer Literals](#prefer-literals)
- [Useless Condition](#useless-condition)
- [No Multiple Empty Line](#no-multiple-empty-line)
- [No Misused New](#no-misused-new)
- [No Semicolon Before spacing](#no-semicolon-before-spacing)
- [Disallow Type](#disallow-type)
- [Disallow Empty Function](#disallow-empty-function)
- [Disallow Duplicate Imports](#disallow-duplicate-imports)
- [Disallow Unnecessary Type](#disallow-unnecessary-type)
- [Disallow Caller](#disallow-caller)
- [Disallow Underscore](#disallow-underscore)
- [Disallow Param Reassign](#disallow-param-reassign)
- [Prefer Const](#prefer-const)
- [Array Type](#array-type)
- [Disallow Await sync function](#disallow-await-sync-function)
- [Method Signature Style](#method-signature-style)
- [No Unnecessary Type Assertion](#no-unnecessary-type-assertion)
- [No Unsafe Call](#no-unsafe-call)
- [No Var](#no-var)
- [Operator Break-Line](#operator-break-line)
- [Generator Function Stars](#generator-function-stars)
- [No Unsafe Optional Chaining](#no-unsafe-optional-chaining)
- [Array Callback](#array-callback)
- [Space Types](#space-types)
- [Curly](#curly)
- [Quote Props](#quote-props)
- [Brace Style](#brace-style)
- [Comma Style](#comma-style)
- [Object Break Line](#object-break-line)
- [Object Curly Newline](#object-curly-newline)
- [No Negative Condition](#no-negative-condition)
- [No Duplicated Branches](#no-duplicated-branches)
- [No Identical Functions](#no-identical-functions)
- [No Inverted Boolean Check](#no-inverted-boolean-check)
- [No Nested Switch](#no-nested-switch)
- [No Nested Template Literals](#no-nested-template-literals)
- [No Redundant Boolean](#no-redundant-boolean)
- [Prefer Immediate Return](#prefer-immediate-return)
- [Prefer Object Literal](#prefer-object-literal)
- [Prefer Single Boolean Return](#prefer-single-boolean-return)
- [No Shadow](#no-shadow)
- [Parentheses New Line](#parentheses-new-line)
- [No Func Call Spacing](#no-func-call-spacing)
- [Array Element New Line](#array-element-new-line)
- [Wrap Iife](#wrap-iife)
- [Disallow Template Tag Space](#disallow-template-tag-space)
- [No Space Spread](#no-space-spread)
- [Inline IF](#inline-if)
- [New Instance Use Parentheses](#new-instance-use-parentheses)
- [Logical Assignment Operators](#logical-assignment-operators)
- [No With](#no-with)
- [Promise Rules](#promise-rules)
  - [No New Statics](#no-new-statics)
  - [No Return Wrap](#no-return-wrap)
  - [Param Name](#param-name)
  - [Always Return](#always-return)
  - [No Nesting](#no-nesting)
  - [No Return Finally](#no-return-finally)
  - [Valid Params](#valid-params)
  - [No Async Promise Executor](#no-async-promise-executor)
  - [No Misused Promises](#no-misused-promises)
- [Import](#import)
  - [New Line After Import](#new-line-after-import)
  - [Import Deprecated](#import-deprecated)
  - [No Mutable Export](#no-mutable-export)
  - [No Amd](#no-amd)
  - [Prefer Default Export](#prefer-default-export)
  - [Max Imports](#max-imports)
  - [No CommanJs Export](#no-commanjs-export)
  - [No Useless Path Import](#no-useless-path-import)
  - [No Extraneous Dependencies](#no-extraneous-dependencies)
  - [Import Order](#import-order)
  - [No Anonymous Default Export](#no-anonymous-default-export)
  - [Prefer Node Protocol](#prefer-node-protocol)
  - [Prefer export from](#prefer-export-from)
  - [No Empty Import](#no-empty-import)
  - [Export End File](#export-end-file)
  - [Import First](#import-first)
  - [No Named Default](#no-named-default)
- [Documentation](#documentation)
  - [Space Comment](#spaced-comment)
  - [Capitalized Comments](#capitalized-comments)
  - [Comment Align](#comment-align)
  - [Disallow Space Align](#disallow-space-align)
  - [Validate Param](#validate-param)
  - [Validate Syntax](#validate-syntax)
  - [Validate Tag Name](#validate-tag-name)
  - [Validate Types](#validate-types)
  - [Validate Values](#validate-values)
  - [Empty Tags](#empty-tags)
  - [Validate Block](#validate-block)
  - [Disallow Extra Asterisk](#disallow-extra-asterisk)
  - [Disallow Default Value](#disallow-default-value)
- [Regex Rules](#regex-rules)
  - [No Optional With Assertion](#no-optional-with-assertion)
  - [No Control Character](#no-control-character)
  - [No Dupe Condition](#no-dupe-condition)
  - [No Empty Alternative](#no-empty-alternative)
  - [No Empty Capturing Group](#no-empty-capturing-group)
  - [No Empty Character Class](#no-empty-character-class)
  - [No Empty Group](#no-empty-group)
  - [No Empty Look Rounds Assertion](#no-empty-look-rounds-assertion)
  - [No Escape Backspace](#no-escape-backspace)
  - [No Invalid Regexp](#no-invalid-regexp)
  - [No Lazy Ends](#no-lazy-ends)
  - [No Misleading Unicode Character](#no-misleading-unicode-character)
  - [No Optional Assertion](#no-optional-assertion)
  - [No Potentially Useless Back Reference](#no-potentially-useless-back-reference)
  - [No Useless Assertions](#no-useless-assertions)
  - [No Useless Back Reference](#no-useless-back-reference)
  - [No Useless Dollar Replacements](#no-useless-dollar-replacements)
  - [Strict Regex](#strict-regex)
  - [Confusing Quantifier](#confusing-quantifier)
  - [Control Character Escape](#control-character-escape)
  - [Negation](#negation)
  - [No Dupe Characters Character Class](#no-dupe-characters-character-class)
  - [No Invisible Character](#no-invisible-character)
  - [No Legacy Features](#no-legacy-features)
  - [No Non Standard Flag](#no-non-standard-flag)
  - [No Obscure Range](#no-obscure-range)
  - [No Trivially Nested Quantifier](#no-trivially-nested-quantifier)
  - [No Unused Capturing Group](#no-unused-capturing-group)
  - [No Useless Character Class](#no-useless-character-class)
  - [No Useless Flag](#no-useless-flag)
  - [No Useless Lazy](#no-useless-lazy)
  - [No Useless Quantifier](#no-useless-quantifier)
  - [No Useless Range](#no-useless-range)
  - [No Useless Two Num Quantifier](#no-useless-two-num-quantifier)
  - [No Zero Quantifier](#no-zero-quantifier)
  - [Optimal LookAround Quantifier](#optimal-lookaround-quantifier)
  - [Optimal Quantifier Concatenation](#optimal-quantifier-concatenation)
  - [Prefer Quantifier](#prefer-quantifier)
  - [Prefer Range](#prefer-range)
  - [Sort Alternatives](#sort-alternatives)
  - [Hexadecimal Escape](#hexadecimal-escape)
  - [Match Any](#match-any)
  - [No Useless Escape](#no-useless-escape)
  - [No Useless Non Capturing Group](#no-useless-non-capturing-group)
  - [Prefer Character Class](#prefer-character-class)
  - [Prefer D](#prefer-d)
  - [Prefer Plus](#prefer-plus)
  - [Prefer Question Quantifier](#prefer-question-quantifier)
  - [Prefer Star Quantifier](#prefer-star-quantifier)
  - [Prefer Unicode Code Point Escapes](#prefer-unicode-code-point-escapes)
  - [Prefer W](#prefer-w)
  - [Sort Character Class Elements](#sort-character-class-elements)
  - [Sort Flags](#sort-flags)
  - [Prefer Named Capture Group](#prefer-named-capture-group)
  - [Prefer Regexp Exec](#prefer-regexp-exec)
  - [Existing Groups](#existing-groups)
  - [No Misleading Capturing Group](#no-misleading-capturing-group)
  - [No Extra Lookaround Assertions](#no-extra-lookaround-assertions)
- [Security](#security)
  - [Eval Disabled](#eval-disabled)
  - [Detect Unsafe Regex](#detect-unsafe-regex)
  - [Buffer No Assert](#buffer-no-assert)
  - [No Exec Child Process](#no-exec-child-process)
  - [No Mustache Scape](#no-mustache-scape)
  - [No Csrf Before Method Override](#no-csrf-before-method-override)
  - [No Literal Fs Filename](#no-literal-fs-filename)
  - [No Pseudo Random Bytes](#no-pseudo-random-bytes)
  - [Prevent Secret Token](#prevent-secret-token)
  - [Prevent Literal Code](#prevent-literal-code)
  - [No Import Dynamic](#no-import-dynamic)
  - [Security SSL](#security-ssl)
  - [Security Encrypt Access](#security-encrypt-access)
  - [Certificate Transparency](#certificate-transparency)
  - [No Log confidential information](#no-log-confidential-information)
  - [Content Length](#content-length)
  - [Anti Trojan Source No Bidi](#anti-trojan-source-no-bidi)
  - [Cookie Httponly](#cookie-httponly)
  - [Protect XSS Render](#protect-xss-render)
  - [Force Integrity](#force-integrity)
  - [DNS prefetching](#dns-prefetching)
  - [No Prototype Builtins](#no-prototype-builtins)
  - [File Permissions](#file-permissions)
  - [File Upload](#file-upload)
  - [Frame Ancestors](#frame-ancestors)
  - [Hashing Insecurity](#hashing-insecurity)
  - [Hidden Files](#hidden-files)
  - [No Dynamic Delete](#no-dynamic-delete)
  - [Cors](#cors)
  - [Csrf](#csrf)
  - [Aws Security](#aws-security)
  - [Security Cookie](#security-cookie)
  - [Insecure Cookie](#insecure-cookie)
  - [No Clear Text Protocols](#no-clear-text-protocols)
  - [Insecure Jwt Token](#insecure-jwt-token)
  - [No Hardcoded Credentials](#no-hardcoded-credentials)
  - [No Hardcoded ip](#no-hardcoded-ip)
  - [No Os Command From Path](#no-os-command-from-path)
  - [No Unsafe Unzip](#no-unsafe-unzip)
  - [Sockets](#sockets)
  - [Helmet Security](#helmet-security)
  - [Unverified Certificate](#unverified-certificate)
  - [Sql Queries](#sql-queries)
- [Catch Error Name](#catch-error-name)
- [Consistent Destructured](#consistent-destructured)
- [Consistent Function Scope](#consistent-function-scope)
- [Exception With Message](#exception-with-message)
- [Escape Case](#escape-case)
- [New For Builtin](#new-for-builtin)
- [No Abusive Eslint Disable](#no-abusive-eslint-disable)
- [Prefer for-of](#prefer-for-of)
- [No Array Push Push](#no-array-push-push)
- [No Await Chased](#no-await-chased)
- [No Document Cookie](#no-document-cookie)
- [No Empty File](#no-empty-file)
- [No Instance Of Array](#no-instance-of-array)
- [No Invalid Remove Event Listener](#no-invalid-remove-event-listener)
- [No Lonely If](#no-lonely-if)
- [No Nested Ternary](#no-nested-ternary)
- [No New Buffer](#no-new-buffer)
- [No This Assignment](#no-this-assignment)
- [No Useless Fallback In Spread](#no-useless-fallback-in-spread)
- [No Useless Length Check](#no-useless-length-check)
- [No Useless Spread](#no-useless-spread)
- [No Useless Switch Case](#no-useless-switch-case)
- [No Useless Undefined](#no-useless-undefined)
- [Prefer Add Event Listener](#prefer-add-event-listener)
- [Prefer Array Find](#prefer-array-find)
- [Prefer Array Index Of](#prefer-array-index-of)
- [Prefer Array Some](#prefer-array-some)
- [Prefer Dom Node Append](#prefer-dom-node-append)
- [Prefer Include](#prefer-include)
- [Prefer Keyboard Event Key](#prefer-keyboard-event-key)
- [Prefer Negative Index](#prefer-negative-index)
- [Prefer Optional Catch Binding](#prefer-optional-catch-binding)
- [Prefer Prototype Methods](#prefer-prototype-methods)
- [Prefer Query Selector](#prefer-query-selector)
- [Prefer Regexp Test](#prefer-regexp-test)
- [Prefer Spread](#prefer-spread)
- [Prefer String Replace All](#prefer-string-replace-all)
- [Prefer String Starts Ends With](#prefer-string-starts-ends-with)
- [Prefer String Trim Start End](#prefer-string-trim-start-end)
- [Prefer Switch](#prefer-switch)
- [Prefer Ternary](#prefer-ternary)
- [Multiline Ternary Multiple](#multiline-ternary-multiple)
- [Prevent Abbreviations](#prevent-abbreviations)
- [Consistent Relative URL](#consistent-relative-url)
- [Require Array Join Separator](#require-array-join-separator)
- [Require Number To Fixed Digits Argument](#require-number-to-fixed-digits-argument)
- [Template String Indent](#template-string-indent)
- [Adjacent Overload Signatures](#adjacent-overload-signatures)
- [Ban Ts Comment](#ban-ts-comment)
- [Ban Tslint Comment](#ban-tslint-comment)
- [Class Literal Property Style](#class-literal-property-style)
- [Consistent Generic Constructors](#consistent-generic-constructors)
- [Consistent Indexed Object Style](#consistent-indexed-object-style)
- [Consistent Type Assertions](#consistent-type-assertions)
- [Consistent Type Definitions](#consistent-type-definitions)
- [Consistent Type Exports](#consistent-type-exports)
- [Consistent Type Imports](#consistent-type-imports)
- [Member Delimiter Style](#member-delimiter-style)
- [Member Ordering](#member-ordering)
- [No Confusing Non Null Assertion](#no-confusing-non-null-assertion)
- [No Extra Non Null Assertion](#no-extra-non-null-assertion)
- [No For In Array](#no-for-in-array)
- [No Inferrable Type](#no-inferrable-type)
- [No This Alias](#no-this-alias)
- [Non Nullable Type Assertion Style](#non-nullable-type-assertion-style)
- [Parameter Properties](#parameter-properties)
- [Prefer Enum Initializers](#prefer-enum-initializers)
- [Prefer Function Type](#prefer-function-type)
- [Prefer Namespace Keyword](#prefer-namespace-keyword)
- [Prefer Nullish Coalescing](#prefer-nullish-coalescing)
- [Prefer Optional Chain](#prefer-optional-chain)
- [Prefer Readonly](#prefer-readonly)
- [Prefer Reduce Type Parameter](#prefer-reduce-type-parameter)
- [Promise Function Async](#promise-function-async)
- [Require Array Sort Compare](#require-array-sort-compare)
- [Sort Type Constituents](#sort-type-constituents)
- [Space Before Blocks](#space-before-blocks)
- [Performance](#performance)
  - [No Alert](#no-alert)
  - [No Loop Func](#no-loop-func)
  - [No Sync](#no-sync)
- [Errors](#errors)
  - [Construtor Super Invalid](#construtor-super-invalid)
  - [Getter Return](#getter-return)
  - [No Class Assign](#no-class-assign)
  - [No Compare Neg Zero](#no-compare-neg-zero)
  - [Useless Loop](#useless-loop)
  - [No Loss Of Precision](#no-loss-of-precision)
  - [No Unsafe Argument](#no-unsafe-argument)
  - [No Dupe Class Members](#no-dupe-class-members)
  - [No Dupe Keys](#no-dupe-keys)
  - [Import Default Not Fount](#import-default-not-fount)
  - [Import Namespace](#import-namespace)
  - [No Self Import](#no-self-import)
  - [Export Name](#export-name)
  - [Import Namespace](#import-namespace)
  - [No Import Resolve](#no-import-resolve)
  - [Import Not Found](#import-not-found)
  - [JS Type](#js-type)
  - [No Invalid This](#no-invalid-this)
  - [No This Before Super](#no-this-before-super)
  - [No Obj Calls](#no-obj-calls)
  - [No Empty Pattern](#no-empty-pattern)
  - [No Useless Computed Key](#no-useless-computed-key)
  - [Useless Call Code](#useless-call-code)
  - [Useless Catch Code](#useless-catch-code)
  - [Useless Expression Code](#useless-expression-code)
  - [Useless Return Code](#useless-return-code)
  - [Useless Construct Code](#useless-construct-code)
  - [No Use Before Define](#no-use-before-define)
  - [No Base To String](#no-base-to-string)
  - [Not IN Primitive type](#not-in-primitive-type)
  - [Useless String Operation](#useless-string-operation)
  - [No Useless Intersection](#no-useless-intersection)
  - [Stateful Regex](#stateful-regex)
- [Possible Errors](#possible-errors)
  - [For Direction](#for-direction)
  - [No Extra Bind](#no-extra-bind)
  - [No Template Curly In String](#no-template-curly-in-string)
  - [No Dupe Else If](#no-dupe-else-if)
  - [No Unused Private Class Members](#no-unused-private-class-members)
  - [No Constant Binary Expression](#no-constant-binary-expression)
  - [No Unneeded Ternary](#no-unneeded-ternary)
  - [No Unsafe Negation](#no-unsafe-negation)
  - [Text Encoding Identifier Case](#text-encoding-identifier-case)
  - [Arguments Order](#arguments-order)
  - [Assertions In Tests](#assertions-in-tests)
  - [Test Multiple Possible Assert](#test-multiple-possible-assert)
  - [No Disable Timeout](#no-disable-timeout)
  - [No Empty Static Block](#no-empty-static-block)
  - [No Fallthrough](#no-fallthrough)
  - [No Octal](#no-octal)
  - [Octal Scape](#octal-scape)
  - [No Global Assign](#no-global-assign)
  - [No Case Declarations](#no-case-declarations)
  - [No Confusing Void Expression](#no-confusing-void-expression)
  - [No Duplicate Enum Values](#no-duplicate-enum-values)
  - [No Floating Promises](#no-floating-promises)
  - [No Invalid Void Type](#no-invalid-void-type)
  - [No Non Null Asserted Nullish Coalescing](#no-non-null-asserted-nullish-coalescing)
  - [No Non Null Asserted Optional Chain](#no-non-null-asserted-optional-chain)
  - [No Unsafe Declaration Merging](#no-unsafe-declaration-merging)
  - [No Useless Empty Export](#no-useless-empty-export)
  - [Restrict Template Expressions](#restrict-template-expressions)
  - [Return Await Try Catch](#return-await-try-catch)
  - [Switch Exhaustiveness Check](#switch-exhaustiveness-check)
  - [Index Of Compare To Positive Number](#index-of-compare-to-positive-number)
  - [No Invariant Returns](#no-invariant-returns)
  - [Inconsistent Function Call](#inconsistent-function-call)
  - [Duplicate Conditions](#duplicate-conditions)
  - [Redundant Type Aliases](#redundant-type-aliases)
  - [No Element Overwrite](#no-element-overwrite)
  - [No Empty Collection](#no-empty-collection)
  - [No Extra Arguments](#no-extra-arguments)
  - [No Identical Expressions](#no-identical-expressions)
  - [No Ignored Return](#no-ignored-return)
  - [No Use Of Empty Return Value](#no-use-of-empty-return-value)
  - [No Collection Size Mischeck](#no-collection-size-mischeck)
  - [No Gratuitous Expressions](#no-gratuitous-expressions)
  - [No Unused Collection](#no-unused-collection)
  - [No Inconsistent Docblock](#no-inconsistent-docblock)
- [YAML / JSON](#yaml-json)

## Introduction

### Installation

Add dependence to package.json

```bash
npm install @odg/eslint-config
# or
yarn add -D @odg/eslint-config
```

Create the `eslint.config.mjs` file in the root directory of your project.

> Use .mjs file to avoid warn errors

```js
import odgLinter from "@odg/eslint-config";

export default [
    ...odgLinter,
];

```

Add script in your `package.json` file

```json
{
    "scripts": {
        "lint": "eslint",
        "lint:fix": "eslint --fix",
    },
    "engines": {
        "node": ">=24"
    }
}
```

Test List: `npm run lint .` or `yarn lint .`
Start Fix: `npm run lint:fix .` or `yarn lint:fix .`

## File Name Convention

----------

File Name Convention

<https://github.com/selaux/eslint-plugin-filenames>

👍 Examples of correct code

```typescript
// File name Foo.ts
export default class Foo {
}
```

👎 Examples of incorrect code

```typescript
// File name FooClass.ts
export default class Foo {
}
```

## Semi Rule

----------

Requires semicolons at the end of statements

<https://eslint.org/docs/rules/semi#semi>
<https://eslint.org/docs/rules/semi-style>
<https://eslint.org/docs/latest/rules/no-unexpected-multiline>

👍 Examples of correct code

```typescript
var name = "ODG";

object.method = function() {
    // ...
};

class Foo {
    bar = 1;
}

foo();
[1, 2, 3].forEach(bar);

for (
    var i = 0;
    i < 10;
    ++i
) {
    foo();
}

class C {
    static {
        foo();
    }
}

const foo = bar;
(1 || 2).baz();

const baz = bar
;(1 || 2).baz()

const hello = 'world';
[1, 2, 3].forEach(addNumber);

const hi = 'world'
void [1, 2, 3].forEach(addNumber);

const x = function() {};
`hello`

const tag = function() {}
tag `hello`
```

👎 Examples of incorrect code

```typescript
var name = "ODG"

object.method = function() {
    // ...
}

class Foo {
    bar = 1
}

foo()
;[1, 2, 3].forEach(bar)

for (
    var i = 0
    ; i < 10
    ; ++i
) {
    foo()
}

class C {
    static {
        foo()
        ;bar()
    }
}

const foo = bar
(1 || 2).baz();

const hello = 'world'
[1, 2, 3].forEach(addNumber);

const x = function() {}
`hello`

const y = function() {}
y
`hello`

const z = foo
/regex/g.test(bar)
```

## Cond Assign

----------

In conditional statements, it is very easy to mistype a comparison operator (such as ==) as an assignment operator
(such as =). For example:

<https://eslint.org/docs/latest/rules/no-cond-assign>

👍 Examples of correct code

```typescript
// Assignment replaced by comparison
let x;
if (x === 0) {
    const b = 1;
}

// Practical example that wraps the assignment in parentheses
const setHeight = function (someNode) {
    do {
        someNode.height = "100px";
    } while ((someNode = someNode.parentNode));
}

// Practical example that wraps the assignment and tests for 'null'
const set_height = function (someNode) {
    do {
        someNode.height = "100px";
    } while ((someNode = someNode.parentNode) !== null);
}
```

👎 Examples of incorrect code

```typescript
let x;
if (x = 0) {
    const b = 1;
}

// Practical example that is similar to an error
const setHeight = function (someNode) {
    do {
        someNode.height = "100px";
    } while (someNode = someNode.parentNode);
}
```

## Quotes Rule

----------

Requires the use of double quotes wherever possible

Enforces the use of double quotes for all JSX attribute values that don’t contain a double quote.

<https://eslint.org/docs/rules/quotes>
<https://eslint.org/docs/rules/jsx-quotes>

👍 Examples of correct code

```typescript
var double = "double";
var backtick = `back
tick`;  // backticks are allowed due to newline
var backtick = tag`backtick`;
```

👎 Examples of incorrect code

```typescript
var single = 'single';
var unescaped = 'a string containing "double" quotes';
var backtick = `back\ntick`; // you can use \n in single or double quoted strings
```

## Indent Rule

----------

Requires indent with 4 spaces
Tabs Disallow

<https://eslint.org/docs/rules/indent#indent>
<https://sonarsource.github.io/rspec/#/rspec/S3973/javascript>
<https://eslint.org/docs/latest/rules/no-tabs>
<https://eslint.org/docs/latest/rules/no-mixed-spaces-and-tabs>

👍 Examples of correct code

```typescript
if (a) {
    b=c;
    function foo(d) {
        e=f;
    }
}
```

👎 Examples of incorrect code

```typescript
if (a) {
  b=c;
  function foo(d) {
    e=f;
  }
}
```

## Line Break Rule

----------

Enforces the usage of Unix line endings: `\n` for LF.

<https://eslint.org/docs/rules/linebreak-style#linebreak-style>

👍 Examples of correct code

```typescript
var a = 'a'; // \n
```

👎 Examples of incorrect code

```typescript
var a = 'a'; // \r\n
```

## EOL last Rule

----------

Force empty end line

<https://eslint.org/docs/rules/eol-last#eol-last>

👍 Examples of correct code

```typescript
function doSmth() {
  var foo = 2;
} // \n

```

👎 Examples of incorrect code

```typescript
function doSmth() {
  var foo = 2;
}
```

## Max Line Len Rule

----------

Max line len is 120

<https://eslint.org/docs/rules/max-len#max-len>

👍 Examples of correct code

```typescript
var foo = {
    "bar": "This is a bar.",
    "baz": { "qux": "This is a qux" },
    "difficult": "to read",
};
```

👎 Examples of incorrect code

```typescript
var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" }, "difficult": "to read" };
```

## Camel Case Rule

----------

Force use camel case variable

<https://eslint.org/docs/rules/camelcase#camelcase>

👍 Examples of correct code

```typescript
import { no_camelcased as camelCased } from "external-module";

var myFavoriteColor   = "#112C85";
var _myFavoriteColor  = "#112C85";
var myFavoriteColor_  = "#112C85";
var MY_FAVORITE_COLOR = "#112C85";
```

👎 Examples of incorrect code

```typescript
import { no_camelcased } from "external-module"

var my_favorite_color = "#112C85";

function do_something() {
    // ...
}
```

## Strict

----------

A strict mode directive is a "use strict" literal at the beginning of a script or function body.
It enables strict mode semantics.

<https://eslint.org/docs/latest/rules/strict>

👍 Examples of correct code

```typescript
"use strict";

function foo() {
}
```

👎 Examples of incorrect code

```typescript
function foo() {
}
```

## Padded Block Rule

----------

force empty line in blocks

<https://eslint.org/docs/rules/padded-blocks#padded-blocks>

```json
{
  "classes": "always",
  "blocks": "never",
  "switches": "never",
}
```

👍 Examples of correct code

```typescript
class ClassName {

  variable = 1;

}

switch (a) {
    case 0: foo();
}

if (a) {
    a = b;
}
```

👎 Examples of incorrect code

```typescript
class ClassName {
  variable = 1;

}

class ClassName {

  variable = 1;
}

switch (a) {

    case 0: foo();

}

if (a) {

    a = b;

}

```

## Object Shorthand

----------

Require or disallow method and property shorthand syntax for object literals

<https://eslint.org/docs/latest/rules/object-shorthand>

👍 Examples of correct code

```typescript
const foo = {
    w() {},
    *x() {},
    [y]() {},
    z
};
```

👎 Examples of incorrect code

```typescript
const foo = {
    w: function() {},
    x: function *() {},
    [y]: function() {},
    z: z
};
```

## No Unused Labels

----------

Labels that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring.

<https://eslint.org/docs/latest/rules/no-unused-labels>

👍 Examples of correct code

```typescript
A: {
    if (foo()) {
        break A;
    }
    bar();
}

B:
for (let i = 0; i < 10; ++i) {
    if (foo()) {
        break B;
    }
    bar();
}
```

👎 Examples of incorrect code

```typescript
A: var foo = 0;

B: {
    foo();
}

C:
for (let i = 0; i < 10; ++i) {
    foo();
}
```

## Lines Between Class Members

----------

Enforces consistent spacing before function parenthesis.

<https://eslint.org/docs/rules/lines-between-class-members#lines-between-class-members>
<https://eslint.style/rules/ts/lines-between-class-members>

👍 Examples of correct code

```typescript
class MyClass {
  x;

  foo() {
    //...
  }

  bar() {
    //...
  }
}
```

👎 Examples of incorrect code

```typescript
class MyClass {
  x;
  foo() {
    //...
  }
  bar() {
    //...
  }
}
```

## No Multi Assign Rule

----------

Chaining the assignment of variables can lead to unexpected results and be difficult to read.
Disabled.

<https://eslint.org/docs/rules/no-multi-assign#no-multi-assign>

👍 Examples of correct code

```typescript
var a = 5;
var b = 5;
var c = 5;

const foo = "baz";
const bar = "baz";

let a = c;
let b = c;

class Foo {
    a = 10;
    b = 10;
}

a = "quux";
b = "quux";
```

👎 Examples of incorrect code

```typescript
var a = b = c = 5;

const foo = bar = "baz";

let a =
    b =
    c;

class Foo {
    a = b = 10;
}

a = b = "quux";
```

## Explicit Member Accessibility Rule

----------

Force specific public/private or protected visibility

<https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md>

```json
{
    "anonymous": "never",
    "named": "never",
    "asyncArrow": "always"
}
```

👍 Examples of correct code

```typescript
class ClassName {
    public a = 1;
    protected c = 2;
    private b = 3;
}
```

👎 Examples of incorrect code

```typescript
class ClassName {
    a = 1;
    c = 2;
    b = 3;
}
```

## Default Param Last Rule

----------

Enforces default parameters to be last.

<https://eslint.org/docs/rules/default-param-last#default-param-last>

👍 Examples of correct code

```typescript
function f(a = 0) {}
function f(a: number, b = 0) {}
function f(a: number, b?: number) {}
function f(a: number, b?: number, c = 0) {}
function f(a: number, b = 0, c?: number) {}
class Foo {
  constructor(public a, private b = 0) {}
}
class Foo {
  constructor(public a, private b?: number) {}
}
```

👎 Examples of incorrect code

```typescript
function f(a = 0, b: number) {}
function f(a: number, b = 0, c: number) {}
function f(a: number, b?: number, c: number) {}
class Foo {
  constructor(public a = 10, private b: number) {}
}
class Foo {
  constructor(public a?: number, private b: number) {}
}
```

## Space Before Function Paren

----------

Enforces default parameters to be last.

<https://eslint.org/docs/latest/rules/space-before-function-paren>
<https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/space-before-function-paren.md>
<https://eslint.style/rules/ts/space-before-function-paren>

👍 Examples of correct code

```typescript
foo(function() {

})

function foo() {

}

(async () => {})()
```

👎 Examples of incorrect code

```typescript
foo(function () {

})

function foo () {

}

(async() => {})()
```

## Exception Handled

----------

Enforces callback error handling.

<https://eslint.org/docs/rules/handle-callback-err>
<https://github.com/weiran-zsd/eslint-plugin-node/blob/HEAD/docs/rules/handle-callback-err.md>

👍 Examples of correct code

```typescript
function loadData (err, data) {
    if (err) {
        console.log(err.stack);
    }
    doSomething();
}

function loadData (exception, data) {
    if (exception) {
        console.log(exception);
    }
    doSomething();
}

function generateError (err) {
    if (err) {
        throw new Exception(err.message);
    }
}
```

👎 Examples of incorrect code

```typescript
function loadData (err, data) {
    doSomething();
}
function loadData (exception, data) {
    doSomething();
}
```

## Class Name

----------

This rule requires constructor names to begin with a capital letter.

<https://eslint.org/docs/rules/new-cap>

👍 Examples of correct code

```typescript
var friend = new Person();
```

👎 Examples of incorrect code

```typescript
var friend = new person();
var friend = Person();
```

## Array Space

----------

requires one or more spaces or newlines inside array brackets, and disallow space inside of computed properties.

<https://eslint.org/docs/rules/array-bracket-spacing#array-bracket-spacing>

<https://eslint.org/docs/rules/computed-property-spacing#computed-property-spacing>

👍 Examples of correct code

```typescript
var arr = [ 'foo', 'bar' ];
var [ x, y ] = z;

var c = arr[0];
```

👎 Examples of incorrect code

```typescript
var arr = ['foo', 'bar'];
var [x,y] = z;

var c = arr[ 0 ];

var c = object[ "foo" ];
var c = object["foo" ];
var c = object[ "foo"];

```

## Key Word Space

----------

Enforces consistent spacing before and after keywords.

<https://eslint.org/docs/rules/keyword-spacing#keyword-spacing>
<https://eslint.org/docs/rules/yield-star-spacing>
<https://eslint.style/rules/ts/keyword-spacing>

👍 Examples of correct code

```typescript
if (foo) {
    //...
} else if (bar) {
    //...
} else {
    //...
}

try {

} catch(e) {
    // code ...
}

function *generator() {
  yield *other();
}
```

👎 Examples of incorrect code

```typescript
if(foo){
    //...
}else if(bar){
    //...
}else{
    //...
}

try{

}catch(e){
    // code ...
}

function*generator() {
  yield*other();
}

function* generator() {
  yield* other();
}

function * generator() {
  yield * other();
}
```

## Space Format

----------

This rule enforces consistency regarding the spaces after

<https://eslint.org/docs/rules/space-unary-ops#space-unary-ops>

👍 Examples of correct code

```typescript
a++;
++a;

--a;
a--;

async function foo() {
    await bar;
}

if (!foo) {

}

const value = +"3";
```

👎 Examples of incorrect code

```typescript
a ++;
++ a;

-- a;
a --;

async function foo() {
    await(bar);
}

if (! foo) {

}

const value = + "3";
```

## UTF-8 Only

----------

Disallow the Unicode Byte Order Mark (BOM).

<https://eslint.org/docs/rules/unicode-bom#unicode-bom>

## No Space in Parentheses

----------

Disallows or enforce spaces inside of parentheses.

<https://eslint.org/docs/rules/space-in-parens#space-in-parens>

👍 Examples of correct code

```typescript
foo();

foo('bar');

foo(/* bar */);

var foo = (1 + 2) * 3;
(function () { return 'bar'; }());
```

👎 Examples of incorrect code

```typescript
foo( );

foo( 'bar');
foo('bar' );
foo( 'bar' );

foo( /* bar */ );

var foo = ( 1 + 2 ) * 3;
( function () { return 'bar'; }() );
```

## No Multiple Space

----------

Disallows multiple consecutive spaces.

<https://eslint.org/docs/rules/no-multi-spaces#no-multi-spaces>

👍 Examples of correct code

```typescript
var a = 1;

if(foo === "bar") {}

a << b

var arr = [ 1, 2 ];
var a = [];
var baz = [];

a ? b : c
```

👎 Examples of incorrect code

```typescript
var a =  1;

if(foo   === "bar") {}

a <<  b

var arr  = [1,  2];
var c    = [];
var baz =  [];

a ?  b  : c
```

## Useless String Concat

----------

Disallows useless string concat.

<https://eslint.org/docs/rules/no-useless-concat#no-useless-concat>

👍 Examples of correct code

```typescript
var c = a + b;
var c = '1' + a;
var a = 1 + '1';
var c = 1 - 2;
// when the string concatenation is multiline
var c = "foo" +
    "bar";
```

👎 Examples of incorrect code

```typescript
var a = `some` + `string`;

// these are the same as "10"
var a = '1' + '0';
var a = '1' + `0`;
var a = `1` + '0';
var a = `1` + `0`;
```

## No Self Assign

----------

Disallows assignments where both sides are exactly the same.

<https://eslint.org/docs/rules/no-self-assign#no-self-assign>

👍 Examples of correct code

```typescript
foo = bar;
[a, b] = [b, a];

// This pattern is warned by the `no-use-before-define` rule.
let foo = foo;

// The default values have an effect.
[foo = 1] = [foo];

// non-self-assignments with properties.
obj.a = obj.b;
obj.a.b = obj.c.b;
obj.a.b = obj.a.c;
obj[a] = obj["a"];
```

👎 Examples of incorrect code

```typescript
foo = foo;

[a, b] = [a, b];

[a, ...b] = [x, ...b];

({a, b} = {a, x});

foo &&= foo;
foo ||= foo;
foo ??= foo;
```

## Force Return Type

----------

Force fill return type in typescript

<https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/explicit-function-return-type.md>

👍 Examples of correct code

```typescript
function test(): void {
  return;
}

// A return value of type number
var fn = function (): number {
  return 1;
};

// A return value of type string
var arrowFn = (): string => 'test';

class Test {
  // No return value should be expected (void)
  method(): void {
    return;
  }
}
```

👎 Examples of incorrect code

```typescript
function test() {
  return;
}

// Should indicate that a number is returned
var fn = function () {
  return 1;
};

// Should indicate that a string is returned
var arrowFn = () => 'test';

class Test {
  // Should indicate that no value is returned (void)
  method() {
    return;
  }
}
```

## Array Bracket Line

----------

Requires consistent usage of linebreaks for each pair of brackets. It reports an error if one bracket in the pair has a
linebreak inside it and the other bracket does not.

<https://eslint.org/docs/rules/array-bracket-newline#consistent>

👍 Examples of correct code

```typescript
var a = [];
var c = [ 1 ];
var d = [
    1
];
var f = [
    function foo() {
        dosomething();
    }
];
```

👎 Examples of incorrect code

```typescript
var a = [1
];
var b = [
    1];
var c = [function foo() {
    dosomething();
}
]
var d = [
    function foo() {
        dosomething();
    }]
```

## Unused Vars

----------

Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring.
Such variables take up space in the code and can lead to confusion by readers.

<https://eslint.org/docs/rules/no-unused-vars#no-unused-vars>

👍 Examples of correct code

```typescript
var x = 10;
alert(x);

// foo is considered used here
myFunc(function foo() {
    // ...
}.bind(this));

(function(foo) {
    return foo;
})();

var myFunc;
myFunc = setTimeout(function() {
    // myFunc is considered used
    myFunc();
}, 50);

// Only the second argument from the destructured array is used.
function getY([, y]) {
    return y;
}
```

👎 Examples of incorrect code

```typescript
// It checks variables you have defined as global
some_unused_var = 42;

var x;

// Write-only variables are not considered as used.
var y = 10;
y = 5;

// A read for a modification of itself is not considered as used.
var z = 0;
z = z + 1;

// By default, unused arguments cause warnings.
(function(foo) {
    return 5;
})();

// Unused recursive functions also cause warnings.
function fact(n) {
    if (n < 2) return 1;
    return n * fact(n - 1);
}

// When a function definition destructures an array, unused entries from the array also cause warnings.
function getY([x, y]) {
    return y;
}
```

## Comma Spacing

----------

Putting default parameter at last allows function calls to omit optional tail arguments.

<https://eslint.org/docs/rules/comma-spacing#options>
<https://eslint.style/rules/ts/comma-spacing>

👍 Examples of correct code

```typescript
var foo = 1, bar = 2
    , baz = 3;
var arr = [1, 2];
var arr = [1,, 3]
var obj = {"foo": "bar", "baz": "qur"};
foo(a, b);
new Foo(a, b);
function foo(a, b){}
a, b
```

👎 Examples of incorrect code

```typescript
var foo = 1 ,bar = 2;
var arr = [1 , 2];
var obj = {"foo": "bar" ,"baz": "qur"};
foo(a ,b);
new Foo(a ,b);
function foo(a ,b){}
a ,b
```

## Comma Dangle

----------

This rule enforces consistent use of trailing commas in object and array literals.

<https://eslint.org/docs/rules/comma-dangle#comma-dangle>
<https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/comma-dangle.md>
<https://eslint.style/rules/ts/comma-dangle>

👍 Examples of correct code

```typescript
var foo = {
    bar: "baz",
    qux: "quux",
    bar: "baz",
};
function baz(
    a,
    b,
    c,
) {
    // code ...
}
```

👎 Examples of incorrect code

```typescript
var foo = {
    bar: "baz",
    qux: "quux",
    bar: "baz"
};
function baz(
    a,
    b,
    c
) {
    // code ...
}
```

## Arrow Spacing

----------

This rule normalize style of spacing before/after an arrow function’s arrow(=>).

<https://eslint.org/docs/latest/rules/arrow-spacing>

👍 Examples of correct code

```typescript
() => {};
(a) => {};
() => {'\n'};
```

👎 Examples of incorrect code

```typescript
()=> {};
() =>{};
(a)=> {};
(a) =>{};
a =>a;
a=> a;
()=> {'\n'};
() =>{'\n'};
```

## Prefer Arrow Function

----------

Requires using arrow functions for callbacks.

<https://eslint.org/docs/rules/prefer-arrow-callback#prefer-arrow-callback>

👍 Examples of correct code

```typescript
foo(a => a);
foo(() => this.a);
foo(function*() { yield; });

```

👎 Examples of incorrect code

```typescript
foo(function(a) { return a; });
foo(function() { return this.a; }.bind(this));
```

## Prefer Destructuring

----------

Require destructuring from arrays and/or objects

<https://eslint.org/docs/latest/rules/prefer-destructuring>
<https://sonarsource.github.io/rspec/#/rspec/S3514/javascript>

👍 Examples of correct code

```typescript
var [ foo ] = array;
var foo = array[someIndex];

var { foo } = object;

var foo = object.bar;

let foo;
({ foo } = object);

```

👎 Examples of incorrect code

```typescript
// With `array` enabled
var foo = array[0];

// With `object` enabled
var foo = object.foo;
var foo = object['foo'];
```

## Arrow Function Body

----------

Enforces no braces where they can be omitted

<https://eslint.org/docs/rules/arrow-body-style#arrow-body-style>

👍 Examples of correct code

```typescript
() => {};
(a) => {};
(a) => a;
(a) => {'\n'}
a.then((foo) => {});
a.then((foo) => { if (true) {} });
```

👎 Examples of incorrect code

```typescript
a => {};
a => a;
a => {'\n'};
a.then(foo => {});
a.then(foo => a);
a(foo => { if (true) {} });
```

## Arrow Function Parentheses

----------

Enforces parentheses around arguments in all cases.

<https://eslint.org/docs/rules/arrow-parens>

👍 Examples of correct code

```typescript
let foo = () => 0;
let foo = (retv, name) => {
    retv[name] = true;
    return retv;
};
let foo = () => ({
    bar: {
        foo: 1,
        bar: 2,
    }
});
let foo = () => { bar(); };
let foo = () => {};
let foo = () => { /* do nothing */ };
let foo = () => {
    // do nothing.
};
let foo = () => ({ bar: 0 });
```

👎 Examples of incorrect code

```typescript
let foo = () => {
    return 0;
};
let foo = () => {
    return {
       bar: {
            foo: 1,
            bar: 2,
        }
    };
};
```

## Arrow Function No Break Line

----------

Enforces parentheses around arguments in all cases.

<https://eslint.org/docs/rules/arrow-parens>

👍 Examples of correct code

```typescript
(foo) => bar;

(foo) => (bar);

(foo) => bar => baz;

(foo) => (
  bar()
);

// functions with block bodies allowed with this rule using any style
// to enforce a consistent location for this case, see the rule: `brace-style`
(foo) => {
  return bar();
}

(foo) =>
{
  return bar();
}
```

👎 Examples of incorrect code

```typescript
(foo) =>
  bar;

(foo) =>
  (bar);

(foo) =>
  bar =>
    baz;

(foo) =>
(
  bar()
);
```

## No Empty Block

----------

Disallows empty block statements.

<https://eslint.org/docs/rules/no-empty#no-empty>

👍 Examples of correct code

```typescript
if (!foo) {
    // code
}

while (foo) {
    // code
}

try {
    doSomething();
} catch (ex) {
    // continue regardless of error
}

try {
    doSomething();
} finally {
    /* continue regardless of error */
}
```

👎 Examples of incorrect code

```typescript
if (foo) {
} else {
  // code
}

while (foo) {
}

switch(foo) {
}

try {
    doSomething();
} catch(ex) {

} finally {

}
```

## No Long Syntax

----------

Disallow Array constructors

<https://eslint.org/docs/latest/rules/no-array-constructor>

👍 Examples of correct code

```typescript
const arr: Array<number> = [ 1, 2, 3 ];
const arr: Array<Foo> = [ x, y, z ];

Array(500);
new Array(someOtherArray.length);
```

👎 Examples of incorrect code

```typescript
const arr = Array(0, 1, 2);
const arr = new Array(0, 1, 2);
```

## Useless Parens

----------

Disallows unnecessary parentheses.

<https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-extra-parens.md>
<https://eslint.org/docs/rules/no-extra-parens#no-extra-parens>
<https://eslint.style/rules/ts/no-extra-parens>

👍 Examples of correct code

```typescript
a = (b * c);

(a * b) + c;

for (a in (b, c));

for (a in (b));

for (a of (b));

typeof (a);

(function(){} ? a() : b());

class A {
    [(x)] = 1;
}

class B {
    x = (y + z);
}
```

👎 Examples of incorrect code

```typescript
a = (b * c);

(a * b) + c;

for (a in (b, c));

for (a in (b));

for (a of (b));

typeof (a);

(function(){} ? a() : b());

class A {
    [(x)] = 1;
}

class B {
    x = (y + z);
}
```

## Useless Boolean

----------

Disallow useless code

<https://eslint.org/docs/rules/no-useless-constructor#options>

👍 Examples of correct code

```typescript
var foo = !!bar;
var foo = Boolean(bar);

function foo() {
    return !!bar;
}

var foo = bar ? !!baz : !!bat;
```

👎 Examples of incorrect code

```typescript
var foo = !!!bar;

var foo = !!bar ? baz : bat;

var foo = Boolean(!!bar);

var foo = new Boolean(!!bar);

if (!!foo) {
    // ...
}

if (Boolean(foo)) {
    // ...
}

while (!!foo) {
    // ...
}

do {
    // ...
} while (Boolean(foo));

for ( ;!!foo; ) {
    // ...
}
```

## Useless Alias

----------

Disallows renaming import, export, and destructured assignments to the same name.

<https://eslint.org/docs/rules/no-useless-rename>

👍 Examples of correct code

```typescript
import * as foo from "foo";
import { foo } from "bar";
import { foo as bar } from "baz";
import { "foo" as bar } from "baz";

export { foo };
export { foo as bar };
export { foo as bar } from "foo";

let { foo } = bar;
let { foo: bar } = baz;
let { [foo]: foo } = bar;

function foo({ bar }) {}
function foo({ bar: baz }) {}

({ foo }) => {}
({ foo: bar }) => {}
```

👎 Examples of incorrect code

```typescript
import { foo as foo } from "bar";
import { "foo" as foo } from "bar";
export { foo as foo };
export { foo as "foo" };
export { foo as foo } from "bar";
export { "foo" as "foo" } from "bar";
let { foo: foo } = bar;
let { 'foo': foo } = bar;
function foo({ bar: bar }) {}
({ foo: foo }) => {}
```

## Return New line

----------

Force new line before return

<https://eslint.org/docs/rules/newline-before-return#newline-before-return>

👍 Examples of correct code

```typescript
function foo(bar) {
  var baz = 'baz';

  if (bar()) {
    return true;
  }

  if (!bar) {
    bar = baz;

    return baz;
  }

  return bar;
}
```

👎 Examples of incorrect code

```typescript
function foo(bar) {
  var baz = 'baz';
  if (bar()) {
    return true;
  }
  if (!bar) {
    bar = baz;
    return bar;
  }
  return bar;
}
```

## Comment Multi Line Prefer

----------

Prefer Multi-line comment formated

<https://eslint.org/docs/rules/newline-before-return#newline-before-return>

👍 Examples of correct code

```typescript
/*
 * this line
 * calls foo()
 */
foo();

// single-line comment
```

👎 Examples of incorrect code

```typescript

// this line
// calls foo()
foo();

/* this line
calls foo() */
foo();

/* this comment
 * is missing a newline after /*
 */

/*
 * this comment
 * is missing a newline at the end */

/*
* the star in this line should have a space before it
 */

/*
 * the star on the following line should have a space before it
*/
```

## No throw Literal

----------

Create custom class to Throw

<https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-throw-literal.md>
<https://eslint.org/docs/rules/prefer-promise-reject-errors#prefer-promise-reject-errors>

👍 Examples of correct code

```typescript
class CustomError extends Error {
  // ...
};

const e = new CustomError("error");
throw e;

throw new CustomError("error");

function err() {
  return new CustomError();
}
throw err();

const foo = {
  bar: new CustomError();
}
throw foo.bar;

// promises

Promise.reject(new CustomError("something bad happened"));

Promise.reject(new TypeError("something bad happened"));

new Promise(function(resolve, reject) {
  reject(new CustomError("something bad happened"));
});

var foo = getUnknownValue();
Promise.reject(foo);

```

👎 Examples of incorrect code

```typescript
throw new Error();

throw 'error';

throw 0;

throw undefined;

throw null;

const err = new Error();
throw 'an ' + err;

const err = new Error();
throw `${err}`;

const err = '';
throw err;

function err() {
  return '';
}
throw err();

const foo = {
  bar: '',
};
throw foo.bar;

// Promise

Promise.reject("something bad happened");

Promise.reject(5);

Promise.reject();

new Promise(function(resolve, reject) {
  reject("something bad happened");
});

new Promise(function(resolve, reject) {
  reject();
});
```

## No Unreachable

----------

No Unreachable code

<https://eslint.org/docs/rules/no-unreachable>
<https://sonarsource.github.io/rspec/#/rspec/S6079/javascript>
<https://eslint.org/docs/latest/rules/no-useless-assignment>

👍 Examples of correct code

```typescript
function foo() {
    function bar() {
        return 1;
    }

    return bar();

}

function bar() {
    var x;
    return x;
}

switch (foo) {
    case 1:
        break;
}

function fn1() {
    let v = 'used';
    doSomething(v);
    v = 'used-2';
    doSomething(v);
}

function fn2() {
    let v = 'used';
    if (condition) {
        v = 'used-2';
        doSomething(v);
        return
    }
    doSomething(v);
}

function fn3() {
    let v = 'used';
    if (condition) {
        doSomething(v);
    } else {
        v = 'used-2';
        doSomething(v);
    }
}

function fn4() {
    let v = 'used';
    for (let i = 0; i < 10; i++) {
        doSomething(v);
        v = 'used in next iteration';
    }
}
```

👎 Examples of incorrect code

```typescript
function foo() {
    return true;
    console.log("done");
}

function bar() {
    throw new Error("Oops!");
    console.log("done");
}

while(value) {
    break;
    console.log("done");
}

throw new Error("Oops!");
console.log("done");

function baz() {
    if (Math.random() < 0.5) {
        return;
    } else {
        throw new Error();
    }
    console.log("done");
}

for (;;) {}
console.log("done");

function fn1() {
    let v = 'used';
    doSomething(v);
    v = 'unused';
}

function fn2() {
    let v = 'used';
    if (condition) {
        v = 'unused';
        return
    }
    doSomething(v);
}

function fn3() {
    let v = 'used';
    if (condition) {
        doSomething(v);
    } else {
        v = 'unused';
    }
}

function fn4() {
    let v = 'unused';
    if (condition) {
        v = 'used';
        doSomething(v);
        return
    }
}

function fn5() {
    let v = 'used';
    if (condition) {
        let v = 'used';
        console.log(v);
        v = 'unused';
    }
    console.log(v);
}
```

## No Multiline String

----------

Prevent break line in string

<https://eslint.org/docs/rules/no-multi-str#no-multi-str>

👍 Examples of correct code

```typescript
var x = "some very\nlong text";

var x = "some very " +
        "long text";
```

👎 Examples of incorrect code

```typescript
var x = "some very \
long text";
```

## No Unsafe Assign

----------

Disallows assigning any to variables and properties.

<https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-unsafe-assignment.md>

👍 Examples of correct code

```typescript
const x = 1,
  y = 1;
const [x] = [1];
[x] = [1] as [number];

function foo(a = 1) {}
class Foo {
  constructor(private a = 1) {}
}
class Foo {
  private a = 1;
}

// generic position examples
const x: Set<string> = new Set<string>();
const x: Map<string, string> = new Map<string, string>();
const x: Set<string[]> = new Set<string[]>();
const x: Set<Set<Set<string>>> = new Set<Set<Set<string>>>();
```

👎 Examples of incorrect code

```typescript
const x = 1 as any,
  y = 1 as any;
const [x] = 1 as any;
const [x] = [] as any[];
const [x] = [1 as any];
[x] = [1] as [any];

function foo(a = 1 as any) {}
class Foo {
  constructor(private a = 1 as any) {}
}
class Foo {
  private a = 1 as any;
}

// generic position examples
const x: Set<string> = new Set<any>();
const x: Map<string, string> = new Map<string, any>();
const x: Set<string[]> = new Set<any[]>();
const x: Set<Set<Set<string>>> = new Set<Set<Set<any>>>();
```

## Disallow Script Url

----------

Using javascript: URLs is considered by some as a form of eval.

<https://eslint.org/docs/rules/no-script-url>

👍 Examples of correct code

```typescript
location.href = "#";
```

👎 Examples of incorrect code

```typescript
location.href = "javascript:void(0)";

location.href = `javascript:void(0)`;
```

## Disallow Undefined

----------

Disallows the use of undeclared variables unless mentioned in /\*global\*/ comments.

<https://eslint.org/docs/rules/no-undef>

👍 Examples of correct code

```typescript
/* global someFunction, a */

var foo = someFunction();
var bar = a + 1;
```

👎 Examples of incorrect code

```typescript
var foo = someFunction();
var bar = a + 1;
```

## Function Name

----------

Requires function expressions to have a name, if the name isn't assigned automatically per the ECMAScript specification.

<https://eslint.org/docs/rules/func-names>
<https://sonarsource.github.io/rspec/#/rspec/S100/javascript>

👍 Examples of correct code

```typescript
/* global someFunction, a */

var foo = someFunction();
var bar = a + 1;
```

👎 Examples of incorrect code

```typescript
Foo.prototype.bar = function() {};

(function() {
    // ...
}())

export default function() {}
```

## Function Name Match

----------

This rule requires function names to match the name of the variable or property to which they are assigned.
The rule will ignore property assignments where the property name is a literal that
is not a valid identifier in the ECMAScript version specified in your configuration (default ES5).

<https://eslint.org/docs/latest/rules/func-name-matching>

👍 Examples of correct code

```typescript
var foo = function foo() {};
var foo = function() {};
var foo = () => {};
foo = function foo() {};

obj.foo = function foo() {};
obj['foo'] = function foo() {};
obj['foo//bar'] = function foo() {};
obj[foo] = function bar() {};

var obj = {foo: function foo() {}};
var obj = {[foo]: function bar() {}};
var obj = {'foo//bar': function foo() {}};
var obj = {foo: function() {}};

obj['x' + 2] = function bar(){};
var [ bar ] = [ function bar(){} ];
({[foo]: function bar() {}})

class C {
    foo = function foo() {};
    baz = function() {};
}

// private names are ignored
class D {
    #foo = function foo() {};
    #bar = function foo() {};
    baz() {
        this.#foo = function foo() {};
        this.#foo = function bar() {};
    }
}

module.exports = function foo(name) {};
module['exports'] = function foo(name) {};
```

👎 Examples of incorrect code

```typescript
var foo = function bar() {};
foo = function bar() {};
obj.foo = function bar() {};
obj['foo'] = function bar() {};
var obj = {foo: function bar() {}};
({['foo']: function bar() {}});

class C {
    foo = function bar() {};
}
```

## No Use Future Reserved Words

----------

"future reserved words" should not be used as identifiers
Special identifiers should not be bound or assigned

<https://sonarsource.github.io/rspec/#/rspec/S2137/javascript>

👍 Examples of correct code

```typescript
var elements = document.getElementsByName("foo"); // Compliant
var someData = { package: true };

result = 17;
++result;
var obj = { set p(arg) { } };
var result;
try { } catch (args) { }
function x(arg) { }
function args() { }
var y = function fun() { };
var f = new Function("args", "return 17;");
```

👎 Examples of incorrect code

```typescript
var package = document.getElementsByName("foo"); // Noncompliant
eval = 17; // Noncompliant
arguments++; // Noncompliant
++eval; // Noncompliant
var obj = { set p(arguments) { } }; // Noncompliant
var eval; // Noncompliant
try { } catch (arguments) { } // Noncompliant
function x(eval) { } // Noncompliant
function arguments() { } // Noncompliant
var y = function eval() { }; // Noncompliant
var f = new Function("arguments", "return 17;"); // Noncompliant
```

## No Generator Without Yield

----------

Generators should "yield" something

<https://sonarsource.github.io/rspec/#/rspec/S3531/javascript>

👍 Examples of correct code

```typescript
function* myGen(a, b) {
  let answer = 0;
  while (answer < 42) {
    answer += a * b;
    yield answer;
  }
}
```

👎 Examples of incorrect code

```typescript
function* myGen(a, b) {  // Noncompliant
  let answer = 0;
  answer += a * b;
}
```

## Inverted Assertion Arguments

----------

Assertion arguments should be passed in the correct order

<https://sonarsource.github.io/rspec/#/rspec/S3415/javascript>

👍 Examples of correct code

```typescript
const assert = require('chai').assert;
const expect = require('chai').expect;
const should = require('chai').should();

it("inverts arguments", function() {
    assert.equal(aNumber, 42);
    expect(aNumber).to.equal(42);
    should.fail(aNumber, 42);
});
```

👎 Examples of incorrect code

```typescript
const assert = require('chai').assert;
const expect = require('chai').expect;
const should = require('chai').should();

it("inverts arguments", function() {
    assert.equal(42, aNumber); // Noncompliant
    expect(42).to.equal(aNumber); // Noncompliant
    should.fail(42, aNumber);  // Noncompliant
});
```

## Max Union Size

----------

Union types should not have too many elements

<https://sonarsource.github.io/rspec/#/rspec/S4622/javascript>

👍 Examples of correct code

```typescript
type MyUnionType = MyType1 | MyType2 | MyType3 | MyType4; // Compliant, "type" statements are ignored
let x: MyUnionType;

function foo(value: string, padding: MyUnionType) {
    // ...
}
```

👎 Examples of incorrect code

```typescript
let x: MyType1 | MyType2 | MyType3 | MyType4; // Noncompliant

function foo(p1: string, p2: MyType1 | MyType2 | MyType3 | MyType4) { // Noncompliant
    // ...
}
```

## No Redundant Optional

----------

Optional property declarations should not use both '?' and 'undefined' syntax

<https://sonarsource.github.io/rspec/#/rspec/S4782/javascript>

👍 Examples of correct code

```typescript
interface Person {
  name: string;
  address: string | undefined;
  pet?: Animal;
}
```

👎 Examples of incorrect code

```typescript
interface Person {
  name: string;
  address? : string | undefined;   // Noncompliant, "?" should be removed
  pet?: Animal | undefined; // Noncompliant, "undefined" should be removed
}
```

## Prefer Type Guard

----------

Type guards should be used

<https://sonarsource.github.io/rspec/#/rspec/S4322/javascript>

👍 Examples of correct code

```typescript
function isSomething(x: BaseType) : x is Something {
  return (<Something>x).foo !== undefined;
}

if (isSomething(v)) {
  v.foo();
}
```

👎 Examples of incorrect code

```typescript
function isSomething(x: BaseType) : boolean { // Noncompliant
  return (<Something>x).foo !== undefined;
}

if (isSomething(v)) {
  (<Something>v).foo();
}
```

## No Production Debug

----------

Delivering code in production with debug features activated is security-sensitive

<https://sonarsource.github.io/rspec/#/rspec/S4507/javascript>

👍 Examples of correct code

```typescript
const express = require('express');
const errorhandler = require('errorhandler');

let app = express();

if (process.env.NODE_ENV === 'development') {  // Compliant
  app.use(errorhandler());  // Compliant
}
```

👎 Examples of incorrect code

```typescript
const express = require('express');
const errorhandler = require('errorhandler');

let app = express();
app.use(errorhandler()); // Sensitive
```

## Unused Named Groups

----------

Why use named groups only to never use any of them later on in the code?

This rule raises issues every time named groups are:
defined but never called anywhere in the code through their name;
defined but called elsewhere in the code by their number instead;
referenced while not defined.

<https://sonarsource.github.io/rspec/#/rspec/S5860/javascript>

👍 Examples of correct code

```typescript
const date = "01/02";

const datePattern = /(?<month>[0-9]{2})\/(?<year>[0-9]{2})/;
const dateMatched = date.match(datePattern);

if (dateMatched !== null) {
  checkValidity(dateMatched.groups.month, dateMatched.groups.year);
}

// ...

const score = "14:1";

const scorePattern = /(?<player1>[0-9]+):(?<player2>[0-9]+)/;
const scoreMatched = score.match(scorePattern);

if (scoreMatched !== null) {
  checkScore(scoreMatched.groups.player1);
  checkScore(scoreMatched.groups.player2);
}
```

👎 Examples of incorrect code

```typescript
const date = "01/02";

const datePattern = /(?<month>[0-9]{2})\/(?<year>[0-9]{2})/;
const dateMatched = date.match(datePattern);

if (dateMatched !== null) {
  checkValidity(dateMatched[1], dateMatched[2]); // Noncompliant - numbers instead of names of groups are used
  checkValidity(dateMatched.groups.day); // Noncompliant - there is no group called "day"
}

// ...

const score = "14:1";

const scorePattern = /(?<player1>[0-9]+):(?<player2>[0-9]+)/; // Noncompliant - named groups are never used
const scoreMatched = score.match(scorePattern);

if (scoreMatched !== null) {
  checkScore(score);
}
```

## Get And Set