Skip to content

chore: Name the default export 'arrayFunctions'#661

Merged
freaktechnik merged 2 commits intofreaktechnik:mainfrom
regseb:named
Mar 8, 2026
Merged

chore: Name the default export 'arrayFunctions'#661
freaktechnik merged 2 commits intofreaktechnik:mainfrom
regseb:named

Conversation

@regseb
Copy link
Copy Markdown
Contributor

@regseb regseb commented Mar 8, 2026

When importing the default export, it's recommended to use the same name as the exported variable (cf. import-x/no-rename-default).

The variable name exported by eslint-plugin-array-func is index. With the following configuration:

import arrayFunc from "eslint-plugin-array-func";

export default [
  {
    plugins: {
      "array-func": arrayFunc
    },
    rules: {
      "array-func/from-map": "error"
    }
  }
];

ESLint reports this error:

Caution: index.js has a default export index. This imports index as arrayFunc. Check if you meant to write import index from 'eslint-plugin-array-func' instead


With this pull request, we will be able to use the name arrayFunc

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4933241) to head (06fe540).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #661   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          466       466           
=========================================
  Hits           466       466           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Owner

@freaktechnik freaktechnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole point of default exports/imports is that naming is decoupled... If I wanted to imply naming I'd use a named export. See also the extensive discussion at import-js/eslint-plugin-import#1041

All of that said I think in this case the naming isn't that relevant in the scope of the module itself, so I think this is fine. Just a word of warning about taking that rule as a general recommendation.

@regseb regseb changed the title chore: Name the default export 'arrayFunc' chore: Name the default export 'arrayFunctions' Mar 8, 2026
@regseb regseb requested a review from freaktechnik March 8, 2026 14:25
@freaktechnik freaktechnik merged commit a41dcf4 into freaktechnik:main Mar 8, 2026
1 check passed
@regseb regseb deleted the named branch March 8, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants