loopback-next
loopback-next copied to clipboard
ESLint: naming convention errors on certain third-party imports
Describe the bug
Late last year (2023), the eslint naming convention plugin added support for checking imports.
When using the recommended eslint config '@loopback/eslint-config', this will cause this check to fall back to the default which is 'camelCase'. Due to this, errors are now being reported on some imports provided by third-party libraries.
Examples:
import EventEmitter2 from 'eventemitter2';
import IORedis from 'ioredis';
1:8 error Import name `EventEmitter2` must match one of the following formats: camelCase @typescript-eslint/naming-convention
2:8 error Import name `IORedis` must match one of the following formats: camelCase @typescript-eslint/naming-convention
Appending a new rule selector to the naming convention rule for imports, to include PascalCase, will alleviate the issue:
{
selector: 'import',
format: ['camelCase', 'PascalCase']
}
Logs
No response
Additional information
No response
Reproduction
no