Learn how to lint HTML, CSS, and JS files in Adobe Dreamweaver. View the errors and warnings in the Output panel and jump to the erroneous lines of code with a single click.

Whether you are a rookie or an experienced coder, there are always chances of errors creeping in to your code inadvertently or due to lack of knowledge. When the web page or even a portion of it doesn't look like what you expected, you are forced to debug code to find any syntax or logical errors. Debugging can be an extremely strenuous and a time-consuming process especially in cases of complex implementations.

Dreamweaver makes debugging code for common errors simple and easy with the help of linting. Linting is the process of analyzing code to flag potential errors or suspicious usage of code. HTML syntax errors, parsing errors in CSS, or warnings in JavaScript files are some of the things flagged by linting in Dreamweaver.

The errors and warnings found are listed in a separate panel - Output panel - docked at the bottom of the workspace. Each line in the panel helps you jump to the portion of the code where the error has occurred, making it easy to find and fix the code. Also, the line numbers of the erroneous code are highlighted in red for errors and yellow for warnings. When you hover your mouse over the highlighted line numbers, a preview of the error or warning pops up.

Dreamweaver lets you lint HTML (.htm and .html), CSS, and JavaScript files. Perform the following steps to lint your code in these files:

  1. Specify linting rules by editing the HTML, CSS, and JS configuration files. See Specify linting rules for more information.

  2. Enable linting and specify when the linting should be triggered. You can lint files when they are loaded, saved, or edited. See Enable linting and set preferences for more information.

Errors and warnings found in the files are displayed in the output panel. For more information, see Linting results and the Output panel.

Enable linting and specify linting rules

Click Edit > Preferences (Win) or Dreamweaver > Preferences (Mac). Select Linting in the Category list, and select Enable Linting.

Specify linting rules

You can lint HTML, CSS, and JS files by editing the linting rules in the corresponding configuration files:

  • HTML: DW.htmlhintrc
  • CSS: DW.csslintrc
  • JS: DW.jshintrc

To access and edit these files, perform the following steps:

  1. Click Edit > Preferences (Win) or Dreamweaver > Preferences (Mac). 

  2. Select Linting in the Category list.

  3. In the Edit Rule Set section, click the required file type and click Edit & Apply Changes.

    The corresponding configuration file opens in Dreamweaver.

  4. Edit or add linting rules to the configuration files. Refer to the following documentation for more information on linting rules:

    In these configuration files, you can also set the type of errors or warnings to be displayed. In JS configuration files, you can also set the maximum number of errors to be found.

Linting results and the Output panel

The linting results - errors and warnings - are listed in the Output panel. The Output panel is available in the docked mode at the bottom of all default workspaces. If the Output panel is closed, you can open it by performing one of the following actions:

  • By clicking the linting status icon in the Document window status bar
  • Using the keyboard shortcut, Shift+F6
  • Using Window > Results > Output
Output panel and linting icon
The Output panel and the linting icon

The linting icon in the Status bar indicates the linting results:

  • Red - The current document has errors and warnings
  • Yellow - The current document has warnings only
  • Green - The current document has no errors

Note:

You can use the linting icon in the Status bar to also toggle the Output panel (open/close) if the icon is red or yellow (not green).

The lines that contain the errors or warnings are highlighted in red and yellow respectively. You can double click a message in the Output panel to jump to the line where the error has occurred. In Code view, you can also hover your mouse over the line numbers of the erroneous lines to see a preview of the error or warning.

The Output panel lists 50 messages at a time with the errors listed before warnings. As and when you fix the errors, the list in the panel scrolls to display the next error.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy