eslint-plugin-coffee
ESLint plugin for Coffeescript
Last updated 5 months ago by helixbass .
MIT · Original npm · Tarball · package.json
$ cnpm install eslint-plugin-coffee 
SYNC missed versions from official npm registry.

eslint-plugin-coffee

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 :sparkles: :rainbow: :sparkles:

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.

Installation

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

yarn:

# yarn seems to occasionally get confused by Github dependencies, so I'd recommend clearing your lockfile first
rm yarn.lock
# then explicitly install the dependencies and plugin
yarn add --dev github:jashkenas/coffeescript#05d45e9b eslint@^6.0.0 eslint-plugin-coffee

npm:

# npm also seems to occasionally get confused by Github dependencies, so I'd recommend clearing your lockfile first
rm package-lock.json
# then explicitly install the dependencies
npm install --save-dev github:jashkenas/coffeescript#05d45e9b eslint@^6.0.0 eslint-plugin-coffee

Usage

Add eslint-plugin-coffee to the parser field and coffee to the plugins section of your .eslintrc configuration file:

{
  "parser": "eslint-plugin-coffee",
  "plugins": ["coffee"]
}

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": [
    "plugin:coffee/eslint-recommended"
  ]
}

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:
    "plugin:coffee/airbnb",
    // OR for non-React projects:
    "plugin:coffee/airbnb-base"
  ],
  "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"
  }
}

eslint-plugin-import

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": [
    "plugin:coffee/import"
  ],
  "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": [
    "coffee",
    "react",
    "react-native",
    "jsx-a11y"
  ],
  "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": [
    "plugin:coffee/react-recommended"
  ]
}

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

{
  "extends": [
    "plugin:coffee/react-all"
  ]
}

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

{
  "plugins: [
    "coffee",
    "jsx-a11y"
  ],
  "extends": [
    "plugin:jsx-a11y/recommended"
  ]
}

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

{
  "plugins: [
    "coffee",
    "jsx-a11y"
  ],
  "extends": [
    "plugin:jsx-a11y/strict"
  ]
}

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
    "javascript",
    "javascriptreact",
    {
        "language": "coffeescript",
        "autoFix": true
    },
]

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: :heavy_check_mark: = ESLint recommended, :wrench: = fixable

ESLint-included rules

Possible Errors

Name Description
:heavy_check_mark: coffee/no-async-promise-executor disallow using an async function as a Promise executor
coffee/no-await-in-loop disallow await inside of loops
:heavy_check_mark: coffee/no-compare-neg-zero disallow comparing against -0
:heavy_check_mark: coffee/no-cond-assign disallow assignment operators in conditional expressions
no-console disallow the use of console
:heavy_check_mark: coffee/no-constant-condition disallow constant expressions in conditions
:heavy_check_mark: no-control-regex disallow control characters in regular expressions
:heavy_check_mark: no-debugger disallow the use of debugger
:heavy_check_mark: no-dupe-keys disallow duplicate keys in object literals
:heavy_check_mark: no-duplicate-case disallow duplicate case labels
:heavy_check_mark: no-empty disallow empty block statements
:heavy_check_mark: coffee/no-empty-character-class disallow empty character classes in regular expressions
:heavy_check_mark: no-ex-assign disallow reassigning exceptions in catch clauses
:heavy_check_mark: coffee/no-extra-boolean-cast disallow unnecessary boolean casts
:warning: Unlike the ESLint rule, the CoffeeScript version is not fixable
:heavy_check_mark: coffee/no-inner-declarations disallow variable or function "declarations" in nested blocks
:heavy_check_mark: no-invalid-regexp disallow invalid regular expression strings in RegExp constructors
:heavy_check_mark: no-irregular-whitespace disallow irregular whitespace
:heavy_check_mark: no-misleading-character-class disallow characters which are made with multiple code points in character class syntax
:heavy_check_mark: no-obj-calls disallow calling global object properties as functions
:heavy_check_mark: no-prototype-builtins disallow calling some Object.prototype methods directly on objects
:heavy_check_mark: :wrench: coffee/no-regex-spaces disallow multiple spaces in regular expressions
:heavy_check_mark: no-sparse-arrays disallow sparse arrays
coffee/no-template-curly-in-string disallow template literal placeholder syntax in regular strings
:heavy_check_mark: coffee/no-unreachable disallow unreachable code after return, throw, continue, and break statements
:heavy_check_mark: no-unsafe-finally disallow control flow statements in finally blocks
:heavy_check_mark: coffee/no-unsafe-negation disallow negating the left operand of relational operators
:heavy_check_mark: require-atomic-updates disallow assignments that can lead to race conditions due to usage of await or yield
:heavy_check_mark: coffee/use-isnan require calls to isNaN() when checking for NaN
:heavy_check_mark: 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
:warning: 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
:wrench: coffee/dot-location enforce consistent newlines before and after dots
:wrench: 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
:wrench: 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
:warning: Unlike the ESLint rule, the CoffeeScript version is not fixable
coffee/no-empty-function disallow empty functions
:heavy_check_mark: no-empty-pattern disallow empty destructuring patterns
no-eval disallow the use of eval()
no-extend-native disallow extending native types
:wrench: coffee/no-extra-bind disallow unnecessary calls to .bind()
:wrench: no-floating-decimal disallow leading or trailing decimal points in numeric literals
:heavy_check_mark: no-global-assign disallow assignments to native objects or read-only global variables
:warning: Only applies to e.g. ++ operations since CoffeeScript generates declarations on other write references.
:wrench: 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
:wrench: 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
:warning: Currently, this also flags assignments in implicit return statements
no-script-url disallow javascript: urls
:heavy_check_mark: 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()
:heavy_check_mark: no-useless-catch disallow unnecessary catch clauses
no-useless-concat disallow unnecessary concatenation of literals or template literals
:heavy_check_mark: coffee/no-useless-escape disallow unnecessary escape characters
:wrench: 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
:warning: Unlike the ESLint rule, the CoffeeScript version is not fixable
:heavy_check_mark: 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
:heavy_check_mark: no-undef disallow the use of undeclared variables unless mentioned in ###global ### comments
:heavy_check_mark: 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
:warning: Unlike the ESLint rule, the CoffeeScript version is not fixable
:wrench: coffee/array-bracket-spacing enforce consistent spacing inside array brackets
coffee/array-element-newline enforce line breaks after each array element
:warning: Unlike the ESLint rule, the CoffeeScript version is not fixable
coffee/camelcase enforce camelcase naming convention
:wrench: coffee/capitalized-comments enforce or disallow capitalization of the first letter of a comment
:wrench: comma-spacing enforce consistent spacing before and after commas
coffee/comma-style enforce consistent comma style
:warning: Unlike the ESLint rule, the CoffeeScript version is not fixable
:wrench: computed-property-spacing enforce consistent spacing inside computed property brackets
coffee/consistent-this enforce consistent naming when capturing the current execution context
:wrench: eol-last require or disallow newline at the end of files
coffee/function-paren-newline enforce consistent line breaks inside function parentheses
:warning: 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
:warning: Unlike the ESLint rule, the CoffeeScript version is not fixable
:wrench: jsx-quotes enforce the consistent use of either double or single quotes in JSX attributes
:wrench: key-spacing enforce consistent spacing between keys and values in object literal properties
:wrench: coffee/keyword-spacing enforce consistent spacing before and after keywords
line-comment-position enforce position of line comments
:wrench: linebreak-style enforce consistent linebreak style
:wrench: coffee/lines-around-comment require empty lines around comments
coffee/lines-between-class-members require or disallow an empty line between class members
:warning: 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
:wrench: coffee/multiline-comment-style enforce a particular style for multiline comments
new-cap require constructor names to begin with a capital letter
:wrench: 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
:warning: 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
:warning: 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
:wrench: 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
:wrench: no-trailing-spaces disallow trailing whitespace at the end of lines
coffee/no-underscore-dangle disallow dangling underscores in identifiers
:wrench: coffee/no-unneeded-ternary disallow if/else expressions when simpler alternatives exist
:wrench: coffee/no-whitespace-before-property disallow whitespace before properties
:wrench: coffee/object-curly-spacing enforce consistent spacing inside braces
coffee/object-property-newline enforce placing object properties on separate lines
:warning: Unlike the ESLint rule, the CoffeeScript version is not fixable
:wrench: coffee/operator-assignment require or disallow assignment operator shorthand where possible
coffee/operator-linebreak enforce consistent linebreak style for operators
:warning: 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
:warning: Unlike the ESLint rule, the CoffeeScript version is not fixable
:wrench: quote-props require quotes around object literal property names
sort-keys require object keys to be sorted
:wrench: space-in-parens enforce consistent spacing inside parentheses
:wrench: coffee/space-infix-ops require spacing around infix operators
:wrench: coffee/space-unary-ops enforce consistent spacing before or after unary operators
:wrench: coffee/spaced-comment enforce consistent spacing after the # or ### in a comment
:wrench: unicode-bom require or disallow Unicode byte order mark (BOM)
:wrench: coffee/wrap-regex require parenthesis around regex literals

"ECMAScript 6"

Name Description
:wrench: coffee/arrow-spacing enforce consistent spacing before and after the arrow in functions
:heavy_check_mark: constructor-super require super() calls in constructors
:heavy_check_mark: coffee/no-class-assign disallow reassigning class members
:heavy_check_mark: no-dupe-class-members disallow duplicate class members
no-duplicate-imports disallow duplicate module imports
:heavy_check_mark: no-new-symbol disallow new operators with the Symbol object
no-restricted-imports disallow specified modules when loaded by import
:heavy_check_mark: coffee/no-this-before-super disallow this/super before calling super() in constructors
:wrench: coffee/no-useless-computed-key disallow unnecessary computed property keys in objects and classes
coffee/no-useless-constructor disallow unnecessary constructors
:wrench: 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
:warning: Unlike the ESLint rule, the CoffeeScript version is not fixable
coffee/prefer-destructuring require destructuring from arrays and/or objects
:warning: Unlike the ESLint rule, the CoffeeScript version is not fixable
:wrench: 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()
:wrench: coffee/prefer-template require interpolated strings instead of string concatenation
:wrench: coffee/rest-spread-spacing enforce spacing between rest and spread operators and their expressions
:wrench: sort-imports enforce sorted import declarations within modules
symbol-description require symbol descriptions
:wrench: 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 ...
:wrench: 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

eslint-plugin-react rules

Key: :heavy_check_mark: = recommended, :wrench: = 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
:heavy_check_mark: 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
:heavy_check_mark: react/no-children-prop Prevent passing children as props
react/no-danger Prevent usage of dangerous JSX properties
:heavy_check_mark: coffee/no-danger-with-children Prevent problem with children and props.dangerouslySetInnerHTML
:heavy_check_mark: 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
:heavy_check_mark: react/no-direct-mutation-state Prevent direct mutation of this.state
:heavy_check_mark: react/no-find-dom-node Prevent usage of findDOMNode
:heavy_check_mark: 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
:heavy_check_mark: 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
:heavy_check_mark: react/no-string-refs Prevent using string references in ref attribute.
coffee/no-this-in-sfc Prevent using this in stateless functional components
:heavy_check_mark: coffee/no-unescaped-entities Prevent invalid characters from appearing in markup
:heavy_check_mark: :wrench: 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
:heavy_check_mark: coffee/prop-types Prevent missing props validation in a React component definition
:heavy_check_mark: 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
:wrench: react/self-closing-comp Prevent extra closing tags for components without children
coffee/sort-comp Enforce component methods order
:warning: 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
:warning: 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.
:wrench: coffee/jsx-closing-bracket-location Validate closing bracket location in JSX
:wrench: 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
:warning: Unlike the eslint-plugin-react rule, the CoffeeScript version is not fixable
:wrench: react/jsx-curly-spacing Enforce or disallow spaces inside of curly braces in JSX attributes and expressions
:wrench: 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
:warning: Unlike the eslint-plugin-react rule, the CoffeeScript version is not fixable
coffee/jsx-handler-names Enforce event handler naming conventions in JSX
:wrench: coffee/jsx-indent Validate JSX indentation
:wrench: react/jsx-indent-props Validate props indentation in JSX
:heavy_check_mark: 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
:warning: 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
:heavy_check_mark: coffee/jsx-no-comment-textnodes Prevent comments from being inserted as text nodes
:heavy_check_mark: react/jsx-no-duplicate-props Prevent duplicate props in JSX
react/jsx-no-literals Prevent usage of unwrapped JSX strings
:heavy_check_mark: react/jsx-no-target-blank Prevent usage of unsafe target='_blank'
:heavy_check_mark: react/jsx-no-undef Disallow undeclared variables in JSX
coffee/jsx-one-expression-per-line Limit to one expression per line in JSX
:wrench: react/jsx-curly-brace-presence Enforce curly braces or disallow unnecessary curly braces in JSX
:wrench: coffee/jsx-fragments Enforce shorthand or standard form for React fragments
react/jsx-pascal-case Enforce PascalCase for user-defined JSX components
:wrench: 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
:wrench: react/jsx-sort-props Enforce props alphabetical sorting
:wrench: coffee/jsx-tag-spacing Validate whitespace in and around the JSX opening and closing brackets
:heavy_check_mark: react/jsx-uses-react Prevent React to be incorrectly marked as unused
:heavy_check_mark: 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
:warning: 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](https://github.com/benmosher/eslint-plugin-import/blob/master/

Current Tags

  • 0.1.12                                ...           latest (5 months ago)

26 Versions

  • 0.1.12                                ...           5 months ago
  • 0.1.11                                ...           5 months ago
  • 0.1.9                                ...           5 months ago
  • 0.1.7                                ...           5 months ago
  • 0.1.5                                ...           5 months ago
  • 0.1.10                                ...           5 months ago
  • 0.1.8                                ...           5 months ago
  • 0.1.6                                ...           5 months ago
  • 0.1.4                                ...           6 months ago
  • 0.1.3                                ...           6 months ago
  • 0.1.2                                ...           6 months ago
  • 0.1.1                                ...           6 months ago
  • 0.1.0                                ...           6 months ago
  • 0.0.12                                ...           6 months ago
  • 0.0.11                                ...           a year ago
  • 0.0.10                                ...           a year ago
  • 0.0.9                                ...           2 years ago
  • 0.0.8                                ...           2 years ago
  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
  • 0.0.0-development                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 106
Dependencies (16)
Dev Dependencies (10)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |