Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Orion/ESLint"
< Orion
(→Rules) |
|||
Line 18: | Line 18: | ||
| brace-style | | brace-style | ||
− | | | + | | - |
− | | | + | | (Not supported) |
|- | |- | ||
| camelcase | | camelcase | ||
− | | | + | | - |
− | | | + | | (Not supported) |
|- | |- | ||
| complexity | | complexity | ||
− | | | + | | - |
− | | | + | | (Not supported) |
|- | |- | ||
| consistent-this | | consistent-this | ||
− | | | + | | - |
− | | | + | | (Not supported) |
|- | |- | ||
| curly | | curly | ||
− | | | + | | - |
+ | | Statement body should be inside '{ }' braces. (Orion)<br>Expected '{'. (Regular JSLint) | ||
| | | | ||
|- | |- | ||
Line 45: | Line 46: | ||
| '''sub''' | | '''sub''' | ||
| {a} is better written in dot notation. | | {a} is better written in dot notation. | ||
+ | | | ||
|- | |- | ||
Line 50: | Line 52: | ||
| '''eqeqeq'''<br>'''eqeq''' | | '''eqeqeq'''<br>'''eqeq''' | ||
| Expected '===' and saw '=='.<br>Expected '!==' and saw '!='. | | Expected '===' and saw '=='.<br>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 | | guard-for-in | ||
| '''forin''' | | '''forin''' | ||
− | | The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype. | + | | The body of a <code>for in</code> should be wrapped in an <code>if</code> statement to filter unwanted properties from the prototype. |
|- | |- | ||
| max-depth | | max-depth | ||
− | | | + | | - |
− | | | + | | (Not supported) |
+ | | Enforces max depth of nested blocks within a function. | ||
|- | |- | ||
Line 66: | Line 69: | ||
| '''maxlen''' | | '''maxlen''' | ||
| Line too long. | | Line too long. | ||
+ | | Enforces a maximum line length. | ||
|- | |- | ||
Line 175: | Line 179: | ||
| no-eq-null | | no-eq-null | ||
− | | | + | | - |
− | | | + | | Use '===' to compare with 'null'. |
+ | | JSLint produces similar warnings when comparing against <code>undefined</code>. | ||
|- | |- | ||
Line 245: | Line 250: | ||
| no-native-reassign | | no-native-reassign | ||
− | | | + | | - |
− | | | + | | Read only.<br>Bad assignment. |
+ | | Flags an attempt to reassign a native object like <code>Math</code>, Array, <code>undefined</code>, etc. | ||
|- | |- | ||
Line 378: | Line 384: | ||
| no-unused-vars | | no-unused-vars | ||
− | | | + | | - |
− | | Function declares unused variable '{a}'. | + | | Function declares unused variable '{a}'. (Orion) |
− | | | + | | Newer JSlint versions have an '''unparam''' option which works similarly. |
|- | |- | ||
Line 400: | Line 406: | ||
| one-var | | one-var | ||
− | | | + | | '''vars''' |
| | | | ||
|- | |- | ||
Line 410: | Line 416: | ||
| quotes | | quotes | ||
+ | | - | ||
+ | | (Not supported) | ||
| | | | ||
− | |||
− | |||
|- | |- | ||
Revision as of 17:13, 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 | - | (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 | |||
no-loop-func | |||
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:
- no-undef