`indent`: `outerIIFEBody` option not using a multiplier, warning on non-IIFEs?
See original GitHub issueWhat 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:
- the warned lines are not actually file-level IIFEs - the file doesn’t have an IIFE at all.
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:
- Created 7 years ago
- Reactions:1
- Comments:16 (13 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nzakas should we also cover the cases @wojdyr mentioned?
@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.