-
-
Notifications
You must be signed in to change notification settings - Fork 243
Unable to convert from TSLint to ESLint with tslint-to-eslint-config 2.7.0 #571
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
Comments
My tslint.json looks like this:
|
Update: Even if I create a new app with Angular CLI 11 I get the same error: ng new my-app
cd my-app
ng add @angular-eslint/schematics
ng g @angular-eslint/schematics:convert-tslint-to-eslint --defaults Result: INFO: We are now installing the "tslint-to-eslint-config" package into a tmp directory to aid with the conversion
This may take a minute or two...
There was a critical error when trying to inspect your tslint.json:
env: node: No such file or directory |
@mkurte are you replacing the part which says to put the path to your actual E.g. if your tslint.json were in the current directory you would run npx tslint --print-config ./tslint.json |
I am in the directory where my
That leads to the error. If I type
This is my directory structure:
|
Thanks @mkurte that's useful. What happens if you run: node --version and npm --version ? After a quick search |
I use nvm and have currently installed:
|
I have the same problem with a project containing several applications Update: I have the impression that the problem is with the package tslint-to-eslint-config with the last version (not working with 2.7.0, working with 2.6.0) |
@KyDenZ Yep, thanks a lot. Converting a tslint.json file to .eslintrs.js with tslint-to-eslint-config@2.6.0 works for me too. Should we close that issue here? |
@mkurte We could fix it by fixing the version in the schematics package |
My quick fix was to manually install
|
Yes we can do like that! Thank you |
Thanks for looking into this more and reporting it on typescript-eslint/tslint-to-eslint-config#1159 I was mightily confused why 3 separate people were suddenly reporting installation related issues on the same day, but an issue/change in I'll wait to hear back from Josh on this before changing anything about angular-eslint, and direct people here in the meantime if anyone else runs into it |
Hi folks, sorry for the breakage! 😰 I don't know why tslint-to-eslint-config@2.7.0 would suddenly break things. There are exactly two changes in it that could impact file reading in ng:
For now, I've released a 2.9.0 that reverts those two suspicious changes. So that we can add back those features, is there a self-contained reproduction someone can post here for me to use locally? I'm not totally familiar with ng schematics, but going forward I'd like to add some kind of testing to tslint-to-eslint-config to make sure we don't break angular-eslint again. Edit:
This makes me suspect typescript-eslint/tslint-to-eslint-config#1152 a bit more. FYI @AdamTReineke |
Thanks so much @JoshuaKGoldberg! @mkurte @KyDenZ @gs-scooter would you mind trying the conversion again without any workarounds to verify 2.9.0 is behaving as 2.6.0 used to? @JoshuaKGoldberg the relevant bits of usage are that we dynamically install angular-eslint/packages/schematics/src/convert-tslint-to-eslint/convert-to-eslint-config.ts Line 45 in abf2198
(The version is based on the devDeps version we use:
This allows us to avoid We then leverage the ...in order to use the node API of angular-eslint/packages/schematics/src/convert-tslint-to-eslint/convert-to-eslint-config.ts Line 115 in abf2198
|
@JamesHenry I removed the package from my project, and reinstalled it, it works fine again Thanks ! |
Same here - works like a charm! Thanks a lot for the quick fix! |
Thanks for confirming @KyDenZ @mkurte please could I ask a favour in helping Josh and I get to the bottom of this? Please code you create a simple js file (e.g. repro.js) with the following contents and then run it repro.js
node ./repro.js Do you get a similar error to when you ran the angular-eslint schematic? |
@JamesHenry - I can confirm that the conversion works as expected - Thanks! |
@JamesHenry The normal way with only adding schematics and then converting works now as expected. |
@mkurte Yes understood, but that's only because Josh reverted the recent changes - this isn't really a true solution. So we were hoping you could help us troubleshoot further by ignoring the schematics and running the snippet outlined above: #571 (comment) If it fails in the same way that you were seeing via the schematics previously then we know there is something about your environment and the changes that went into v2.7.0 of tslint-to-eslint-config that do not mix. Please could you give it a try? |
Calling the above script gives me following output:
|
@mkurte those don’t look like single quotes in your string there, is that just a GitHub rendering issue or have you somehow ended up with a different Unicode character in there? |
@JamesHenry the snippet you pasted has the odd quotes 😛. Here's a version with them fixed: repro.js const { dirSync } = require('tmp');
const { execSync } = require('child_process');
const tempDir = dirSync().name;
execSync(`npm i -D tslint-to-eslint-config@2.7.0`, {
cwd: tempDir,
stdio: 'ignore',
});
console.log(
require(require.resolve('tslint-to-eslint-config', {
paths: [tempDir],
}))
); node ./repro.js What would be super duper helpful for me is if someone could post a simple reliable way to trigger the initial error by forcing tslint-to-eslint-config@2.7.0 to run in a project. I'm having a hard time getting that. I tried a similar set of scripts to the suggestion from @mkurte earlier (thanks for this!): ng new my-app
cd my-app
npm i tslint
ng add @angular-eslint/schematics
ng g @angular-eslint/schematics:convert-tslint-to-eslint ...with these manual steps:
No luck. Nothing crashes and the config is successfully created. |
Hey guys, sorry, was on vacation. 🌴 @JamesHenry
I guess you should call the converter with |
@JoshuaKGoldberg Ah sorry must have been because I copied the snippet from slack! Josh, are you on a mac? @mkurte ah ok, sorry I guess you will need to install the tmp dependency first then! Please could you try that and rerun? |
Windows here. |
Ah ok damn, so it's not a simple as being reproducible by OS (that was purely a guess anyway based on the commits you highlighted above) |
FWIW, I also wasn't able to reproduce this (on Windows). Perhaps this is useful if the error message is different based on OS or node versions. There was a critical error when trying to inspect your tslint.json:
Failed to load C:\Users\tdeschryver\dev\throw-aways\my-app\tslint.json: Could not find custom rule directory: node_modules/codelyzer |
@JamesHenry Output is now this (I forgot the quotes around
|
@mkurte Ok thanks then there is sadly no minimal repro for this... I'm really not sure what to suggest at this point - I don't think there is anything more that can be done. @JoshuaKGoldberg this ended up impacting you the most because of the revert you did on the tslint-to-eslint-config side. How would you like to move forward? Chalk this up to a transient/user env fluke and restore the change that was reverted? |
Hmm, I'm not convinced this won't come back again if I revert the revert. The original issue (typescript-eslint/tslint-to-eslint-config#1150) is that tslint-to-eslint-config tries using |
@JamesHenry I think we can close this issue out now. v2.10.1 of tslint-to-eslint-config works better on Windows 👍 |
Hi guys,
in this issue I described that I am not able to run the command to migrate from tslint to eslint.
When I type
ng g @angular-eslint/schematics:convert-tslint-to-eslint PROJECTNAME
and check the defaults I get this error:I'm running this command on a mac, in a multiple projects workspace.
My project is in the root folder, the tslint.json file too. Is there something I am missing?
If I type
npx tslint --print-config {PATH_TO_YOUR_TSLINT_JSON_HERE}
as suggested I get a new tslint.json config, but that one doesn't work too.Many thanks in advance,
Matthias
The text was updated successfully, but these errors were encountered: