Skip to content

Doesn't work for imports in the same directory #133

@nolawnchairs

Description

@nolawnchairs

When importing from the same directory, this rule doesn't get applied. It considers this valid:

import { Foo } from './foo'

Expectation:

import { Foo } from '@/path/to/foo'

All my valid imports have the error: Unexpected subpath import via alias

Real world example:

Unexpected subpath import via alias '@lib/constants/a2.constants'. Use './constants/a2.constants' instead

Configuration in .eslintrc.js:

'@dword-design/import-alias/prefer-alias': [
  'error',
  {
    'alias': {
      '@lib': './src/'
    }
  }
],

Is there a way to get this to work with . and not just ..?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions