-
Notifications
You must be signed in to change notification settings - Fork 198
import-name rule renaming map is not working #881
Comments
Is your config extending anything else? I had the same issue but I found that the [email protected] I was using depended on [email protected]. The docs for
But perhaps they had a bug in version 5.2.1. Anyway, to test, I installed version [email protected] and did I got some deprecated rules as expected from jumping up a major version, but the If you have the above issue, and if you want to hack it (in a reproducible way) to force it to resolve to 6.2.0, you can do the following: Note that I have tried yarn resolutions and npm shrinkwrap. yarn resolutions didn't work for me in a yarn workspaces + lerna monorepo for some reason. I didn't want to use either of those solutions anyway because npm doesn't support resolutions and yarn doesn't support shrinkwrap. npm install tslint-microsoft-contrib # get 6.2.0 Now you can add You can see it in the output of {
"rulesDirectory": ["tslint-microsoft-contrib"],
"extends": ["tslint-config-airbnb"]
} becomes "rulesDirectory": [
".../node_modules/tslint-consistent-codestyle/rules",
".../node_modules/tslint-eslint-rules/dist/rules",
".../node_modules/tslint-config-airbnb/node_modules/tslint-microsoft-contrib",
".../node_modules/tslint-microsoft-contrib"
] That doesn't work since If you did: {
"extends": ["tslint-microsoft-contrib", "tslint-config-airbnb"]
} Note that the opposite order, you get the right thing "rulesDirectory": [
".../node_modules/tslint-microsoft-contrib",
".../node_modules/tslint-consistent-codestyle/rules",
".../node_modules/tslint-eslint-rules/dist/rules",
".../node_modules/tslint-config-airbnb/node_modules/tslint-microsoft-contrib"
] The problem with this method is that it extends all of the base rules. I don't want any So the final workaround is this: {
"extends": ["./tslint-microsoft-contrib.json", "tslint-config-airbnb"]
} In
Now you will get the correct You can then turn off deprecated rules and turn on the new ones to stop tslint from complaining: {
"rules": {
"no-function-constructor-with-string-args": false,
"function-constructor": true,
"no-increment-decrement": false,
"increment-decrement": true
}
} |
@dosentmatter Well, thanks for your feedback. But the config I specified in the bug report is the actual config that makes this bug reproducible. I don't extend in my |
@alexeychikk, hmm, so the PR #882 that references this issue was created by me. I used the latest version 6.2.0, as you did. I fixed a few bugs and issues. I'm not exactly sure they apply to your situation because, in your findings, you said it replaces with A way to check is to open Also in the following image, notice that Here are the ones relevant to you:
The first Note that there is also a bug where |
@dosentmatter Thanks. After experimenting for a while I figured it out. This works for me well: "rules": {
"import-name": [
true,
null,
{},
null,
{ "ignoreExternalModule": false, "case": "any-case" }
],
} |
@alexeychikk, no problem. Glad I could help. Remember to update it when the bug gets fixed! |
💀 It's time! 💀TSLint is deprecated and no longer accepting pull requests other than security fixes. See #876. ☠️ 👋 It was a pleasure open sourcing with you! |
Bug Report
tslint-microsoft-contrib
version: 6.2.0TypeScript code being linted
with
tslint.json
configuration:Actual behavior
import React
is being replaced withimport react
on save.Expected behavior
Nothing should happen because I defined
{ "react": "React" }
in my tslint.json.The text was updated successfully, but these errors were encountered: