Write high-quality JavaScript & CSS code with Sublimelinter

Source: Internet
Author: User
Tags sublime text

Sublimelinter is the front-end coding weapon-a plug-inSublime Text , used to highlight the user-written code in the presence of the nonstandard and wrong wording, support JavaScript, CSS, HTML, Java, PHP, Python, Ruby and more than 10 different development languages. This article describes how to configure Sublimelinter for JS & CSS validation in Windows.

Preparatory work

Install Sublime Text Package management tool: Http://wbond.net/sublime_packages/package_control

Install Sublimelinter:https://github.com/sublimelinter/sublimelinter using the Sublime Text Package management tool

Installing node. js, we recommend that you install the Windows Installer version: http://nodejs.org

Parameter configuration

Open the Sublimelinter configuration file, Preferences->package Settings->sublimelinter->settings-user, for the following configuration:

(1) Operating mode
1 "sublimelinter""save-only",

Sublimelinter operating mode, a total of four kinds, the meaning is as follows:

    • True-instant validation in the background when user input;
    • False-The checksum is only performed at initialization time;
    • "Load-save"-check when the file is loaded and saved;
    • "Save-only"-Verify when the file is saved;

Recommended set to "Save-only", so only after writing code, save the time to verify, Sublime Text run will be more fluent.

(2) Calibration engine
12345 "sublimelinter_executable_map":{    "javascript":"D:/nodejs/node.exe",    "css":"D:/nodejs/node.exe"}

Here is the installation path of the JS Engine (node. js) needed to configure JavaScript and CSS validation.

(3) jshint option

  Sublimelinter uses jshint as the default JavaScript validator, and can also be configured as JSLint and Gjslint (Closure linter). The following I use the Jshint check option, you can according to their own coding style configuration, the meaning of the options can be referred to here: http://www.jshint.com/docs/#options

123456789101112131415 "jshint_options":{    "strict": true,    "noarg": true,    "noempty": true,    "eqeqeq": true,    "undef": true,    "curly": true,    "forin": true,    "devel": true,    "jquery": true,    "browser": true,    "wsh": true,    "evil": true}
(4) Csslint option

Sublimelinter uses csslint as the validator for the CSS, the following is the default configuration of the check option, can be modified according to the personal coding style:

12345678910111213141516171819202122232425262728293031323334 "csslint_options":{    "adjoining-classes""warning",    "box-model": true,    "box-sizing""warning",    "compatible-vendor-prefixes""warning",    "display-property-grouping": true,    "duplicate-background-images""warning",    "duplicate-properties": true,    "empty-rules": true,    "errors": true,    "fallback-colors""warning",    "floats""warning",    "font-faces""warning",    "font-sizes""warning",    "gradients""warning",    "ids""warning",    "import""warning",    "important""warning",    "known-properties": true,    "outline-none""warning",    "overqualified-elements""warning",    "qualified-headings""warning",    "regex-selectors""warning",    "rules-count""warning",    "shorthand""warning",    "star-property-hack""warning",    "text-indent""warning",    "underscore-property-hack""warning",    "unique-headings""warning",    "universal-selector""warning",    "vendor-prefix": true,    "zero-units""warning"}

Write high-quality JavaScript & CSS code with Sublimelinter

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.