Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Flow annotations and no-undef + no-unused-vars #625

Closed
pnevyk opened this issue Jun 1, 2018 · 2 comments
Closed

Flow annotations and no-undef + no-unused-vars #625

pnevyk opened this issue Jun 1, 2018 · 2 comments

Comments

@pnevyk
Copy link

pnevyk commented Jun 1, 2018

Hi,

I'd like to ask what is the status of handling no-undef and no-unused-vars of Flow type annotations directly in babel-eslint. If I understand it correctly, you started to use new eslint's scope API in lib/analyze-scope.js to implement a custom Referencer which should address these issues (or at least no-undef).

With babel-eslint@8.2.3, I identified these snippets as violating no-undef rule:

opaque type Foo = number;
type Foo = { foo<T>(x: T): T };
declare type Foo = number;
declare interface IFoo {}

And these are causing no-unused-vars error:

declare class Foo {}
declare module Foo {}
declare var Foo: number;
declare function foo(): void;

If babel-eslint implements these, corresponding rules in eslint-plugin-flowtype can be deprecated and removed eventually, as mentioned in this issue.

Is this a possibility or I am missing something?

@pascalduez
Copy link

I'm having a similar issue:

// @flow

import type { Foo } from './foo';

type Whatever<F = Foo> = {
  foo: F,
};
error  'Foo' is defined but never used  no-unused-vars

@kaicataldo
Copy link
Member

Thank you for the issue. Now that @babel/eslint-parser has been released, we are making this repository read-only. If this is a change you would still like to advocate for, please reopen this in the babel/babel monorepo.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants