-
Notifications
You must be signed in to change notification settings - Fork 12k
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
ng lint is linting node_modules since Beta 28.3 #4350
Comments
I will take a look at this today. |
@maxime1992 - I've been looking into this and have been creating many different files. Unfortunately, I haven't come across an issue. I will address the Would anyone reading this that has this issue be able to paste your |
@delasteve the only thing I can do to help is to give you my repo as I couldn't repro in a smaller project ...
If you want to take a look into the commit I made to upgrade to beta 28.3, here it is : |
@maxime1992 thanks! I'll take a look at it in a bit. |
same problem on beta.30 |
Trying to debug lint.js on angular-cli project: |
That 's normal : https://github.com/palantir/tslint/blob/master/src/linter.ts#L79, the getSourceFiles() method get also all referenced files. |
Maybe angular-cli should have a parameter to use
|
@maxime1992, @sguiheux: With #4437, it will be default use the I checked against your repo, @maxime1992, and it excluded the The "lint": [
{
"project": "src/tsconfig.json",
"exclude": "**/node_modules/**/*"
}
], |
@delasteve Wow thanks ! 🎉 Gonna try that ASAP this week ! 😄 |
@delasteve, thank you for your work. I don't understand your last message though. Have you figured out why node_modules was included when linting in @maxime1992 project? The |
@Almar, from what I can tell, this is what is happening... (tl;dr provided at end)
The reason it was looking into the What I was doing: const program = Linter.createProgram(config.project);
const files: string[] = Linter.getFileNames(program); This returns all the files seeing by the With my changes, if You can read more about the tl;dr: It works how you expect it to work going forward. If you followed the |
@delasteve, thank you for your comprehensive answer. |
I don't get it what the workaround for beta30 is... I tried the following in my This is what I had after the update:
This is what I tried:
and
As mentioned none of it works for me - it always includes stuff from |
@Nasicus it's normal, you have to wait for a new release of angular-cli that contains the fixed discussed here :) |
@Almar, @maxime1992, @Nasicus, @sguiheux, @victornoel: |
@delasteve as soon as we can find a solution to #4584 :) |
@delasteve seems to work good with the default |
👍 Thanks @victornoel |
@delasteve yes fixed too. Thank you |
The only working solution for me was to add files against all linting files
|
Hi @khichar-anil, the above does not work if you actually import from the node_module. |
Umh I might be wrong @kvanlaan but I think it's the whole point here. |
@maxime1992 The point of this thread is to find a way to disable linting for node_modules. If you use "files": "src/**/*.ts" method. It appears to work at first. But if you import a module from the node_module, then ng lint will lint the node_module. |
@kvanlaan the solution is to use exclude like so:
|
If you want to add multiple exclusion rules, you can do it like this:
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OS?
Versions.
Repro steps.
Upgraded to
angular-cli beta.28.3
and running ng lint gives me a high number of lint error that can be found in ...node_modules
.yarn.lock
and reinstall with fresh deps : Didn't changeMention any other details that might be useful.
When I upgraded from beta 26 to beta 28.3, the lint property was added into
angular-cli.json
:@victornoel found something interesting in the code tho :
https://github.com/angular/angular-cli/blob/master/packages/%40angular/cli/tasks/lint.ts#L32
We get
config.project
and store it intoprogram
.Then we get the files from
Linter.getFileNames(program);
and not fromconfig.files
.Thus, this part of our conf is never used :
Why is it working well in a fresh project, I have no idea ...
The text was updated successfully, but these errors were encountered: