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.
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.
Enable or disable linting. You can lint files when they are loaded or saved. You can enable/disable linting using the Preferences > Linting option. 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.
Click Edit > Preferences (Win) or Dreamweaver > Preferences (Mac). Select Linting in the Category list, and select Enable Linting.
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: .eslintrc
The linting rules configuration file for earlier versions of Dreamweaver 19.0 is JS: DW.jshintrc. You can refer to http://jshint.com/docs/options/
To customize the rule set, you can select Configuration File from the drop-down list and click Edit Configuration File.
The changes you make in Site Setup are saved and a new file .eslintrc.js is created in site root if it is not present.
.eslintrc.js file opens in the site root for editing. For more information, see ESLint rules.
- The ECMAScript Version settings defined in site setup dialog has precedence over the .eslintrc.js file used in site root.
- If you do not have ESLint configuration files in the site, Dreamweaver searches for the configuration files in all locations leading up to the root directory.
For more information on configuration file cascading and hierarchy, see ESLint site.
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
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
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.