Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Orion/ESLint

< Orion
Revision as of 18:01, 15 November 2013 by Mamacdon.gmail.com (Talk | contribs) (Rules)

Orion 5.0 will replace our current JSLint validator with ESLint. This page captures ongoing issues.

Rules

Here's a table showing the equivalent validation rules in JSLint and ESLint. If a rule has no "JSLint option", then JSLint always enforces it and it cannot be disabled.

ESLint rule JSLint option JSLint message Details
block-scoped-var - '{variable}' is already defined. Occurs when a function-scoped variable is treated as if it was block scoped.
ESLint calls this error '{variable} used outside of binding context.'
brace-style - (Not supported)
camelcase - (Not supported)
complexity - (Not supported)
consistent-this - (Not supported)
curly - Statement body should be inside '{ }' braces. (Orion)
Expected '{'. (Regular JSLint)
dot-notation sub {a} is better written in dot notation.
eqeqeq eqeqeq
eqeq
Expected '===' and saw '=='.
Expected '!==' and saw '!='.
Newer versions of JSLint call this option eqeqeq. Orion's version calls it eqeq, and inverts the flag's value.
guard-for-in forin The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.
max-depth - (Not supported) Enforces max depth of nested blocks within a function.
max-len maxlen Line too long. Enforces a maximum line length.
max-params
max-statements
new-cap newcap A constructor name should start with an uppercase letter.
new-parens - Missing '()' invoking a constructor. Flags new Whatever
no-alert
no-bitwise bitwise Unexpected use of '{operator}'. JSLint disallows bitwise ops by default.
no-caller - (Not supported) Flags references to arguments.callee and arguments.caller.
no-catch-shadow
no-comma-dangle - Unexpected comma. Flags trailing commas in object literals.
no-cond-assign
no-console
no-control-regex
no-debugger
no-delete-var
no-div-regex
no-dupe-keys - Duplicate key '{a}'. Flags object literals that contain the same key more than once.
no-else-return
no-empty-class
no-empty-label
no-empty - (Not supported) Flags an empty block like if (..) { }
no-eq-null - Use '===' to compare with 'null'. JSLint produces similar warnings when comparing against undefined.
no-eval evil eval is evil.
no-ex-assign - Do not assign to the exception parameter.
no-extra-semi - Unnecessary semicolon.
no-fallthrough
no-floating-decimal
no-func-assign
no-global-strict
no-implied-eval
no-iterator
no-label-var - '{label}' is already defined. Flags labels that collide with an identifier.
no-loop-func - Don't make functions within a loop.
no-mixed-requires
no-multi-str
no-native-reassign - Read only.
Bad assignment.
Flags an attempt to reassign a native object like Math, Array, undefined, etc.
no-negated-in-lhs
no-new-array - Use the array literal notation []. Flags new Array()
no-new-func - Do not use 'new' for side effects. Flags uses of new operator in an expression that is not assigned to anything.
no-new-object - Use the object literal notation {}.
no-new-wrappers Do not use {String, Number, Boolean, Math, JSON} as a constructor.
no-new
no-obj-calls
no-octal-escape
no-octal
no-plusplus plusplus Unexpected use of '{++, --}'
no-proto - "Reserved name '__proto__'. (if used as an identifier)
Stupid key '{a}' (if used as a key)
Treated as a fatal parse error in JSLint.
no-redeclare - "'{a}' is already defined." Usually results from having two for loops in the same function that share a loop variable declaration like var i=....
no-return-assign - (Not supported) Prevents assignment in a return statement.
no-script-url
no-self-compare
no-shadow
no-spaced-func
no-sync stupid Unexpected sync method: '{a}'. Flags Node.js's synchronous I/O methods.
The stupid option is supported only in newer versions of JSLint (not Orion's).
no-ternary
no-undef-init - It is not necessary to initialize 'x' to 'undefined'.
no-undef undef '{variable}' is not defined. Flags references to a global variable that is not listed in a /*global*/ or /*globals*/ block.
Predefined environments (eg. node, browser) can be set as /*jslint */ block.
no-underscore-dangle nomen dangling '_'
no-unreachable
no-unused-expressions - Expected an assignment or function call and instead saw an expression. Flags expressions that appear in a statement context and don't cause side effects.
no-unused-vars - Function declares unused variable '{a}'. (Orion) Newer JSlint versions have an unparam option which works similarly.
no-use-before-define - '{a}' was used before it was defined.
no-with - Expected an identifier and instead saw 'with'. Treated as fatal parse error in JSLint.
no-wrap-func
one-var vars
quote-props
quotes - (Not supported)
radix - Missing radix parameter. Affects parseInt()
regex-spaces - Spaces are hard to count. Use {n}.
semi - Missing semicolon.
strict strict Requires "use strict" pragma.
unnecessary-strict
use-isnan - Use the isNaN function to compare with NaN.
wrap-iife immed Wrap the entire immediate function invocation in parens.
Do not wrap function literals in parens unless they are to be immediately invoked.
Move the invocation into the parens that contain the function.
wrap-regex - Wrap the /regexp/ literal in parens to disambiguate the slash operator.

Rule priority

Here are the rules we want, in order of priority:

  1. no-undef

Copyright © Eclipse Foundation, Inc. All Rights Reserved.