From 3efe10d42eb14c739128090b9647137301e812fd Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 17 Apr 2016 12:48:54 -0700 Subject: [PATCH] [eslint config] [breaking] disallow empty methods --- packages/eslint-config-airbnb/rules/best-practices.js | 8 ++++++++ packages/eslint-config-airbnb/test/test-react-order.js | 1 + 2 files changed, 9 insertions(+) diff --git a/packages/eslint-config-airbnb/rules/best-practices.js b/packages/eslint-config-airbnb/rules/best-practices.js index eaf6ddbb..ea1b4366 100644 --- a/packages/eslint-config-airbnb/rules/best-practices.js +++ b/packages/eslint-config-airbnb/rules/best-practices.js @@ -37,6 +37,14 @@ module.exports = { 'no-div-regex': 0, // disallow else after a return in an if 'no-else-return': 2, + // disallow empty functions, except for standalone funcs/arrows + // http://eslint.org/docs/rules/no-empty-function + 'no-empty-function': [2, { + 'allow': [ + 'functions', + 'arrowFunctions', + ] + }], // disallow Unnecessary Labels // http://eslint.org/docs/rules/no-extra-label 'no-extra-label': 2, diff --git a/packages/eslint-config-airbnb/test/test-react-order.js b/packages/eslint-config-airbnb/test/test-react-order.js index 1e6dd660..e3e4cfbd 100644 --- a/packages/eslint-config-airbnb/test/test-react-order.js +++ b/packages/eslint-config-airbnb/test/test-react-order.js @@ -23,6 +23,7 @@ function wrapComponent(body) { return ` import React from 'react'; export default class MyComponent extends React.Component { +/* eslint no-empty-function: 0 */ ${body} } `;