Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed

Comments

@avasuro
Copy link
Contributor

avasuro commented Jul 8, 2020

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment