eslint-plugin-filenames icon indicating copy to clipboard operation
eslint-plugin-filenames copied to clipboard

`filenames/match-exported`: Error when exporting from `index.d.ts` file.

Open garyking opened this issue 5 years ago • 1 comments

When exporting with export default from an index.d.ts file (TypeScript definitions), I get an error. But the error should be ignored for index.d.ts files, just like they are ignored for index.js and index.ts files.

Basically, maybe check for this with a regex for index before the first period, and if that exists, then skip the filenames/match-exported check.

It seems to me that here:

https://github.com/selaux/eslint-plugin-filenames/blob/9cdf56aac1a76fd8cf22bd5bd2e00bb9a700d6d7/lib/common/isIndexFile.js#L2

It can therefore be something like:

return parsed.name.split('.')[0] === 'index';

Or something.

garyking avatar Oct 20 '19 20:10 garyking

As an alternative you can use https://github.com/Igorkowalski94/eslint-plugin-project-structure has the same capabilities + force only folders/files, has a built-in case for name, regex support, ability to inherit the name from the parent (the child inherits the name of the folder in which it is located), folder recursion (You can nest a given folder structure recursively) and eslint realtime errors.

Igorkowalski94 avatar Oct 01 '23 08:10 Igorkowalski94