Tools: Tell linter to ignore files

Created on 30 May 2016  路  21Comments  路  Source: Polymer/tools

polymer lint is linting everything in my bower_components dir so my project always fails because app-layout has some linting issues. Is there a way to tell the linter to ignore that directory?

cli Medium Available Enhancement wontfix

Most helpful comment

Did this ever get resolved? I'm getting linting errors in my bower_components directory. Might just not be using it correctly.

$ polymer lint
/bower_components/app-layout/app-header/app-header.html:318:3
    Property isAttached not found in 'properties' for element 'app-header'
/bower_components/app-layout/app-header-layout/app-header-layout.html:125:3
    Property isAttached not found in 'properties' for element 'app-header-layout'

All 21 comments

I noticed this too when adding my unused deps linter.

Seems to be that we should be passing a filter option here. According to hydrolysis' API docs, this should be a function. Maybe a function that uses some array of globs we can pass in.

I linted the Polymer shop and all of the files that rent Polymer elements show up as errors. I'd like to be able to ignore these in the linting.

i also just tried the shop app, out of curiosity for how it can help me.
Right now very little !!! :)
https://github.com/Polymer/shop/issues/42

I get a ton of lining errors. It does not give a summary, but i estimate about 50 errors.

For example a simple one in https://github.com/Polymer/shop/blob/master/src/shop-app.html#L220:

x-MacBook-Pro:shop apple$ polymer lint
/src/shop-app.html:220:5
    Property 'routeData' bound to attribute 'data' not found in 'properties' for element 'shop-app'
/src/shop-app.html:220:5
    Property 'subroute' bound to attribute 'tail' not found in 'properties' for element 'shop-app'

@garlicnation
Is this because the "app-route" component does not have the right comments in its code to support the linter, and so hence its expected that this will be common for a while, until many Polymer team elements are modified to support what the linter expects ?

@joeblew99 Actually in this specific case it is an issue in the shop-app.html itself, because the properties mentioned really aren't defined in the elements properties object.

Generally if the file mentioned by the linter is your own file, you can also fix it yourself. If the file mentioned is in your (bower) dependencies, it is the owner of that element that would have to fix it, even though I'm sure they are happy about PRs :)

Did this ever get resolved? I'm getting linting errors in my bower_components directory. Might just not be using it correctly.

$ polymer lint
/bower_components/app-layout/app-header/app-header.html:318:3
    Property isAttached not found in 'properties' for element 'app-header'
/bower_components/app-layout/app-header-layout/app-header-layout.html:125:3
    Property isAttached not found in 'properties' for element 'app-header-layout'

Same here. How can we exclude some directories?

This feature will be really appreciated, keep up with the good work!

you can have a workaround e.g polymer lint -i ./src/* I guess

Any progress/news ?!
I need to exclude some file inpolymer lint

Update: Looks like once #948 is merged we should have this capability. filesToIgnore in your polymer.json should allow you to pass an array of globs strings that will be ignored by the linter.

On polymer-cli 1.7.2, adding a filesToIgnore array still seems to have no effect.

@silentflight15 How are you adding the array? Can you show a snippet of your polymer.json? I don't believe anyone has hooked it up to the CLI yet

@stramel Just at the root like so:

{
    // other stuff,
    "filesToIgnore": ["build/**/*"]
}

I tried a bunch of other strings and also tried adding filesToIgnore to the lint object because I wasn't positive where it is expected, but no luck.

@silentflight15 It should be on the lint property.

{
  "lint": {
    "filesToIgnore": ["build/**/*"]
  }
}

I haven't checked in for a while and am no longer working on polymer related stuff, so there _may_ have been a regression.

Any new about this?

@alvardsoler It _should_ be working

For some reason, if I have components that are not in a /src dir, the linter would also analyze the node_modules folder, and throw a JS heap error...
V1.7.7, V1.8

I believe there's been a regression as of polymer-cli v1.8.0. For example, I run polymer lint --input public/scripts/foo and with a polymer.json as below, it still lints bar.html.

{
  "lint": {
    "rules": ["polymer-1"],
    "filesToIgnore": ["public/scripts/foo/bar.html"]
  }
}

Are others having the same problem or am I missing something here?

Just confirming that this does work in some aspects (can't confirm all of the above cases) but does work in cases such as

"filesToIgnore": ["**/*.html"]

Tested on version 1.9.11

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings