Skip to content

Bug: Wrong path resolutions if used to lint several projects #50

Closed
@avasuro

Description

@avasuro

Bug

Current Behavior

If this library used to lint several projects at once - only first project paths are taken into account (and they are also exposed to other projects)

Desired Behavior

Each project paths should be resolved according to this project tsconfig.json file.

Requirements to reproduce this bug

  1. There should be at least two folders with "subprojects" inside root folder, for example "app1" and "app2"
  2. Each subproject folder should contain it's own tsconfig.json and .eslintrc.js file
  3. Each .eslintrc.js file should contain it's own settings for import/resolver, which points to current subproject folder (or tsconfig.json file), e.g.:
    settings: {
        'import/resolver': {
            typescript: {
                directory: __dirname
            }
        }
    }
  1. Run eslint . --ext .ts from the root folder to validate all subrojects at once

Suggested Solution

Currently in source code if this library function initMappers invokes only once at the very start. To fix this bug this function should be invoked again if new set of options is passed (this situation will happen if there is several eslintrc configs with different import/resolver settings.

Workarounds

There is two possible workarounds, which can be used till this bug will be fixed:

  1. Run eslint for each project separately
  2. Use single .eslintrc file at the root folder which will contain references to tsconfig.json files in each project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions