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.

[import/newline-after-import] false positive with typescript import = require

See original GitHub issue

When using import/newline-after-import with typescript import = require(..) I get a false positive requiring me to put a newline in the middle of the imports.

import foo from "foo";
import bar = require("bar");
import baz from "baz";

Expected results

No errors

Actual results

1:1 error Expected 1 empty line after import statement not followed by another import import/newline-after-import

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
sidoruk-svcommented, Mar 13, 2020

Also got into valid for typescript case:

import {API} from './some/exports';
import InnerType = API.some.comfort.namespaces.InnerType;

Should be: VALID:

import {API} from './some/exports';
import InnerType = API.some.comfort.namespaces.InnerType;

const i = 1;

INVALID:

import {API} from './some/exports';
import InnerType = API.some.comfort.namespaces.InnerType;
const i = 1;

INVALID:

import {API} from './some/exports';

import InnerType = API.some.comfort.namespaces.InnerType;

INVALID:

import {API} from './some/exports';

import InnerType = API.some.comfort.namespaces.InnerType;
const i = 1;
0reactions
ljharbcommented, May 8, 2020

(I’d still strongly recommend everyone migrate away from TS-specific syntax; import X from 'Y' is what should be used in that case, with synthetic imports and esModuleInterop enabled, as tsc --init enables)

Read more comments on GitHub >

github_iconTop Results From Across the Web

[import/newline-after-import] false positive with ... - GitHub
When using import/newline-after-import with typescript import = require(..) I get a false positive requiring me to put a newline in the ...
Read more >
Typescript + Eslint false positive for imports + `declare global`
1 Answer 1 ... Turn off "no-undef": "off"(disallow the use of undeclared variables unless mentioned in /*global */ comments) and to be handled...
Read more >
@01taylop/eslint-plugin-import - NPM Package Overview - Socket
Start using Socket to analyze @01taylop/eslint-plugin-import and its 13 ... [ export ]/TypeScript: false positive for typescript namespace merging ([#1964], ...
Read more >
node_modules/eslint-plugin-import/CHANGELOG.md - GitLab
TypeScript : [ import/named ]: avoid requiring typescript when not using TS ... prefer-default-export : fix false positive with type export ...
Read more >
eslint-config-torchbox - npm
Shareable ESLint config following Torchbox's code style. ... eslint-config-prettier@8.5.0 - eslint-plugin-import@2.25.4 ...
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