Incorrect "There should be no empty line within import group"

See original GitHub issue

I get this message a lot, with no rhyme or reason as to why…

For this code:

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/interval';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/filter';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/throttle';

I get this warning: There should be no empty line within import group for line 1.

For this code:

import { getActiveProjectId } from 'uf/app/selectors';
import {
  makeGetAnalysisModuleInfoForProject,
  makeGetScenarioInfoForProject,
} from 'uf/projects/selectors';
import { addAppMessage } from 'uf/appservices/actions';
import { loadProject, updateProjectStatus } from 'uf/projects/actions';

I get the same warning on the `addAppMessage’ line.

For this code:

// Bootstrap babel and sourcemaps.
require('source-map-support/register');
const universalWebpack = require('universal-webpack');

const universalWebpackSettings = require('../webpack/universal-webpack-settings');
const webpackConfig = require('../webpack/webpack.config');

// This tells webpack to not re-apply babel to the server itself as a
// part of server startup.
const babelOptions = universalWebpack.babelRegisterOptions(
  universalWebpackSettings, webpackConfig);

I get the warning on the const webpackConfig = line.

I don’t know if the error message is just on the wrong line, but I can’t figure out how to correct my imports to make this pass.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ljharbcommented, Apr 10, 2018

What happens if you add a blank line between a side-effecting import/require and its neighboring normal import/require?

0reactions
ljharbcommented, Aug 10, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Formatting empty line between third party imports and other ...
I already found out how to sort the imports so that the third party imports are on top. I found my answer.
Read more >
no-multiple-empty-lines - ESLint - Pluggable JavaScript Linter
This rule aims to reduce the scrolling required when reading through your code. It will warn when the maximum amount of empty lines...
Read more >
Imports - checkstyle
imports will be sorted in the groups; groups are separated by single blank line. Notes: "com" package is not mentioned on configuration, because ......
Read more >
Optimize Imports doesn't respect import groups : WEB-43661
The Optimize Imports action should respect the import groups, as delineated by blank lines. Merging/sorting should only occur within a group.
Read more >
Rule: ordered-imports - Palantir Open Source
Requires that import statements be alphabetized and grouped. ... Import sources must be alphabetized within groups, i.e.: import * as foo from “a”; ......
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