Skip to content

[upstream #37] Add option to remove slash after '@' prefix in import paths - #7

Open
embermann wants to merge 2 commits into
mainfrom
upstream-pr-37-no-slash-after-at
Open

[upstream #37] Add option to remove slash after '@' prefix in import paths#7
embermann wants to merge 2 commits into
mainfrom
upstream-pr-37-no-slash-after-at

Conversation

@embermann

Copy link
Copy Markdown
Owner

Imported from upstream PR MelvinVermeer#37 (originally by @Giozar).


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';

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
      }
    ]
  }
}

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