ESLint for Javascript Problems
Phoenix Code provides a comprehensive interface for identifying and resolving
ESLint issues in your js/jsx files.
ESLint is only available in desktop apps. In Browsers, JSHint is the default
linter for javascript files.
On desktop, JavaScript is also checked by the TypeScript language server, and JSHint turns off automatically.
Basic Usage
To activate ESLint, the project must have a node package.json file with
ESLint as a dependency. Opening a js or jsx file, or editing and saving it,
lints the file and shows the results in the Problems panel.
Features
- Errors and warnings are underlined directly in the editor.
- Hovering over a highlighted line provides detailed information about the specific ESLint problem and a suggested fix if available.
- Fix individual issues by clicking on the
Fixbutton next to the specific problem, or you can resolve all fixable issues in the file by clicking on theFix Allbutton at the top of the panel.
Advanced Use
Phoenix Code uses ESLint configured in the opened project directory. Any changes to your ESLint configuration files will be automatically picked up. To learn more about how to use and configure ESLint, see Getting Started with ESLint.
FAQ
Q: Which version of ESLint are supported
Phoenix Code supports ESLint versions 7 and above only.
Q: Why is ESLint not working in my project
Most problems are usually reported in the Problems panel itself. These are the most common errors:
- Ensure that ESLint is listed in
dependenciesordevDependenciessection in yourpackage.jsonfile. E.g.
{
"name": "My Project With ESLint",
"version": "1.0.0",
"description": "Sample package.json to activate ESLint",
"main": "index.js",
"scripts": {},
"devDependencies": {
"eslint": "^8.0.0"
}
}
- Ensure to run
npm installon the project andnode_modulesfolder is present in the project at the top level. - ESLint config files may have errors. Check if the problem message contains any references to your ESLint config file.
Note: ESLint runs automatically when you save your file. Issues and errors are displayed in the Problems Panel.