Skip to content

HaroldPutman/eslint-plugin-jsp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-plugin-jsp

NPM version Build Status Dependency Status Coverage Status

Process javascript in JSP files

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-jsp:

$ npm install eslint-plugin-jsp --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-jsp globally.

Usage

Add jsp to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "jsp"
    ]
}

Note: Since this plugin implements a preprocessor, the --fix command will have no effect.

Anotating your jsp

  • <%-- eslint-begin --%> and <%-- eslint-end --%> to mark the sections of you code that will be linted.

  • <%-- jsp-result:{} --%> will insert the expression after the colon. Use this in places where javascript and JSP expressions are mixed:

// An expression like this:
var a = <jsp:element input="foo"/> <%-- jsp-result:5 --%>;
// appears to the linter as:
var a = /* jsp:element input="f */ 5;
  • <%-- jsp comments --%> and <!-- xml comments --> are ignored.

About

Apply Eslint to javascript embedded in JSP files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published