question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`indent`: `outerIIFEBody` option not using a multiplier, warning on non-IIFEs?

See original GitHub issue

What version of ESLint are you using? v3.0.0

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

eslint --rule indent:[2,2,{outerIIFEBody:1}] file.js

What did you do? Please include the actual source code causing the issue. https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/test/test-base.js

import fs from 'fs';
import path from 'path';
import test from 'tape';

import index from '../';

const files = { index };

fs.readdirSync(path.join(__dirname, '../rules')).forEach(name => {
  files[name] = require(`../rules/${name}`); // eslint-disable-line global-require
});

Object.keys(files).forEach(name => {
  const config = files[name];

  test(`${name}: does not reference react`, t => {
    t.plan(2);

    // scan plugins for react and fail if it is found
    const hasReactPlugin = Object.prototype.hasOwnProperty.call(config, 'plugins') &&
      config.plugins.indexOf('react') !== -1;
    t.notOk(hasReactPlugin, 'there is no react plugin');

    // scan rules for react/ and fail if any exist
    const reactRuleIds = Object.keys(config.rules)
      .filter(ruleId => ruleId.indexOf('react/') === 0);
    t.deepEquals(reactRuleIds, [], 'there are no react/ rules');
  });
});

What did you expect to happen? No warnings.

What actually happened? Please include the actual, raw output from ESLint.

$PWD/packages/eslint-config-airbnb-base/test/test-base.js
  10:3  error  Expected indentation of 1 space character but found 2  indent
  14:3  error  Expected indentation of 1 space character but found 2  indent
  16:3  error  Expected indentation of 1 space character but found 2  indent

There are two problems here:

  1. the warned lines are not actually file-level IIFEs - the file doesn’t have an IIFE at all.
  2. outerIIFEBody is set to 1 - this should be a multiplier of 1 on the indentation config of “2 spaces” - the errors indicate that it wants “1 space” which should never be required when the base indent is “2”.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:16 (13 by maintainers)

github_iconTop GitHub Comments

4reactions
albertocommented, Jul 4, 2016

@nzakas should we also cover the cases @wojdyr mentioned?

1reaction
nzakascommented, Jul 4, 2016

@platinumazure let’s keep the scope of this issue narrow - there’s no need to talk about future long-term possibilities in this context as it’s confusing for everyone involved.

This option should definitely act like the others and be a multiplier. I’ll take a look and see if it’s something that can be fixed easily.

Read more comments on GitHub >

github_iconTop Results From Across the Web

indent - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Cannot fix eslint rule on indenting case statements in switch ...
I just saw that you made an edit ("EDIT 2") to your answer. Anyway I wanted to advise you exactly that option: "indent":...
Read more >
EditorConfig properties for C#: Tabs, Indents, Alignment
This page lists custom ReSharper EditorConfig properties that you can use to configure formatting preferences in C#, specifically, ...
Read more >
indent | typescript-eslint
This rule extends the base eslint/indent rule. It adds support for TypeScript nodes. How to Use​ .eslintrc.cjs. module.
Read more >
toml/indent | eslint-plugin-toml
Use tabs for indentation. Second Option. subTables ... The multiplier of indentation for sub-tables. Default is 0 . keyValuePairs ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found