Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 520984

Summary: Allow codeEdit users to customize the jslint rules.
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P2    
Version: 15.0   
Target Milestone: 16.0   
Hardware: PC   
OS: Mac OS X   
See Also: https://github.com/eclipse/orion.client/pull/143
Whiteboard:

Description libing wang CLA 2017-08-15 11:05:23 EDT
We validate json files by using jslint rules(http://www.jslint.com/help.html). There are requirements from the json editor users for the jslint rule customizations.
Comment 1 Michael Rennie CLA 2017-08-15 11:09:19 EDT
Here is the complete list of options that the version of JSLint we are using supports (notice the custom one for Orion because JSLint does not allow you to ignore mixed spaces and tabs):

adsafe     : true, // if ADsafe should be enforced
            bitwise    : true, // if bitwise operators should not be allowed
            browser    : true, // if the standard browser globals should be predefined
            cap        : true, // if upper case HTML should be allowed
            css        : true, // if CSS workarounds should be tolerated
            debug      : true, // if debugger statements should be allowed
            devel      : true, // if logging should be allowed (console, alert, etc.)
            eqeqeq     : true, // if === should be required
            es5        : true, // if ES5 syntax should be allowed
            evil       : true, // if eval should be allowed
            forin      : true, // if for in statements must filter
            fragment   : true, // if HTML fragments should be allowed
            immed      : true, // if immediate invocations must be wrapped in parens
            laxbreak   : true, // if line breaks should not be checked
            newcap     : true, // if constructor names must be capitalized
            node       : true, // if Node.js globals should be predefined
            nomen      : true, // if names should be checked
            on         : true, // if HTML event handlers should be allowed
            onevar     : true, // if only one var statement per function should be allowed
            passfail   : true, // if the scan should stop on first error
            plusplus   : true, // if increment/decrement should not be allowed
            regexp     : true, // if the . should not be allowed in regexp literals
            rhino      : true, // if the Rhino environment globals should be predefined
            undef      : true, // if variables should be declared before used
            safe       : true, // if use of some browser features should be restricted
            windows    : true, // if MS Windows-specigic globals should be predefined
            strict     : true, // require the "use strict"; pragma
            sub        : true, // if all forms of subscript notation are tolerated
            white      : true, // if strict whitespace rules apply
            widget     : true,  // if the Yahoo Widgets globals should be predefined
            mixed_spaces_tabs : true //ORION - be able to turn on/off reporting mixed spaces and tabs
Comment 2 libing wang CLA 2017-08-15 11:13:26 EDT
The jslint rule customization will work the similar way as eslint does:
https://wiki.eclipse.org/Orion/How_Tos/Code_Edit#Options_to_tune_your_.tern-project_and_.eslintrc_files
Comment 3 Eclipse Genie CLA 2017-08-15 11:13:27 EDT
GitHub Pull Request 143 created by [mrennie]
https://github.com/eclipse/orion.client/pull/143
Comment 4 Michael Rennie CLA 2017-08-15 11:18:28 EDT
(In reply to libing wang from comment #2)
> The jslint rule customization will work the similar way as eslint does:
> https://wiki.eclipse.org/Orion/How_Tos/Code_Edit#Options_to_tune_your_.tern-
> project_and_.eslintrc_files

Yes - to selectively turn on / off rules you will have to use the JSLint configuration file. The file is named ".jslintrc" and resides in the root of your project (this will typically be the place your package.json or .tern-project file resides).

Rules added to the file must appear as top-level entries, like so:

{
  "mixed_spaces_tabs": true,
  "bitwise"    : true, 
  "browser"    : true, 
}
Comment 5 Michael Rennie CLA 2017-08-15 11:22:16 EDT
The fix has been merged