Git Product home page Git Product logo

Comments (10)

sds avatar sds commented on July 21, 2024

Hey @Kamilius,

The glob you wrote will only exclude files in the root directory. You need to write:

linters:
  UnnecessaryStringOutput:
    exclude:
      - '**/*.js.haml'

...in order to exclude all .js.haml files in any directory. (similar to the eslint and rubocop projects)

from haml-lint.

Kamilius avatar Kamilius commented on July 21, 2024

@sds, thanks a lot! :)

from haml-lint.

gajmar avatar gajmar commented on July 21, 2024

@sds
Hi! I copied your snippet to .haml-lint.yml and exclusion doesn't work, but when when I add --exclude "*/.js.haml" to command everything works great.
Could you know what can be the reason?
Thanks

from haml-lint.

sds avatar sds commented on July 21, 2024

Hey @gajmar,

The example I provided will only exclude UnnecessaryStringOutput lints. Specifying the --exclude flag will exclude all lints for the files matched by the exclude pattern.

Are you sure the lints you are seeing are UnnecessaryStringOutput lints? If you want to exclude all lints, you should add the following to your .haml-lint.yml file (and make sure you're running haml-lint in the same directory as that configuration file):

exclude:
  - '**/*.js.haml'

from haml-lint.

gajmar avatar gajmar commented on July 21, 2024

Hey, @sds
yes it is definitely UnnecessaryStringOutput lint.

app/views/users/tracked/videos/create.js.haml:1 [W] UnnecessaryStringOutput: `= "..."` should be rewritten as `...`

I am running haml-linter like this:

bundle exec haml-lint -c .haml-lint.yml app/views/

and in config I have:

UnnecessaryStringOutput:
    enabled: true
    exclude:
      - '**/*.js.haml'

and I also tried exclude globally for all linters:

linters:
  exclude:
    - '**/*.js.haml'

and its also doesn't work .
Big thanks for your help!

from haml-lint.

sds avatar sds commented on July 21, 2024

Hey @gajmar,

Unless you're leaving something out, both your configs look incorrect. The first should look like:

linters:
  UnnecessaryStringOutput:
    enabled: true
    exclude:
      - '**/*.js.haml'

The second should not be nested under linters, e.g. it should just be:

exclude:
  - '**/*.js.haml'

Trying both of these locally works for me.

from haml-lint.

stephen-puiszis avatar stephen-puiszis commented on July 21, 2024

Hey @sds,
I cannot get the global exclusion in my .haml-lint.yml configuration file to work for a Rails 4.2 app. My output continues to lint directories and file globs I want to exclude. I have tested a dozen different file-path variants and haven't found anything that has worked. However, I am able to exclude these directories via the CLI.

.haml-lint.yml

# .haml-lint.yml
# Default application configuration that all configurations inherit from.
#
# This is an opinionated list of which hooks are valuable to run and what their
# out of the box settings should be.

# Whether to ignore frontmatter at the beginning of HAML documents for
# frameworks such as Jekyll/Middleman
skip_frontmatter: true

exclude:
  - 'app/views/kaminari/**/*'
  - 'app/views/spree/**/*' 

linters:
  AltText:
    enabled: false

# rest of file omitted 

Relevant parts from Gemfile.lock

   haml (4.0.7)
      tilt
    haml-lint (0.13.0)
      haml (~> 4.0)
      rubocop (>= 0.25.0)
      sysexits (~> 1.1)
    haml-rails (0.9.0)
      actionpack (>= 4.0.1)
      activesupport (>= 4.0.1)
      haml (>= 4.0.6, < 5.0)
      html2haml (>= 1.0.1)
      railties (>= 4.0.1)

from haml-lint.

sds avatar sds commented on July 21, 2024

Hey @stephen-puiszis, try switching the name of the gem from haml-lint (with a hyphen) to haml_lint (with an underscore). We changed the name to follow proper Rubygems naming conventions, so you're currently working with an older version.

If that doesn't work, I'm not sure what else to offer, as I can successfully exclude files with exclude when I test locally (using the same glob patterns as you have above).

from haml-lint.

stephen-puiszis avatar stephen-puiszis commented on July 21, 2024

@sds yup that fixed it. I didn't notice it was underscored, I guess I just assumed b/c the bundle didn't raise any errors and the repo was named haml-lint that I had the right one :). Thanks for the help!

from haml-lint.

seanlerner avatar seanlerner commented on July 21, 2024

Just in case someone else comes across this issue, note that your options must be lowercase, so:

linters:
  LineLength:
    exclude:
      - 'app/views/games/show.html.haml'

works (exclude is lowercase), but:

linters:
  LineLength:
    Exclude:
      - 'app/views/games/show.html.haml'

doesn't work (Exclude is capitalized).

from haml-lint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.