Skip to content

Detect TypeScript rules defined with variable export #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bmish opened this issue Jul 7, 2022 · 3 comments · Fixed by #267
Closed

Detect TypeScript rules defined with variable export #262

bmish opened this issue Jul 7, 2022 · 3 comments · Fixed by #267
Labels

Comments

@bmish
Copy link
Member

bmish commented Jul 7, 2022

We detect many TypeScript rules already but we're failing to detect those using the TypeScript-specific export = rule syntax:

import {Rule} from 'eslint';

const rule: Rule.RuleModule = {
  meta: {},

  create(context): Rule.RuleListener {
    const source = context.getSourceCode();
    // ...
  }
};

export = rule;

Example: https://github.com/43081j/eslint-plugin-lit/blob/master/src/rules/no-duplicate-template-bindings.ts

@bmish bmish added the bug label Jul 7, 2022
@aladdin-add
Copy link
Contributor

but export = rule is not an esm(?). I'd suggest the users move to the standard esm(e.g. export default rule).

@bmish bmish changed the title Detect ESM/TypeScript rules defined with variable export Detect TypeScript rules defined with variable export Jul 8, 2022
@bmish
Copy link
Member Author

bmish commented Jul 8, 2022

Good point, updated title to reflect that this is only a TypeScript (not ESM) syntax, I still think we could support it.

https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require

@aladdin-add
Copy link
Contributor

ok, let's do it! 👍

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

Successfully merging a pull request may close this issue.

2 participants