Comments (10)
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.
@sds, thanks a lot! :)
from haml-lint.
@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.
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.
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.
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.
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.
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.
@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.
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)
- False positive Rails/HttpStatus HOT 2
- Failing spec on main branch HOT 2
- Add support to Haml 6.2
- `haml-lint:disable` is ignored when line breaks on commas are present
- Add `-s`/`--stdin` option support HOT 2
- Allow Haml 6.3 HOT 3
- Haml 6.2 actions are not listed among required checks HOT 1
- Failing spec on main (local environment, up to date rubocop)
- Issue with Rubocop `Layout/IndentationConsistency` interaction with haml comment blocks HOT 2
- Version 0.53.0 has not been pushed to Rubygems HOT 1
- RuboCop: Lint/Syntax: unexpected token tSYMBOL and kEND HOT 5
- 0.54.0: Too many files open HOT 4
- Layout/ArgumentAlignment - False positive? HOT 2
- Feature Suggestion: require strict locals
- Possible false positives with Rails/FindEach
- Lint/Syntax: unexpected token kDO_BLOCK | Lint/Syntax: unexpected token kEND HOT 1
- False positive with Layout/SpaceInsideParens for multi-line attributes HOT 7
- Allow multiple reporters?
- False positive on the `UnnecessaryStringOutput` cop HOT 1
- Style/IfUnlessModifier - Potential False Positive as of 0.46.0 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haml-lint.