Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


ESLint custom parser + rules for linting CoffeeScript source files

Table of Contents

Getting Started

The following sections will give you an overview of what this project is, why it exists and how it works.

If you are ready to get started you can jump to Installation.

Why does this project exist?

ESLint is the preeminent linter in the JavaScript world.

As of CoffeeScript v2.5.0, the CoffeeScript compiler exposes an Abstract Syntax Tree (AST) representation of your source code which enables usage with AST-based tools like ESLint.

eslint-plugin-coffee is the package that allows you to use ESLint in CoffeeScript-based projects 🌈

How does eslint-plugin-coffee work?

The AST (see above) produced by CoffeeScript is different than the AST format that ESLint requires to work.

This means that by default, the CoffeeScript AST is not compatible with the 1000s of rules which have been written by and for ESLint users over the many years the project has been going.

The great thing is, though, we can provide ESLint with an alternative parser to use - that is a first-class use case offered by ESLint. eslint-plugin-coffee provides ESLint with that alternative parser for CoffeeScript.

At that point, ESLint is capable of "digesting" CoffeeScript source code. But what about the rules? Keep reading...

Can I use all of the existing ESLint plugins and rules without any changes?

The short answer is, no.

The great news is, there are many rules which will "just work" without you having to change anything about them or provide any custom alternatives.

For rules which don't "just work" for CoffeeScript, eslint-plugin-coffee aims to provide a CoffeeScript-compatible custom alternative rule - this includes rules that come with ESLint, as well as from the popular ESLint plugins eslint-plugin-react, eslint-plugin-import, eslint-plugin-react-native, and eslint-plugin-jsx-a11y.

Here's a guide to all of the supported rules.


Make sure you have supported versions of CoffeeScript and ESLint installed and install the plugin:


yarn add --dev coffeescript@^2.5.0 eslint@^6.0.0 eslint-plugin-coffee


npm install --save-dev coffeescript@^2.5.0 eslint@^6.0.0 eslint-plugin-coffee


Add eslint-plugin-coffee to the parser field and coffee to the plugins section of your .eslintrc configuration file, and disable ESLint rules that aren't compatible with CoffeeScript:

  "parser": "eslint-plugin-coffee",
  "plugins": ["coffee"],
  "extends": [

Then configure the rules you want to use under the rules section.

  "parser": "eslint-plugin-coffee",
  "plugins": ["coffee"],
  "rules": {
    // Can include existing rules that "just work":
    "no-undef": "error",
    "react/no-array-index-key": "error",
    // ...CoffeeScript-specific rules:
    "coffee/spread-direction": ["error", "postfix"],
    // ...and CoffeeScript custom overriding rules.
    // For these, the corresponding existing rule should also be disabled if need be:
    "no-unused-vars": "off",
    "coffee/no-unused-vars": "error"

To apply eslint:recommended (the set of rules which are recommended for all projects by the ESLint team) with this plugin, add plugin:coffee/eslint-recommended (which will adjust the eslint:recommended config appropriately for CoffeeScript) to your config:

  "extends": [

To apply the well-known Airbnb config with this plugin, add plugin:coffee/airbnb (for React projects) or plugin:coffee/airbnb-base (for non-React projects) to your config:

  "extends": [
    // for React projects:
    // OR for non-React projects:
  "rules": {
    // You may then want to disable some of the more "controversial" Airbnb rules
    // when applied to CoffeeScript, e.g.:
    "coffee/implicit-arrow-linebreak": "off",
    "coffee/comma-style": "off",
    "coffee/jsx-wrap-multilines": "off"


If you want to use rules from eslint-plugin-import (whether rules that "just work" or CoffeeScript custom overrides), add plugin:coffee/import (which configures eslint-plugin-import to work with CoffeeScript) to your config, along with the rules you want to use:

  "extends": [
  "rules": {
    // Can include existing rules that "just work":
    "import/no-unresolved": "error",
    // ...and CoffeeScript custom overriding rules.
    // For these, the corresponding existing rule should also be disabled if need be:
    "import/no-anonymous-default-export": "off",
    "coffee/no-anonymous-default-export": "error",

See below for a list of all supported rules from eslint-plugin-import.

eslint-plugin-react, eslint-plugin-react-native, eslint-plugin-jsx-a11y

If you want to use rules from eslint-plugin-react, eslint-plugin-react-native and/or eslint-plugin-jsx-a11y (whether rules that "just work" or CoffeeScript custom overrides), add those plugins and rules to your config:

  "plugins": [
  "rules": {
    // Can include existing rules that "just work":
    "react/no-array-index-key": "error",
    "react-native/no-inline-styles": "error",
    "jsx-a11y/accessible-emoji": "error",
    // ...and CoffeeScript custom overriding rules.
    // For these, the corresponding existing rule should also be disabled if need be:
    "react/prop-types": "off",
    "coffee/prop-types": "error",
    "react-native/no-unused-styles": "off",
    "coffee/no-unused-styles": "error",

To apply the recommended config from eslint-plugin-react, add plugin:coffee/react-recommended to your config:

  "extends": [

To apply the all config from eslint-plugin-react, add plugin:coffee/react-all to your config:

  "extends": [

To apply the recommended config from eslint-plugin-jsx-a11y, add plugin:jsx-a11y/recommended to your config:

  "plugins: [
  "extends": [

To apply the strict config from eslint-plugin-jsx-a11y, add plugin:jsx-a11y/strict to your config:

  "plugins: [
  "extends": [

See below for a list of all supported rules from eslint-plugin-react, eslint-plugin-react-native and eslint-plugin-jsx-a11y.

Running from the command line

To invoke ESLint from the command line, you can add an appropriate script to your package.json scripts section, for example:

  "scripts": {
    "lint": "eslint 'src/**/*.coffee'",
    "lint-fix": "eslint --fix 'src/**/*.coffee'"

Then you can invoke those scripts as needed from the command line to lint the CoffeeScript source files in your project:

npm run lint

Running from your editor

Running ESLint directly from your code editor (e.g. on save) provides a quick feedback loop while developing.

Depending on your editor, there may or may not currently be a straightforward way to get ESLint running against .coffee files (e.g. using an ESLint editor plugin).

If you're having trouble getting ESLint running in your editor (and it's not listed below), please file an issue and we'll try and help with support for your editor.

VS Code

To run ESLint from VS Code, first install the VS Code ESLint extension.

Then add to your VS Code settings.json:

"eslint.validate": [
    // "javascript", "javascriptreact" is the default setting
        "language": "coffeescript",
        "autoFix": true

Sublime Text

From @PatrickKing:

  • Enable Package Control (if it is not already enabled).
  • Enable CoffeeScript language support by installing Better CoffeeScript with Package Control (if it is not already installed).
  • Install SublimeLinter and SublimeLinter-eslint with Package Control.
  • Ensure eslint and eslint-plugin-coffee are installed locally with package.json or globally. (If globally, Try eslint at your terminal to make sure.)
  • Open "Preferences: SublimeLinter settings", and add/modify your user settings with:
"linters": {
    "eslint": {
        "selector": "source.js - meta.attribute-with-value,"

Other editors

We will add instructions for different code editors here as they become supported.

If you've gotten ESLint running in an editor not listed here and would like to share back, please file an issue!

Usage with Prettier

You can now use Prettier to format your CoffeeScript code, see the Prettier CoffeeScript plugin README for instructions.

To disable our code formatting related rules, install eslint-config-prettier:

npm install --save-dev eslint-config-prettier

Then use the prettier config exposed by this plugin:

  "extends": ["plugin:coffee/prettier"]

Alternatively, if you want to run Prettier as an ESLint rule (a nice option especially if you're running ESLint in fix mode via your editor):

npm install --save-dev eslint-config-prettier eslint-plugin-prettier

Then use the prettier-run-as-rule config exposed by this plugin:

  "extends": ["plugin:coffee/prettier-run-as-rule"]

Supported Rules

Key: ✔️ = ESLint recommended, 🔧 = fixable

ESLint-included rules

Possible Errors

Name Description
✔️ coffee/no-async-promise-executor disallow using an async function as a Promise executor
coffee/no-await-in-loop disallow await inside of loops
✔️ coffee/no-compare-neg-zero disallow comparing against -0
✔️ coffee/no-cond-assign disallow assignment operators in conditional expressions
no-console disallow the use of console
✔️ coffee/no-constant-condition disallow constant expressions in conditions
✔️ no-control-regex disallow control characters in regular expressions
✔️ no-debugger disallow the use of debugger
✔️ no-dupe-keys disallow duplicate keys in object literals
✔️ no-duplicate-case disallow duplicate case labels
✔️ no-empty disallow empty block statements
✔️ coffee/no-empty-character-class disallow empty character classes in regular expressions
✔️ no-ex-assign disallow reassigning exceptions in catch clauses
✔️ coffee/no-extra-boolean-cast disallow unnecessary boolean casts
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
✔️ coffee/no-inner-declarations disallow variable or function "declarations" in nested blocks
✔️ no-invalid-regexp disallow invalid regular expression strings in RegExp constructors
✔️ no-irregular-whitespace disallow irregular whitespace
✔️ no-misleading-character-class disallow characters which are made with multiple code points in character class syntax
✔️ no-obj-calls disallow calling global object properties as functions
✔️ no-prototype-builtins disallow calling some Object.prototype methods directly on objects
✔️ 🔧 coffee/no-regex-spaces disallow multiple spaces in regular expressions
✔️ no-sparse-arrays disallow sparse arrays
coffee/no-template-curly-in-string disallow template literal placeholder syntax in regular strings
✔️ coffee/no-unreachable disallow unreachable code after return, throw, continue, and break statements
✔️ no-unsafe-finally disallow control flow statements in finally blocks
✔️ coffee/no-unsafe-negation disallow negating the left operand of relational operators
✔️ require-atomic-updates disallow assignments that can lead to race conditions due to usage of await or yield
✔️ coffee/use-isnan require calls to isNaN() when checking for NaN
✔️ coffee/valid-typeof enforce comparing typeof expressions against valid strings

Best Practices

Name Description
accessor-pairs enforce getter and setter pairs in objects and classes
⚠️ Only checks e.g. Object.defineProperty() since CoffeeScript doesn't support getters/setters
coffee/block-scoped-var enforce the use of variables within the scope they are defined
coffee/class-methods-use-this enforce that class methods utilize this
coffee/complexity enforce a maximum cyclomatic complexity allowed in a program
default-case require else cases in switch statements
🔧 coffee/dot-location enforce consistent newlines before and after dots
🔧 coffee/dot-notation enforce dot notation whenever possible
coffee/guard-for-in require for-of loops to include own or an if statement
max-classes-per-file enforce a maximum number of classes per file
no-alert disallow the use of alert, confirm, and prompt
no-caller disallow the use of arguments.caller or arguments.callee
🔧 coffee/no-div-regex disallow division operators explicitly at the beginning of regular expressions
coffee/no-else-return disallow else blocks after return statements in if statements
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
coffee/no-empty-function disallow empty functions
✔️ no-empty-pattern disallow empty destructuring patterns
no-eval disallow the use of eval()
no-extend-native disallow extending native types
🔧 coffee/no-extra-bind disallow unnecessary calls to .bind()
🔧 no-floating-decimal disallow leading or trailing decimal points in numeric literals
✔️ no-global-assign disallow assignments to native objects or read-only global variables
⚠️ Only applies to e.g. ++ operations since CoffeeScript generates declarations on other write references.
🔧 coffee/no-implicit-coercion disallow shorthand type conversions
no-implied-eval disallow the use of eval()-like methods
coffee/no-invalid-this disallow this keywords outside of classes or class-like objects
no-iterator disallow the use of the __iterator__ property
coffee/no-loop-func disallow function declarations that contain unsafe references inside loop statements
coffee/no-magic-numbers disallow magic numbers
🔧 coffee/no-multi-spaces disallow multiple spaces
coffee/no-new disallow new operators outside of assignments or comparisons
no-new-func disallow new operators with the Function object
no-new-wrappers disallow new operators with the String, Number, and Boolean objects
no-param-reassign disallow reassigning function parameters
no-proto disallow the use of the __proto__ property
no-restricted-properties disallow certain properties on certain objects
coffee/no-return-assign disallow assignment operators in return statements
⚠️ Currently, this also flags assignments in implicit return statements
no-script-url disallow javascript: urls
✔️ coffee/no-self-assign disallow assignments where both sides are exactly the same
coffee/no-self-compare disallow comparisons where both sides are exactly the same
coffee/no-sequences disallow semicolon operators
no-throw-literal disallow throwing literals as exceptions
coffee/no-unmodified-loop-condition disallow unmodified loop conditions
coffee/no-unused-expressions disallow unused expressions
no-useless-call disallow unnecessary calls to .call() and .apply()
✔️ no-useless-catch disallow unnecessary catch clauses
no-useless-concat disallow unnecessary concatenation of literals or template literals
✔️ coffee/no-useless-escape disallow unnecessary escape characters
🔧 coffee/no-useless-return disallow redundant return statements
no-warning-comments disallow specified warning terms in comments
prefer-promise-reject-errors require using Error objects as Promise rejection reasons
radix enforce the consistent use of the radix argument when using parseInt()
require-unicode-regexp enforce the use of u flag on RegExp
coffee/vars-on-top require "declarations" be placed at the top of their containing scope
coffee/yoda require or disallow "Yoda" conditions
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
✔️ no-delete-var disallow deleting variables
no-restricted-globals disallow specified global variables
coffee/no-shadow disallow variable declarations from shadowing variables declared in the outer scope
✔️ no-undef disallow the use of undeclared variables unless mentioned in ###global ### comments
✔️ coffee/no-unused-vars disallow unused variables
coffee/no-use-before-define disallow the use of variables before they are "defined"

Node.js and CommonJS

Name Description
coffee/callback-return require return statements after callbacks
global-require require require() calls to be placed at top-level module scope
handle-callback-err require error handling in callbacks
no-buffer-constructor disallow use of the Buffer() constructor
no-new-require disallow new operators with calls to require
no-path-concat disallow string concatenation with __dirname and __filename
no-process-env disallow the use of process.env
no-process-exit disallow the use of process.exit()
no-restricted-modules disallow specified modules when loaded by require
no-sync disallow synchronous methods

Stylistic Issues

Name Description
coffee/array-bracket-newline enforce linebreaks after opening and before closing array brackets
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
🔧 coffee/array-bracket-spacing enforce consistent spacing inside array brackets
coffee/array-element-newline enforce line breaks after each array element
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
coffee/camelcase enforce camelcase naming convention
🔧 coffee/capitalized-comments enforce or disallow capitalization of the first letter of a comment
🔧 comma-spacing enforce consistent spacing before and after commas
coffee/comma-style enforce consistent comma style
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
🔧 computed-property-spacing enforce consistent spacing inside computed property brackets
coffee/consistent-this enforce consistent naming when capturing the current execution context
🔧 eol-last require or disallow newline at the end of files
coffee/function-paren-newline enforce consistent line breaks inside function parentheses
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
id-blacklist disallow specified identifiers
coffee/id-length enforce minimum and maximum identifier lengths
coffee/id-match require identifiers to match a specified regular expression
coffee/implicit-arrow-linebreak enforce the location of function bodies
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
🔧 jsx-quotes enforce the consistent use of either double or single quotes in JSX attributes
🔧 key-spacing enforce consistent spacing between keys and values in object literal properties
🔧 coffee/keyword-spacing enforce consistent spacing before and after keywords
line-comment-position enforce position of line comments
🔧 linebreak-style enforce consistent linebreak style
🔧 coffee/lines-around-comment require empty lines around comments
coffee/lines-between-class-members require or disallow an empty line between class members
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
coffee/max-depth enforce a maximum depth that blocks can be nested
coffee/max-len enforce a maximum line length
max-lines enforce a maximum number of lines per file
coffee/max-lines-per-function enforce a maximum number of line of code in a function
max-nested-callbacks enforce a maximum depth that callbacks can be nested
max-params enforce a maximum number of parameters in function definitions
max-statements enforce a maximum number of statements allowed in function blocks
🔧 coffee/multiline-comment-style enforce a particular style for multiline comments
new-cap require constructor names to begin with a capital letter
🔧 new-parens enforce or disallow parentheses when invoking a constructor with no arguments
coffee/newline-per-chained-call require a newline after each call in a method chain
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
no-array-constructor disallow Array constructors
no-bitwise disallow bitwise operators
no-continue disallow continue statements
no-inline-comments disallow inline comments after code
coffee/no-lonely-if disallow if statements as the only statement in else blocks
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
coffee/no-mixed-operators disallow mixed binary operators
no-multi-assign disallow use of chained assignment expressions
🔧 coffee/no-multiple-empty-lines disallow multiple empty lines
coffee/no-negated-condition disallow negated conditions
no-new-object disallow Object constructors
no-plusplus disallow the unary operators ++ and --
no-restricted-syntax disallow specified syntax
no-tabs disallow all tabs
🔧 no-trailing-spaces disallow trailing whitespace at the end of lines
coffee/no-underscore-dangle disallow dangling underscores in identifiers
🔧 coffee/no-unneeded-ternary disallow if/else expressions when simpler alternatives exist
🔧 coffee/no-whitespace-before-property disallow whitespace before properties
🔧 coffee/object-curly-spacing enforce consistent spacing inside braces
coffee/object-property-newline enforce placing object properties on separate lines
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
🔧 coffee/operator-assignment require or disallow assignment operator shorthand where possible
coffee/operator-linebreak enforce consistent linebreak style for operators
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
coffee/prefer-object-spread disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
🔧 quote-props require quotes around object literal property names
sort-keys require object keys to be sorted
🔧 space-in-parens enforce consistent spacing inside parentheses
🔧 coffee/space-infix-ops require spacing around infix operators
🔧 coffee/space-unary-ops enforce consistent spacing before or after unary operators
🔧 coffee/spaced-comment enforce consistent spacing after the # or ### in a comment
🔧 unicode-bom require or disallow Unicode byte order mark (BOM)
🔧 coffee/wrap-regex require parenthesis around regex literals

"ECMAScript 6"

Name Description
🔧 coffee/arrow-spacing enforce consistent spacing before and after the arrow in functions
✔️ constructor-super require super() calls in constructors
✔️ coffee/no-class-assign disallow reassigning class members
✔️ no-dupe-class-members disallow duplicate class members
no-duplicate-imports disallow duplicate module imports
✔️ no-new-symbol disallow new operators with the Symbol object
no-restricted-imports disallow specified modules when loaded by import
✔️ coffee/no-this-before-super disallow this/super before calling super() in constructors
🔧 coffee/no-useless-computed-key disallow unnecessary computed property keys in objects and classes
coffee/no-useless-constructor disallow unnecessary constructors
🔧 no-useless-rename disallow renaming import, export, and destructured assignments to the same name
coffee/object-shorthand require or disallow method and property shorthand syntax for object literals
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
coffee/prefer-destructuring require destructuring from arrays and/or objects
⚠️ Unlike the ESLint rule, the CoffeeScript version is not fixable
🔧 prefer-numeric-literals disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals
prefer-rest-params require rest parameters instead of arguments
prefer-spread require spread operators instead of .apply()
🔧 coffee/prefer-template require interpolated strings instead of string concatenation
🔧 coffee/rest-spread-spacing enforce spacing between rest and spread operators and their expressions
🔧 sort-imports enforce sorted import declarations within modules
symbol-description require symbol descriptions
🔧 coffee/template-curly-spacing require or disallow spacing around embedded expressions of template strings

CoffeeScript-specific rules

Name Description
coffee/capitalized-class-names Enforce capitalization of the first letter of a class name
coffee/no-backticks Disallow use of the backtick operator
coffee/english-operators Enforce or disallow use of "English" operators
coffee/implicit-object Disallow implicit objects
coffee/implicit-call Disallow implicit function calls
coffee/empty-func-parens Enforce or disallow the use of parentheses for empty parameter lists
coffee/shorthand-this Enforce or disallow use of @ vs this
coffee/spread-direction Enforce consistent use of prefix vs postfix ...
🔧 coffee/postfix-comprehension-assign-parens Require parentheses around potentially confusing assignments in postfix comprehensions
coffee/no-nested-interpolation Disallow nesting interpolations
coffee/no-private-function-fat-arrows Disallow use of => for "private" functions in class bodies
coffee/no-unnecessary-double-quotes Disallow use of double quotes for strings when single quotes would suffice
🔧 coffee/boolean-keywords Require or disallow usage of specific boolean keywords

eslint-plugin-react rules

Key: ✔️ = recommended, 🔧 = fixable

Name Description
coffee/boolean-prop-naming Enforces consistent naming for boolean props
react/button-has-type Forbid "button" element without an explicit "type" attribute
coffee/default-props-match-prop-types Prevent extraneous defaultProps on components
coffee/destructuring-assignment Rule enforces consistent usage of destructuring assignment in component
✔️ coffee/display-name Prevent missing displayName in a React component definition
react/forbid-component-props Forbid certain props on Components
react/forbid-dom-props Forbid certain props on DOM Nodes
react/forbid-elements Forbid certain elements
coffee/forbid-prop-types Forbid certain propTypes
react/forbid-foreign-prop-types Forbid foreign propTypes
coffee/no-access-state-in-setstate Prevent using this.state inside this.setState
react/no-array-index-key Prevent using Array index in key props
✔️ react/no-children-prop Prevent passing children as props
react/no-danger Prevent usage of dangerous JSX properties
✔️ coffee/no-danger-with-children Prevent problem with children and props.dangerouslySetInnerHTML
✔️ coffee/no-deprecated Prevent usage of deprecated methods, including component lifecycle methods
react/no-did-mount-set-state Prevent usage of setState in componentDidMount
react/no-did-update-set-state Prevent usage of setState in componentDidUpdate
✔️ react/no-direct-mutation-state Prevent direct mutation of this.state
✔️ react/no-find-dom-node Prevent usage of findDOMNode
✔️ react/no-is-mounted Prevent usage of isMounted
coffee/no-multi-comp Prevent multiple component definition per file
coffee/no-redundant-should-component-update Prevent usage of shouldComponentUpdate when extending React.PureComponent
✔️ coffee/no-render-return-value Prevent usage of the return value of React.render
react/no-set-state Prevent usage of setState
coffee/no-typos Prevent common casing typos
✔️ react/no-string-refs Prevent using string references in ref attribute.
coffee/no-this-in-sfc Prevent using this in stateless functional components
✔️ coffee/no-unescaped-entities Prevent invalid characters from appearing in markup
✔️ 🔧 react/no-unknown-property Prevent usage of unknown DOM property
react/no-unsafe Prevent usage of unsafe lifecycle methods
coffee/no-unused-prop-types Prevent definitions of unused prop types
coffee/no-unused-state Prevent definitions of unused state properties
react/no-will-update-set-state Prevent usage of setState in componentWillUpdate
react/prefer-es6-class Enforce ES5 or ES6 class for React Components
coffee/prefer-stateless-function Enforce stateless React Components to be written as a pure function
✔️ coffee/prop-types Prevent missing props validation in a React component definition
✔️ react/react-in-jsx-scope Prevent missing React when using JSX
coffee/require-default-props Enforce a defaultProps definition for every prop that is not a required prop
react/require-optimization Enforce React components to have a shouldComponentUpdate method
🔧 react/self-closing-comp Prevent extra closing tags for components without children
coffee/sort-comp Enforce component methods order
⚠️ Unlike the eslint-plugin-react rule, the CoffeeScript version is not fixable
coffee/sort-prop-types Enforce propTypes declarations alphabetical sorting
react/static-property-placement Enforces where React component static properties should be positioned
coffee/style-prop-object Enforce style prop value being an object
react/void-dom-elements-no-children Prevent void DOM elements (e.g. <img />, <br />) from receiving children

JSX-specific rules

Name Description
coffee/jsx-boolean-value Enforce boolean attributes notation in JSX
⚠️ Unlike the eslint-plugin-react rule, the CoffeeScript version is not fixable
react/jsx-child-element-spacing Enforce or disallow spaces inside of curly braces in JSX attributes and expressions.
🔧 coffee/jsx-closing-bracket-location Validate closing bracket location in JSX
🔧 react/jsx-closing-tag-location Validate closing tag location in JSX
coffee/jsx-curly-newline Enforce or disallow newlines inside of curly braces in JSX attributes and expressions
⚠️ Unlike the eslint-plugin-react rule, the CoffeeScript version is not fixable
🔧 react/jsx-curly-spacing Enforce or disallow spaces inside of curly braces in JSX attributes and expressions
🔧 react/jsx-equals-spacing Enforce or disallow spaces around equal signs in JSX attributes
react/jsx-filename-extension Restrict file extensions that may contain JSX
coffee/jsx-first-prop-new-line Enforce position of the first prop in JSX
⚠️ Unlike the eslint-plugin-react rule, the CoffeeScript version is not fixable
coffee/jsx-handler-names Enforce event handler naming conventions in JSX
🔧 coffee/jsx-indent Validate JSX indentation
🔧 react/jsx-indent-props Validate props indentation in JSX
✔️ coffee/jsx-key Validate JSX has key prop when in array or iterator
react/jsx-max-depth Validate JSX maximum depth
coffee/jsx-max-props-per-line Limit maximum of props on a single line in JSX
⚠️ Unlike the eslint-plugin-react rule, the CoffeeScript version is not fixable
coffee/jsx-no-bind Prevent usage of .bind() and arrow functions in JSX props
✔️ coffee/jsx-no-comment-textnodes Prevent comments from being inserted as text nodes
✔️ react/jsx-no-duplicate-props Prevent duplicate props in JSX
react/jsx-no-literals Prevent usage of unwrapped JSX strings
✔️ coffee/jsx-no-target-blank Prevent usage of unsafe target='_blank'
✔️ react/jsx-no-undef Disallow undeclared variables in JSX
coffee/jsx-one-expression-per-line Limit to one expression per line in JSX
🔧 react/jsx-curly-brace-presence Enforce curly braces or disallow unnecessary curly braces in JSX
🔧 coffee/jsx-fragments Enforce shorthand or standard form for React fragments
react/jsx-pascal-case Enforce PascalCase for user-defined JSX components
🔧 react/jsx-props-no-multi-spaces Disallow multiple spaces between inline JSX props
react/jsx-props-no-spreading Disallow JSX props spreading
coffee/jsx-sort-default-props Enforce default props alphabetical sorting
🔧 react/jsx-sort-props Enforce props alphabetical sorting
🔧 coffee/jsx-tag-spacing Validate whitespace in and around the JSX opening and closing brackets
✔️ react/jsx-uses-react Prevent React to be incorrectly marked as unused
✔️ react/jsx-uses-vars Prevent variables used in JSX to be incorrectly marked as unused
coffee/jsx-wrap-multilines Prevent missing parentheses around multilines JSX
⚠️ Unlike the eslint-plugin-react rule, the CoffeeScript version is not fixable

eslint-plugin-import rules

Static analysis

Name Description
import/no-unresolved Ensure imports point to a file/module that can be resolved
import/named Ensure named imports correspond to a named export in the remote file
import/default Ensure a default export is present, given a default import
coffee/namespace Ensure imported namespaces contain dereferenced properties as they are dereferenced
import/no-restricted-paths Restrict which files can be imported in a given folder
import/no-absolute-path Forbid import of modules using absolute paths
import/no-dynamic-require Forbid require() calls with expressions
import/no-internal-modules Prevent importing the submodules of other modules
import/no-webpack-loader-syntax Forbid webpack loader syntax in imports
import/no-self-import Forbid a module from importing itself
import/no-cycle Forbid a module from importing a module with a dependency path back to itself
import/no-useless-path-segments Prevent unnecessary path segments in import and require statements
import/no-relative-parent-imports Forbid importing modules from parent directories
coffee/no-unused-modules Forbid modules without any export, and exports not imported by any modules

Helpful warnings

Name Description
coffee/export Report any invalid exports, i.e. re-export of the same name
import/no-named-as-default Report use of exported name as identifier of default export
coffee/no-named-as-default-member Report use of exported name as property of default export
coffee/no-deprecated--import Report imported names marked with @deprecated documentation tag
import/no-extraneous-dependencies Forbid the use of extraneous packages

Module systems

Name Description
coffee/no-commonjs Report CommonJS require calls and module.exports or exports.*.
import/no-amd Report AMD require and define calls.
import/no-nodejs-modules No Node.js builtin modules.

Style guide

Name Description
🔧 import/first Ensure all imports appear before other statements
import/exports-last Ensure all exports appear after other statements
🔧 import/no-duplicates Report repeated import of the same module in multiple places
import/no-namespace Forbid namespace (a.k.a. "wildcard" *) imports
⚠️ Unlike the eslint-plugin-import rule, the CoffeeScript version is not fixable
import/extensions Ensure consistent use of file extension within the import path
🔧 coffee/order Enforce a convention in module import order
🔧 import/newline-after-import Enforce a newline after import statements
import/prefer-default-export Prefer a default export if module exports a single name
import/max-dependencies Limit the maximum number of dependencies a module can have
import/no-unassigned-import Forbid unassigned imports
import/no-named-default Forbid named default exports
coffee/no-default-export Forbid default exports
coffee/no-named-export Forbid named exports
coffee/no-anonymous-default-export Forbid anonymous values as default exports
import/group-exports Prefer named exports to be grouped together in a single export declaration
coffee/dynamic-import-chunkname Enforce a leading comment with the webpackChunkName for dynamic imports

eslint-plugin-react-native rules

Name Description
coffee/no-unused-styles Detect StyleSheet rules which are not used in your React components
coffee/split-platform-components Enforce using platform specific filenames when necessary
react-native/no-inline-styles Detect JSX components with inline styles that contain literal values
coffee/no-color-literals Detect StyleSheet rules and inline styles containing color literals instead of variables

eslint-plugin-jsx-a11y rules

Name Description
jsx-a11y/accessible-emoji Enforce emojis are wrapped in <span> and provide screenreader access
jsx-a11y/alt-text Enforce all elements that require alternative text have meaningful information to relay back to end user
jsx-a11y/anchor-has-content Enforce all anchors to contain accessible content
jsx-a11y/anchor-is-valid Enforce all anchors are valid, navigable elements
jsx-a11y/aria-activedescendant-has-tabindex Enforce elements with aria-activedescendant are tabbable
jsx-a11y/aria-props Enforce all aria-* props are valid
jsx-a11y/aria-proptypes Enforce ARIA state and property values are valid
jsx-a11y/aria-role Enforce that elements with ARIA roles must use a valid, non-abstract ARIA role
jsx-a11y/aria-unsupported-elements Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes
jsx-a11y/click-events-have-key-events Enforce a clickable non-interactive element has at least one keyboard event listener
jsx-a11y/heading-has-content Enforce heading (h1, h2, etc) elements contain accessible content
jsx-a11y/html-has-lang Enforce <html> element has lang prop
jsx-a11y/iframe-has-title Enforce iframe elements have a title attribute
jsx-a11y/img-redundant-alt Enforce <img> alt prop does not contain the word "image", "picture", or "photo"
jsx-a11y/interactive-supports-focus Enforce that elements with interactive handlers like onClick must be focusable
jsx-a11y/label-has-associated-control Enforce that a label tag has a text label and an associated control
jsx-a11y/lang Enforce lang attribute has a valid value
jsx-a11y/mouse-events-have-key-events Enforce that onMouseOver/onMouseOut are accompanied by onFocus/onBlur for keyboard-only users
jsx-a11y/no-autofocus Enforce autoFocus prop is not used
jsx-a11y/no-distracting-elements Enforce distracting elements are not used
jsx-a11y/no-interactive-element-to-noninteractive-role Interactive elements should not be assigned non-interactive roles
jsx-a11y/no-noninteractive-element-interactions Non-interactive elements should not be assigned mouse or keyboard event listeners
jsx-a11y/no-noninteractive-element-to-interactive-role Non-interactive elements should not be assigned interactive roles
jsx-a11y/no-noninteractive-tabindex tabIndex should only be declared on interactive elements
jsx-a11y/no-onchange Enforce usage of onBlur over onChange on select menus for accessibility
jsx-a11y/no-redundant-roles Enforce explicit role property is not the same as implicit/default role property on element
jsx-a11y/no-static-element-interactions Enforce that non-interactive, visible elements (such as <div>) that have click handlers use the role attribute
jsx-a11y/role-has-required-aria-props Enforce that elements with ARIA roles must have all required attributes for that role
jsx-a11y/role-supports-aria-props Enforce that elements with explicit or implicit roles defined contain only aria-* properties supported by that role
jsx-a11y/scope Enforce scope prop is only used on <th> elements
jsx-a11y/tabindex-no-positive Enforce tabIndex value is not greater than zero

Non-applicable ESLint-included rules

Some rules included with ESLint, eslint-plugin-react and eslint-plugin-import don't apply to CoffeeScript. These include:

Supported CoffeeScript version

We will always endeavor to support the latest stable version of CoffeeScript.

The version range of CoffeeScript currently supported by this plugin is >=2.5.0.

Supported ESLint version

The version range of ESLint currently supported by this plugin is >=6.0.0.

Supported versions of eslint-plugin-react, eslint-plugin-import, eslint-plugin-react-native, eslint-plugin-jsx-a11y

The version range of eslint-plugin-react currently supported by this plugin is >=7.17.0.

The version range of eslint-plugin-import currently supported by this plugin is >=2.19.0.

The version range of eslint-plugin-react-native currently supported by this plugin is >=3.8.0.

The version range of eslint-plugin-jsx-a11y currently supported by this plugin is >=6.2.3.

Migrating from CoffeeLint

Here is a mapping from CoffeeLint rules to their corresponding ESLint rules:

CoffeeLint rule ESLint rule
arrow_spacing coffee/arrow-spacing
braces_spacing coffee/object-curly-spacing
camel_case_classes coffee/camelcase + coffee/capitalized-class-names
coffeescript_error If the CoffeeScript compiler fails to parse/produce AST for a source file, ESLint will report it as a parsing error.
colon_assignment_spacing key-spacing
cyclomatic_complexity coffee/complexity
duplicate_key no-dupe-keys
empty_constructor_needs_parens new-parens
ensure_comprehensions coffee/postfix-comprehension-assign-parens
(this behavior is also covered if you're using Prettier)
eol_last eol-last
indentation Not yet implemented.
(this behavior is also covered if you're using Prettier)
line_endings linebreak-style
max_line_length coffee/max-len
missing_fat_arrows coffee/no-invalid-this
newlines_after_classes Not yet implemented.
(this behavior is also partially covered if you're using Prettier)
no_backticks coffee/no-backticks
no_debugger no-debugger
no_empty_functions coffee/no-empty-function
no_empty_param_list coffee/empty-func-parens
no_implicit_braces coffee/implicit-object
no_implicit_parens coffee/implicit-call
no_interpolation_in_single_quotes coffee/no-template-curly-in-string
no_nested_string_interpolation coffee/no-nested-interpolation
no_plusplus no-plusplus
no_private_function_fat_arrows coffee/no-private-function-fat-arrows
no_stand_alone_at coffee/shorthand-this
no_tabs no-tabs
no_this coffee/shorthand-this
no_throwing_strings no-throw-literal
no_trailing_semicolons Not yet implemented.
(this behavior is also covered if you're using Prettier)
no_trailing_whitespace no-trailing-spaces
no_unnecessary_double_quotes coffee/no-unnecessary-double-quotes
no_unnecessary_fat_arrows coffee/no-unnecessary-fat-arrow
non_empty_constructor_needs_parens coffee/implicit-call
prefer_english_operator coffee/english-operators
space_operators coffee/space-infix-ops + coffee/space-unary-ops
spacing_after_comma comma-spacing
transform_messes_up_line_numbers Doesn't apply.

If you haven't used ESLint before, you'll just need an .eslintrc config file in your project root - the Installation and Usage sections above cover how to get started. For further information, you may want to look at the official ESLint guide.

How can I help?

See an issue? Report it!

If you have the time and inclination, you can even take it a step further and submit a PR to improve the project.


eslint-plugin-coffee is licensed under the MIT License.


ESLint rules for linting Coffeescript source files







No packages published