brandongregoryscott / eslint-plugin-collation

ESLint plugin for making your code easier to read, with autofix and TypeScript support
https://eslint-plugin-collation.brandonscott.me
Apache License 2.0
4 stars 0 forks source link

Rule: `consistent-default-import-export` #53

Closed brandongregoryscott closed 1 year ago

brandongregoryscott commented 2 years ago

Inspired by these eslint-plugin-import rules:

import/no-named-as-default import/no-anonymous-default-export.

Implement a rule that ensures default imports/exports are named consistently, i.e.

// noop.ts
export default function noop() {};

// component.tsx
import NOOP from './noop'

would be transformed to:

import noop from './noop'
brandongregoryscott commented 1 year ago

Not sure this is entirely possible without using TS Parser Services to resolve imports, which can be really slow. I'll split this into two rules: #70 default-export-matches-filename and #71 default-import-matches-module which provides a simpler way to be more consistent around default import/export naming conventions