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

Difference between revisions of "Orion/ESLint"

(Rules)
(Rules)
Line 64: Line 64:
  
 
| max-len
 
| max-len
|  
+
| '''maxlen'''
|  
+
| Line too long.
 
|-
 
|-
  
Line 340: Line 340:
  
 
| no-sync
 
| no-sync
|  
+
| '''stupid'''
|  
+
| Unexpected sync method: '{a}'.
 +
| Flags Node.js's synchronous I/O methods.<br>The '''stupid''' option is supported only in newer versions of JSLint (not Orion's).
 
|-
 
|-
  
Line 373: Line 374:
 
| -
 
| -
 
| Expected an assignment or function call and instead saw an expression.
 
| Expected an assignment or function call and instead saw an expression.
| Flags non-side-effect-ful expressions
+
| Flags expressions that appear in a statement context and don't cause side effects.
 
|-
 
|-
  
 
| no-unused-vars
 
| no-unused-vars
|  
+
| '''unparam''' (newer JSLint versions only)
 +
| Function declares unused variable '{a}'.
 
|  
 
|  
 
|-
 
|-

Revision as of 13:09, 15 November 2013

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
camelcase
complexity
consistent-this
curly
dot-notation sub {a} is better written in dot notation.
eqeqeq eqeqeq
eqeq
Expected '===' and saw '=='.
Expected '!==' and saw '!='.
eqeq only appears in old versions of JSLint (like Orion's), has opposite on/off state to eqeqeq.
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
max-len maxlen Line too long.
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 'Template: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
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
no-loop-func
no-mixed-requires
no-multi-str
no-native-reassign
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 unparam (newer JSLint versions only) Function declares unused variable '{a}'.
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
quote-props
quotes Strings must use doublequote. Only if "jsonmode"
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

Back to the top