JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
Third-Party External

JavaScript Warning Classes Corresponding to ESLint Rules

This page describes the CodeSonar warning classes that are assigned to JavaScript warnings imported from a SARIF file produced by ESLint.

For TypeScript warnings, see TypeScript Warning Classes Corresponding to typescript-eslint Rules.

See also the table of CodeSonar warning classes that are supported for all languages. If these classes are enabled, the corresponding CodeSonar checks will include all JavaScript source files that were imported into the project with codesonar es_scan.py, codesonar import_sarif.py, or codesonar add_source_files.py.



Introduction

This page describes the CodeSonar warning classes that are assigned to JavaScript warnings imported from a SARIF file produced by ESLint.

For information on setting up your CodeSonar project to incorporate JavaScript source code and the corresponding ESLint results, see Including JavaScript and TypeScript Components in a CodeSonar Project.

JavaScript Warning Classes from Built-in ESLint Rules

When CodeSonar imports a SARIF file, it determines a corresponding CodeSonar warning class for each rule object in the SARIF rules. If a given warning class does not already exist, the SARIF importer creates it.

There is special handling for SARIF files produced by ESLint.

CodeSonar Warning Property Value
Name Generated from the id property of the rule object.

The general form of the id is [plugin_name/]rule_identifier. Built-in ESLint rules do not have the plugin_name/ component. The CodeSonar warning class name is generated from this id as follows.

  • The lower-case, hyphenated rule_identifier component is transformed to space-separated title case.
    This includes capitalizing most words, except for minor words such as "or" and "and".
  • A parenthesized ESLint suffix is appended to the resulting string:
    • " (ESLint)" if the id had no plugin_name/ component, indicating a built-in ESLint rule.
    • " (ESLint-TS)" if the plugin_name is @typescript-eslint, indicating a typescript-eslint rule.
    • " (ESLint:plugin_name)" otherwise.
    This suffix greatly reduces the chance of collision with warning class names from other sources, which is important because warning class Name is a unique identifier. It also provides a ready mechanism for visually and programmatically identifying CodeSonar warnings that originate from ESLint results.
Categories When a warning class is based on an ESLint rule, its categories depend on whether the warning class is built in to CodeSonar or created by the SARIF importer.
  • In both cases, the class has a category of the form ESLint:<id>
    <id> is the ESLint rule ID, which matches the id property of the SARIF rule object.
  • For built-in classes only, there is also a warning class mnemonic: JS.<ruletype>.<ruleabbrev>
    <ruletype> is based on the rule type as described in the ESLint Rules Reference, and <abbr> is an abbreviation of the class Name.
otherwise Other warning class properties are not set by the SARIF importer.

Example

Suppose the imported SARIF file includes rule objects like the following.

# ...
    "rules":[
        # ...
        {
          "id": "@typescript-eslint/no-unused-vars",
          # ...
        },
        {
          "id": "no-empty",
          # ...
        },
      # ...
    ],
# ...

CodeSonar identifies the first of these rules ("id": "@typescript-eslint/no-unused-vars") as originating from a typescript-eslint rule, and handles it as described for TypeScript Warning Classes Corresponding to typescript-eslint Rules.

The id for the second rule ("id": "no-empty") does not start with a [plugin_name/] component, so CodeSonar identifies it as originating from a built-in ESLint rule.
(It corresponds to the ESLint no-empty rule.)

  1. CodeSonar computes the corresponding warning class name: "No Empty (ESLint)".
  2. If there is not already a warning class with this name, CodeSonar creates the warning class. The class categories will be
  3. CodeSonar creates a "No Empty (ESLint)" warning instance for each result entry in the SARIF that has "ruleId": "no-empty".

SARIF files produced by ESLint

CodeSonar will consider a SARIF file to be produced by ESLint in the following cases.

In these cases, the SARIF importer determines a corresponding CodeSonar warning class for each rule object in the SARIF rules. The properties for this warning class are shown in the following table.

Built-in JavaScript Warning Classes

These warning classes correspond to built-in rules from ESLint version v8.56.0.

Class Name Mnemonic
Accessor Pairs (ESLint) JS.SUGGESTION.AP
Array Bracket Newline (ESLint) JS.LAYOUT.ABN
Array Bracket Spacing (ESLint) JS.LAYOUT.ABS
Array Callback Return (ESLint) JS.PROBLEM.ACR
Array Element Newline (ESLint) JS.LAYOUT.AEN
Arrow Body Style (ESLint) JS.SUGGESTION.ABS
Arrow Parens (ESLint) JS.LAYOUT.AP
Arrow Spacing (ESLint) JS.LAYOUT.AS
Block Scoped Var (ESLint) JS.SUGGESTION.BSV
Block Spacing (ESLint) JS.LAYOUT.BLKSP
Brace Style (ESLint) JS.LAYOUT.BRSTYLE
Callback Return (ESLint) JS.SUGGESTION.CALLRET
Camelcase (ESLint) JS.SUGGESTION.CAMCASE
Capitalized Comments (ESLint) JS.SUGGESTION.CC
Class Methods Use This (ESLint) JS.SUGGESTION.CMUT
Comma Dangle (ESLint) JS.LAYOUT.CD
Comma Spacing (ESLint) JS.LAYOUT.COMSP
Comma Style (ESLint) JS.LAYOUT.COMSTYLE
Complexity (ESLint) JS.SUGGESTION.CMPLX
Computed Property Spacing (ESLint) JS.LAYOUT.CPS
Consistent Return (ESLint) JS.SUGGESTION.CONRET
Consistent This (ESLint) JS.SUGGESTION.CT
Constructor Super (ESLint) JS.PROBLEM.CS
Curly (ESLint) JS.SUGGESTION.CURLY
Default Case (ESLint) JS.SUGGESTION.DC
Default Case Last (ESLint) JS.SUGGESTION.DCL
Default Param Last (ESLint) JS.SUGGESTION.DPL
Dot Location (ESLint) JS.LAYOUT.DL
Dot Notation (ESLint) JS.SUGGESTION.DN
Eol Last (ESLint) JS.LAYOUT.EL
Equal-Equal-Equal (ESLint) JS.SUGGESTION.EQEQEQ
For Direction (ESLint) JS.PROBLEM.FD
Func Call Spacing (ESLint) JS.LAYOUT.FCS
Func Name Matching (ESLint) JS.SUGGESTION.FNM
Func Names (ESLint) JS.SUGGESTION.FN
Func Style (ESLint) JS.SUGGESTION.FS
Function Call Argument Newline (ESLint) JS.LAYOUT.FCAN
Function Paren Newline (ESLint) JS.LAYOUT.FPN
Generator Star Spacing (ESLint) JS.LAYOUT.GSS
Getter Return (ESLint) JS.PROBLEM.GR
Global Require (ESLint) JS.SUGGESTION.GR
Grouped Accessor Pairs (ESLint) JS.SUGGESTION.GAP
Guard for in (ESLint) JS.SUGGESTION.GFI
Handle Callback Err (ESLint) JS.SUGGESTION.HCE
Id Blacklist (ESLint) JS.SUGGESTION.IB
Id Denylist (ESLint) JS.SUGGESTION.IDDENY
Id Length (ESLint) JS.SUGGESTION.IL
Id Match (ESLint) JS.SUGGESTION.IM
Implicit Arrow Linebreak (ESLint) JS.LAYOUT.IAL
Indent (ESLint) JS.LAYOUT.INDENT
Indent Legacy (ESLint) JS.LAYOUT.IL
Init Declarations (ESLint) JS.SUGGESTION.INITDCL
Jsx Quotes (ESLint) JS.LAYOUT.JQ
Key Spacing (ESLint) JS.LAYOUT.KEYSP
Keyword Spacing (ESLint) JS.LAYOUT.KWDSP
Line Comment Position (ESLint) JS.LAYOUT.LCP
Linebreak Style (ESLint) JS.LAYOUT.LS
Lines Around Comment (ESLint) JS.LAYOUT.LAC
Lines Around Directive (ESLint) JS.LAYOUT.LAD
Lines Between Class Members (ESLint) JS.LAYOUT.LBCM
Logical Assignment Operators (ESLint) JS.SUGGESTION.LAO
Max Classes Per File (ESLint) JS.SUGGESTION.MCPF
Max Depth (ESLint) JS.SUGGESTION.MD
Max Len (ESLint) JS.LAYOUT.ML
Max Lines (ESLint) JS.SUGGESTION.ML
Max Lines Per Function (ESLint) JS.SUGGESTION.MLPF
Max Nested Callbacks (ESLint) JS.SUGGESTION.MNC
Max Params (ESLint) JS.SUGGESTION.MP
Max Statements (ESLint) JS.SUGGESTION.MS
Max Statements Per Line (ESLint) JS.LAYOUT.MSPL
Multiline Comment Style (ESLint) JS.SUGGESTION.MCS
Multiline Ternary (ESLint) JS.LAYOUT.MT
New Cap (ESLint) JS.SUGGESTION.NEWCAP
New Parens (ESLint) JS.LAYOUT.NP
Newline After Var (ESLint) JS.LAYOUT.NAV
Newline Before Return (ESLint) JS.LAYOUT.NBR
Newline Per Chained Call (ESLint) JS.LAYOUT.NPCC
No Alert (ESLint) JS.SUGGESTION.NA
No Array Constructor (ESLint) JS.SUGGESTION.NAC
No Async Promise Executor (ESLint) JS.PROBLEM.NAPE
No Await in Loop (ESLint) JS.PROBLEM.NAIL
No Bitwise (ESLint) JS.SUGGESTION.NB
No Buffer Constructor (ESLint) JS.PROBLEM.NBC
No Caller (ESLint) JS.SUGGESTION.NCALLER
No Case Declarations (ESLint) JS.SUGGESTION.NCD
No Catch Shadow (ESLint) JS.SUGGESTION.NCS
No Class Assign (ESLint) JS.PROBLEM.NCLSA
No Compare Neg Zero (ESLint) JS.PROBLEM.NCNZ
No Cond Assign (ESLint) JS.PROBLEM.NCONDA
No Confusing Arrow (ESLint) JS.SUGGESTION.NCA
No Console (ESLint) JS.SUGGESTION.NCNSL
No Const Assign (ESLint) JS.PROBLEM.NCONSTA
No Constant Binary Expression (ESLint) JS.PROBLEM.NCBE
No Constant Condition (ESLint) JS.PROBLEM.NCC
No Constructor Return (ESLint) JS.PROBLEM.NCONSR
No Continue (ESLint) JS.SUGGESTION.NCONT
No Control Regex (ESLint) JS.PROBLEM.NCTLR
No Debugger (ESLint) JS.PROBLEM.ND
No Delete Var (ESLint) JS.SUGGESTION.NDV
No Div Regex (ESLint) JS.SUGGESTION.NDR
No Dupe Args (ESLint) JS.PROBLEM.NDA
No Dupe Class Members (ESLint) JS.PROBLEM.NDCM
No Dupe Else If (ESLint) JS.PROBLEM.NDEI
No Dupe Keys (ESLint) JS.PROBLEM.NDK
No Duplicate Case (ESLint) JS.PROBLEM.NDC
No Duplicate Imports (ESLint) JS.PROBLEM.NDI
No Else Return (ESLint) JS.SUGGESTION.NER
No Empty (ESLint) JS.SUGGESTION.NEMPTY
No Empty Character Class (ESLint) JS.PROBLEM.NECC
No Empty Function (ESLint) JS.SUGGESTION.NEF
No Empty Pattern (ESLint) JS.PROBLEM.NEP
No Empty Static Block (ESLint) JS.SUGGESTION.NESB
No Eq Null (ESLint) JS.SUGGESTION.NEQN
No Eval (ESLint) JS.SUGGESTION.NEVAL
No Ex Assign (ESLint) JS.PROBLEM.NEA
No Extend Native (ESLint) JS.SUGGESTION.NEXTNAT
No Extra Bind (ESLint) JS.SUGGESTION.NEB
No Extra Boolean Cast (ESLint) JS.SUGGESTION.NEBC
No Extra Label (ESLint) JS.SUGGESTION.NEL
No Extra Parens (ESLint) JS.LAYOUT.NEP
No Extra Semi (ESLint) JS.SUGGESTION.NES
No Fallthrough (ESLint) JS.PROBLEM.NF
No Floating Decimal (ESLint) JS.SUGGESTION.NFD
No Func Assign (ESLint) JS.PROBLEM.NFA
No Global Assign (ESLint) JS.SUGGESTION.NGA
No Implicit Coercion (ESLint) JS.SUGGESTION.NICOER
No Implicit Globals (ESLint) JS.SUGGESTION.NIG
No Implied Eval (ESLint) JS.SUGGESTION.NIE
No Import Assign (ESLint) JS.PROBLEM.NIA
No Inline Comments (ESLint) JS.SUGGESTION.NICOM
No Inner Declarations (ESLint) JS.PROBLEM.NID
No Invalid Regexp (ESLint) JS.PROBLEM.NIR
No Invalid This (ESLint) JS.SUGGESTION.NIT
No Irregular Whitespace (ESLint) JS.PROBLEM.NIW
No Iterator (ESLint) JS.SUGGESTION.NI
No Label Var (ESLint) JS.SUGGESTION.NLV
No Labels (ESLint) JS.SUGGESTION.NL
No Lone Blocks (ESLint) JS.SUGGESTION.NLB
No Lonely If (ESLint) JS.SUGGESTION.NLI
No Loop Func (ESLint) JS.SUGGESTION.NLF
No Loss of Precision (ESLint) JS.PROBLEM.NLOP
No Magic Numbers (ESLint) JS.SUGGESTION.NMN
No Misleading Character Class (ESLint) JS.PROBLEM.NMCC
No Mixed Operators (ESLint) JS.SUGGESTION.NMO
No Mixed Requires (ESLint) JS.SUGGESTION.NMR
No Mixed Spaces and Tabs (ESLint) JS.LAYOUT.NMSAT
No Multi Assign (ESLint) JS.SUGGESTION.NMA
No Multi Spaces (ESLint) JS.LAYOUT.NMS
No Multi Str (ESLint) JS.SUGGESTION.NMS
No Multiple Empty Lines (ESLint) JS.LAYOUT.NMEL
No Native Reassign (ESLint) JS.SUGGESTION.NNATRE
No Negated Condition (ESLint) JS.SUGGESTION.NNC
No Negated in Lhs (ESLint) JS.PROBLEM.NNIL
No Nested Ternary (ESLint) JS.SUGGESTION.NNT
No New (ESLint) JS.SUGGESTION.NN
No New Func (ESLint) JS.SUGGESTION.NNF
No New Native Nonconstructor (ESLint) JS.PROBLEM.NNNN
No New Object (ESLint) JS.SUGGESTION.NNO
No New Require (ESLint) JS.SUGGESTION.NNEWREQ
No New Symbol (ESLint) JS.PROBLEM.NNS
No New Wrappers (ESLint) JS.SUGGESTION.NNW
No Nonoctal Decimal Escape (ESLint) JS.SUGGESTION.NNDE
No Obj Calls (ESLint) JS.PROBLEM.NOC
No Object Constructor (ESLint) JS.SUGGESTION.NOC
No Octal (ESLint) JS.SUGGESTION.NO
No Octal Escape (ESLint) JS.SUGGESTION.NOE
No Param Reassign (ESLint) JS.SUGGESTION.NPR
No Path Concat (ESLint) JS.SUGGESTION.NPC
No Plusplus (ESLint) JS.SUGGESTION.NPP
No Process Env (ESLint) JS.SUGGESTION.NPENV
No Process Exit (ESLint) JS.SUGGESTION.NPEXIT
No Promise Executor Return (ESLint) JS.PROBLEM.NPER
No Proto (ESLint) JS.SUGGESTION.NPROTO
No Prototype Builtins (ESLint) JS.PROBLEM.NPB
No Redeclare (ESLint) JS.SUGGESTION.NR
No Regex Spaces (ESLint) JS.SUGGESTION.NREGEXSP
No Restricted Exports (ESLint) JS.SUGGESTION.NRE
No Restricted Globals (ESLint) JS.SUGGESTION.NRG
No Restricted Imports (ESLint) JS.SUGGESTION.NRI
No Restricted Modules (ESLint) JS.SUGGESTION.NRM
No Restricted Properties (ESLint) JS.SUGGESTION.NRP
No Restricted Syntax (ESLint) JS.SUGGESTION.NRSNTX
No Return Assign (ESLint) JS.SUGGESTION.NRETA
No Return Await (ESLint) JS.SUGGESTION.NRETAW
No Script Url (ESLint) JS.SUGGESTION.NSU
No Self Assign (ESLint) JS.PROBLEM.NSELFA
No Self Compare (ESLint) JS.PROBLEM.NSC
No Sequences (ESLint) JS.SUGGESTION.NSEQS
No Setter Return (ESLint) JS.PROBLEM.NSR
No Shadow (ESLint) JS.SUGGESTION.NSHDW
No Shadow Restricted Names (ESLint) JS.SUGGESTION.NSRN
No Spaced Func (ESLint) JS.LAYOUT.NSF
No Sparse Arrays (ESLint) JS.PROBLEM.NSPRSA
No Sync (ESLint) JS.SUGGESTION.NSYNC
No Tabs (ESLint) JS.LAYOUT.NT
No Template Curly in String (ESLint) JS.PROBLEM.NTCIS
No Ternary (ESLint) JS.SUGGESTION.NT
No This Before Super (ESLint) JS.PROBLEM.NTBS
No Throw Literal (ESLint) JS.SUGGESTION.NTL
No Trailing Spaces (ESLint) JS.LAYOUT.NTS
No Undef (ESLint) JS.PROBLEM.NUNDEF
No Undef Init (ESLint) JS.SUGGESTION.NUI
No Undefined (ESLint) JS.SUGGESTION.NU
No Underscore Dangle (ESLint) JS.SUGGESTION.NUD
No Unexpected Multiline (ESLint) JS.PROBLEM.NUM
No Unmodified Loop Condition (ESLint) JS.PROBLEM.NULC
No Unneeded Ternary (ESLint) JS.SUGGESTION.NUT
No Unreachable (ESLint) JS.PROBLEM.NUREACH
No Unreachable Loop (ESLint) JS.PROBLEM.NUL
No Unsafe Finally (ESLint) JS.PROBLEM.NUF
No Unsafe Negation (ESLint) JS.PROBLEM.NUN
No Unsafe Optional Chaining (ESLint) JS.PROBLEM.NUOC
No Unused Expressions (ESLint) JS.SUGGESTION.NUEXP
No Unused Labels (ESLint) JS.SUGGESTION.NUL
No Unused Private Class Members (ESLint) JS.PROBLEM.NUPCM
No Unused Vars (ESLint) JS.PROBLEM.NUV
No Use Before Define (ESLint) JS.PROBLEM.NUBD
No Useless Backreference (ESLint) JS.PROBLEM.NUB
No Useless Call (ESLint) JS.SUGGESTION.NUCALL
No Useless Catch (ESLint) JS.SUGGESTION.NUCTCH
No Useless Computed Key (ESLint) JS.SUGGESTION.NUCK
No Useless Concat (ESLint) JS.SUGGESTION.NUCAT
No Useless Constructor (ESLint) JS.SUGGESTION.NUCONS
No Useless Escape (ESLint) JS.SUGGESTION.NUESC
No Useless Rename (ESLint) JS.SUGGESTION.NUREN
No Useless Return (ESLint) JS.SUGGESTION.NURET
No Var (ESLint) JS.SUGGESTION.NVAR
No Void (ESLint) JS.SUGGESTION.NVOID
No Warning Comments (ESLint) JS.SUGGESTION.NWC
No Whitespace Before Property (ESLint) JS.LAYOUT.NWBP
No With (ESLint) JS.SUGGESTION.NW
Nonblock Statement Body Position (ESLint) JS.LAYOUT.NSBP
Object Curly Newline (ESLint) JS.LAYOUT.OCN
Object Curly Spacing (ESLint) JS.LAYOUT.OCS
Object Property Newline (ESLint) JS.LAYOUT.OPN
Object Shorthand (ESLint) JS.SUGGESTION.OS
One Var (ESLint) JS.SUGGESTION.OV
One Var Declaration Per Line (ESLint) JS.SUGGESTION.OVDPL
Operator Assignment (ESLint) JS.SUGGESTION.OA
Operator Linebreak (ESLint) JS.LAYOUT.OL
Padded Blocks (ESLint) JS.LAYOUT.PB
Padding Line Between Statements (ESLint) JS.LAYOUT.PLBS
Prefer Arrow Callback (ESLint) JS.SUGGESTION.PAC
Prefer Const (ESLint) JS.SUGGESTION.PC
Prefer Destructuring (ESLint) JS.SUGGESTION.PD
Prefer Exponentiation Operator (ESLint) JS.SUGGESTION.PEO
Prefer Named Capture Group (ESLint) JS.SUGGESTION.PNCG
Prefer Numeric Literals (ESLint) JS.SUGGESTION.PNL
Prefer Object Has Own (ESLint) JS.SUGGESTION.POHO
Prefer Object Spread (ESLint) JS.SUGGESTION.POS
Prefer Promise Reject Errors (ESLint) JS.SUGGESTION.PPRE
Prefer Reflect (ESLint) JS.SUGGESTION.PR
Prefer Regex Literals (ESLint) JS.SUGGESTION.PRL
Prefer Rest Params (ESLint) JS.SUGGESTION.PRP
Prefer Spread (ESLint) JS.SUGGESTION.PS
Prefer Template (ESLint) JS.SUGGESTION.PT
Quote Props (ESLint) JS.SUGGESTION.QP
Quotes (ESLint) JS.LAYOUT.QUOTES
Radix (ESLint) JS.SUGGESTION.RADIX
Require Atomic Updates (ESLint) JS.PROBLEM.RAU
Require Await (ESLint) JS.SUGGESTION.RA
Require Jsdoc (ESLint) JS.SUGGESTION.RJ
Require Unicode Regexp (ESLint) JS.SUGGESTION.RUR
Require Yield (ESLint) JS.SUGGESTION.RY
Rest Spread Spacing (ESLint) JS.LAYOUT.RSS
Semi (ESLint) JS.LAYOUT.SEMI
Semi Spacing (ESLint) JS.LAYOUT.SSP
Semi Style (ESLint) JS.LAYOUT.SSTYLE
Sort Imports (ESLint) JS.SUGGESTION.SI
Sort Keys (ESLint) JS.SUGGESTION.SK
Sort Vars (ESLint) JS.SUGGESTION.SV
Space Before Blocks (ESLint) JS.LAYOUT.SBB
Space Before Function Paren (ESLint) JS.LAYOUT.SBFP
Space Infix Ops (ESLint) JS.LAYOUT.SIO
Space Unary Ops (ESLint) JS.LAYOUT.SUO
Space in Parens (ESLint) JS.LAYOUT.SIP
Spaced Comment (ESLint) JS.SUGGESTION.SC
Strict (ESLint) JS.SUGGESTION.STRICT
Switch Colon Spacing (ESLint) JS.LAYOUT.SCS
Symbol Description (ESLint) JS.SUGGESTION.SD
Template Curly Spacing (ESLint) JS.LAYOUT.TCS
Template Tag Spacing (ESLint) JS.LAYOUT.TTS
Unicode Bom (ESLint) JS.LAYOUT.UB
Use Isnan (ESLint) JS.PROBLEM.UI
Valid Jsdoc (ESLint) JS.SUGGESTION.VJ
Valid Typeof (ESLint) JS.PROBLEM.VT
Vars on Top (ESLint) JS.SUGGESTION.VOT
Wrap Iife (ESLint) JS.LAYOUT.WI
Wrap Regex (ESLint) JS.LAYOUT.WR
Yield Star Spacing (ESLint) JS.LAYOUT.YSS
Yoda (ESLint) JS.SUGGESTION.YODA

Enabling and Disabling

You have multiple degrees of control over reporting for the warnings issued by ESLint.

 

To report problems with this documentation, please visit https://support.codesecure.com/.