Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

no-relative-imports does nothing on --fix flag #896

Closed
sandric opened this issue Jan 2, 2020 · 2 comments
Closed

no-relative-imports does nothing on --fix flag #896

sandric opened this issue Jan 2, 2020 · 2 comments

Comments

@sandric
Copy link

sandric commented Jan 2, 2020

Bug Report

  • tslint-microsoft-contrib version: 6.2.0
  • TSLint version: 5.11.0
  • TypeScript version: 3.1.6
  • Running TSLint via: CLI / VSCode

TypeScript code being linted

import TestIndexPage from "./test-index-page";

with tslint.json configuration:

{
  "extends": ["tslint:latest", "tslint-react", "tslint-config-prettier"],
  "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
  "rules": {
    "no-unused-variable": true,
    "no-submodule-imports": false,
    "no-implicit-dependencies": false,
    "jsx-no-lambda": false,
    "no-relative-imports": true
  }
}

Actual behavior

It shows warning that local import is used - but running from CLI with --fix --force - nothing happens, even though baseUrl is set in tsconfig.json :

node_modules/tslint/bin/tslint src/test-file.tsx --fix --force

no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
Warning: The 'no-unused-variable' rule requires type information.

ERROR: src/test-file.tsx[1, 1]: Imported module is being loaded from a relative path. Please use an absolute path: import TestIndexPage from "./test-index-page";

Expected behavior

After funning tslint with --fix flag - file should be updated with fullpath in import statement.

@HamletDRC
Copy link
Member

This project is in maintenance mode because eslint is replacing tslint.

@IllusionMH
Copy link
Contributor

☠️ It's time! ☠️

Per #876, this repository is no longer accepting feature pull requests. TSLint is being deprecated and we recommend you switch to https://typescript-eslint.io.

Thanks for open sourcing with us, everyone!


This is not a bug because it works as expected: this rule never had fixer implemented. This is because depending on your configuration of baseDir, path etc., project conventions there might be several options how to set path to file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants