eslint-plugin-filenames
eslint-plugin-filenames copied to clipboard
`filenames/match-exported`: Error when exporting from `index.d.ts` file.
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.
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.