Skip to content

A closure linter extension for brackets that provides an interface to both gjslint and fixjsstyle. It will be used with files that have the “JavaScript” syntax, or within <script> tags in HTML files.

Notifications You must be signed in to change notification settings

mrmeku/brackets-closure-linter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

brackets-closure-linter

A Brackets extension that provides hooks to the Closure Linter. The Closure Linter is a utility that checks JavaScript files for style issues such as operator placement, missing semicolons, spacing, the presence of JsDoc annotations, and more.

Installation

To install, place in your brackets/src/extensions/user folder. Alternatively,open the extension manager within brackets and install the Closure Linter package.

Brackets has JSLint built in and if you wish to ignore JSLint results, you must tell Brackets to explicitly use gjslint only. This can be done via a .brackets.json file in the root of your project or going clicking Debug > Open Preferneces File to edit your global preferences. Simply use this block:

"language": {
    "javascript": {
        "linting.prefer": "gjslint",
        "linting.usePreferredOnly": true
    }
}

Requirements

python must be set within your path since the closure linter is a python executable

Usage

After installation, the closure linter's gjslint` becomes your default javascript linter. To see it in action, open a JavaScript file. In the bottom right corner of your editor you will either see a green checkmark (which means no problems were found) or a yellow exclamation mark. Click on the exclamation mark and a bottom panel will open listing all the problems found.

The closure linter also comes bundled with a fixjsstyle command which can automatically fix identified linting errors. To see it in action, open a JavaScript file. If you see a yellow exclamation mark in the bottom right corner of your editor, you have linting errors that fixjsstyle may be able to fix. Select Edit > Fixjsstyle menu or Cmd-Shift-J(Mac) / Ctrl-Shift-J(Win) to run the command. Then save your file and watch your linting errors disappear!

You can also have fixjsstyle run automatically whenever you save a javascript or html document by selecting Edit > Fixjsstyle On Save.

Files

  • main.js:
    • Sets up menu items for fixjsstyle and fixjsstyle on save
    • When brackets is ready, gjslint is registered to lint both a javascript html
  • closureLinterDomain.js:
    • A node instance which creates a temporary file copied from the editor's current text and runs the closure linter
  • closure_linter/:
    • Google's closure linter

About

A closure linter extension for brackets that provides an interface to both gjslint and fixjsstyle. It will be used with files that have the “JavaScript” syntax, or within <script> tags in HTML files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published