Eslint-plugin-import: `prefer-default-export` fails on Typescript type declaration

Created on 16 Apr 2019  路  5Comments  路  Source: benmosher/eslint-plugin-import

import/prefer-default-export erroneously warns on files that contain a single exported type.

eg:

// foo.ts 

export type Foo = { // `prefer-default-export` fails on this line
 bar: string;
};

Related issue: https://github.com/benmosher/eslint-plugin-import/issues/1164

bug help wanted typescript

All 5 comments

Not sure if this helps or not, but this was addressed once a while back: https://github.com/benmosher/eslint-plugin-import/pull/639 seems like this bug was reintroduced.

That was for flow, this is for typescript.

@ljharb my assumption based off of https://github.com/benmosher/eslint-plugin-import/issues/1164 is that it is broken for both typesript and flow

and if I'm not mistaken, both typescript and flow use the identical

export type insert_type_name_here

syntax, so unless the parser was explicitly looking for // @flow at the top of a file - it should work identically for each.

馃憢 are there any news on this?

Was this page helpful?
0 / 5 - 0 ratings