eslint-plugin-no-relative-import-paths
eslint-plugin-no-relative-import-paths copied to clipboard
Add option to remove slash after '@' prefix in import paths
Add option to remove slash after '@' prefix in import paths
Description:
This pull request introduces a new configuration option for the no-relative-import-paths
ESLint rule that allows users to remove the slash (/
) that follows the @
prefix in import paths.
Key Features:
-
New Option:
noSlashAfterAt
(boolean)- When set to
true
, import paths prefixed with@
will omit the slash after the prefix. - Example:
- Input:
import ActionCard from '../../components/ActionCard';
- Output:
import ActionCard from '@components/ActionCard';
- Input:
- When set to
Backward Compatibility:
- The existing functionality remains unchanged if the new option is not used.
- Default behavior ensures that existing users of the plugin are not affected by this change.
Usage:
To activate this feature, add the following to your ESLint configuration:
{
"rules": {
"no-relative-import-paths/no-relative-import-paths": [
"warn",
{
"allowSameFolder": true,
"rootDir": "src",
"prefix": "@",
"noSlashAfterAt": true
}
]
}
}