Features Videos Help About Updates
Menu Buy Now

ESLint

First Steps:
Getting Started
Live-Reload Browsers
Browser Sync
Set Language Options
Set Output Paths & Action
Second Steps:
Defaults For New Projects
Build Your Project
Set Target Browsers
Stuff To Know:
CodeKit + Git
Troubleshooting
License Recovery
PostCSS Tools:
Autoprefixer
PurgeCSS
Custom PostCSS Plugins
Other Tools:
npm
Babel — (JS Transpiler)
Terser — (JS Minifier)
Rollup — (JS Bundler)
Cache-Buster
HTML-Minifier
LightningCSS
Bless
Languages:
Sass
Less
Stylus
JavaScript
CoffeeScript
TypeScript
Pug
Haml
Slim
Kit
Markdown
JSON
Image Optimizers:
WebP
PNG
JPEG
SVG
GIF
Frameworks:
CodeKit Frameworks
Tailwind
Bootstrap
Bourbon
Bitters
Zurb Foundation
Susy
Nib
Jeet
Syntax Checkers:
ESLint
Advanced:
Hooks
Environment Variables
Adding Custom Languages
Team Workflows
Scripting CodeKit
Editor Plugins:
Nova
Atom
Sublime Text
Coda 2
More
Read-Only Mode
Upgrading From 2.0
FAQ
The ESLint logo

What's ESLint?

ESLint is the best JavaScript syntax checker.

It can locate hundreds of common mistakes, enforce your preferred coding style (spaces not tabs!), and is infinitely configurable.

Unlike other tools, ESLint also understands ES6+ syntax, which means you can use it on next-generation JavaScript.


Enabling ESLint

A screenshot of the ESLint option in the file inspector pane in CodeKit

Select a JavaScript file, then choose ESLint from the Check Syntax With pop-up button in the Inspector Pane.

Alternately, to enable ESLint for all JavaScript files at once, open Project Settings, choose the JavaScript category, and use the same pop-up button.


Syntax Issues

When problems are found in a file, they appear in CodeKit's log:

A screenshot of the eslint results in the CodeKit log

The line number of the issue appears in the black rectangle. The character where the problem starts is highlighted in red. The name of the ESLint rule that triggered the warning is shown in grey, after the warning itself.

Collapsible

Log entries in CodeKit are collapsible. Click the main log entry to expand or collapse detailed information, including syntax issues.


Linked Files

CodeKit lets you combine JavaScript files. When the base file (the one that imports others) is processed, the whole chain is syntax-checked at once. This means, for example, that a variable declared in an imported file will not be "undefined" when it's used in the base file.

Issues are separated by file. Here, main.js imports prefix.js:

A screenshot of the eslint results for linked files in the CodeKit log
Skipping Issues In Imported Files

You can tell CodeKit to ignore issues in an imported file. Select the base JavaScript file, then choose the Linked Files section of the Inspector:

A screenshot of the shield checkbox in the file inspector in CodeKit

Uncheck the Shield Checkbox next to the file you want to skip. CodeKit will no longer scan for issues in that imported file nor any files it imports.

Note: If you import a file in a bower_components or node_modules folder, the Shield Checkbox is automatically unchecked for that file.

Pro-Tip: If you add //quiet to the end of your import statement, CodeKit will automatically uncheck the shield:

import {thing} from "./other.js"   // quiet

// "other.js" will be skipped during syntax-checking

Configuring ESLint

Open Project Settings, then choose the ESLint category under Syntax Checkers:

A screenshot of the ESLint category in Project Settings in CodeKit
ECMA Version

This defines which version of JavaScript your code targets. The default is ECMAScript 7, which includes ES2015 syntax. If you set this to an older version of ECMA and attempt to use newer language syntax, ESLint will throw a parsing error.

Globals

ESLint may warn about "undefined" variables and functions in your code. If those items are defined outside of your script, add them to this field to eliminate the warnings.

By default, Globals are read-only. If your script attempts to write a value to a Global, you'll be warned. To eliminate that warning, add :write after the global's name.

Environments

Check the environments where your script runs and ESLint will automatically include Globals appropriate for that environment. For example, when Browser is checked, the console.log() function will not produce a "console is undefined" warning.


ESLint Rules

To control what ESLint considers a syntax error, you enable specific rules. The master list of rules is on ESLint's website. CodeKit includes every rule, organized into the same sections:

A screenshot of the possible errors rule section in ESLint settings in CodeKit

To enable a rule, simply check the box next to its name.

Rule Options

Some rules have options. You control these by setting specific strings in the Options text field for each Rule.

Warning: The syntax that ESLint expects for an option varies from rule to rule. Some are simple strings. Some are JSON-style objects or arrays. Before you change an option string, be sure to read the documentation for the associated rule. An incorrect entry or typo will cause ESLint to fail.

Rule Documentation

Click the Question Mark button to instantly view a rule's documentation in a popover:

A screenshot of the ESLint documentation popover in CodeKit

Configure Once

You probably don't want to customize ESLint every time you start a new Project. You don't have to. Read Defaults For New Projects.

Made in San Diego, CA

Follow the Developer on Twitter

Email Support

Report a Bug

Privacy Policy