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

Unable to exclude node_modules for lint #6626

Closed
kvanlaan opened this issue Jun 9, 2017 · 7 comments · Fixed by #6982
Closed

Unable to exclude node_modules for lint #6626

kvanlaan opened this issue Jun 9, 2017 · 7 comments · Fixed by #6982
Assignees
Labels
effort1: easy (hours) P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity3: broken severity5: regression type: bug/fix

Comments

@kvanlaan
Copy link

kvanlaan commented Jun 9, 2017

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

Versions.

Repro steps.

I am trying to exclude my node_modules from linting.
I tried adding the excludes in the lint property in the .angular-cli.json file.
However it did not work.

"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "/node_modules//"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "/node_modules//
"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "/node_modules//*"
}

The log given by the failure.

Desired functionality.

To exclude the node_modules from linting.

Mention any other details that might be useful.

I tried a few different formats for the exclude, none of them worked:

"exclude": "/node_modules/"
"exclude": "/node_modules/"
"exclude": "
/node_modules/"

@Brocco Brocco added P5 The team acknowledges the request but does not plan to address it, it remains open for discussion severity3: broken labels Jun 13, 2017
@filipesilva
Copy link
Contributor

@kvanlaan how do you verify it is not being excluded? Is there a specific package that's giving you linting errors?

@filipesilva filipesilva added the needs: more info Reporter must clarify the issue label Jun 21, 2017
@Wykks
Copy link
Contributor

Wykks commented Jun 22, 2017

Same issue here. Exclude doesn't seems to work.
Reproduced with https://github.com/DmitryEfimenko/ngx-messages

$ ng lint
Failed to load [...]/proj/node_modules/ngx-messages/tslint.json: Could not find custom rule directory: node_modules/codelyzer

Edit: okay after looking at the code (and glob doc), I figured that this conf works:
"exclude": **/node_modules/**
But it doesn't feels right

@Perezmarc
Copy link

Perezmarc commented Jun 23, 2017

Hi, for me, Wykks answer didn't work.
This is the right answer for me: #5063 (comment)

As it is said, we should exclude like so:

"lint": [
    {
      "project": "src/tsconfig.app.json",
      "exclude": "**/node_modules/**/*"
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": "**/node_modules/**/*"
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": "**/node_modules/**/*"
    }
  ],

@filipesilva filipesilva added effort1: easy (hours) P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity5: regression type: bug/fix and removed needs: more info Reporter must clarify the issue P5 The team acknowledges the request but does not plan to address it, it remains open for discussion labels Jun 28, 2017
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Jul 14, 2017
Brocco pushed a commit to Brocco/angular-cli that referenced this issue Jul 20, 2017
@britvik
Copy link
Contributor

britvik commented Jan 8, 2018

If anyone has a problem with exclude option not working AT ALL. Make sure you don't have any folders/files starting with a DOT (".") in your project path.
Angular-cli uses minimatch lib to match paths and it doesn't match anything if there is a folder starting with a dot (this can be overriden by { dot: true } option in minimatch, but we can't provide such option to cli).
I hope my few hours of debugging and hair pulling will help at least one person in this world to avoid such dreadful experience :).

@filipesilva
Copy link
Contributor

@brinkt that sounds like a bug on our side. Would you be willing to submit a PR to add always { dot: true } to the minimatch options for lint?

@britvik
Copy link
Contributor

britvik commented Jan 15, 2018

@filipesilva Submitted a pull request: #9215

dond2clouds pushed a commit to d2clouds/speedray-cli that referenced this issue Apr 23, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort1: easy (hours) P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity3: broken severity5: regression type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants