Giter Site home page Giter Site logo

Comments (21)

jgable avatar jgable commented on July 30, 2024

From the README:

By default, this plugin does not include any lint errors from imported files in the output.
You can enable this by adding an imports configuration option:

from grunt-lesslint.

erquhart avatar erquhart commented on July 30, 2024

@jgable I did read that. My understanding is that imported files are not linted by default, but that including an imports array under options will result in such files being linted. I've referenced an imports glob and imported files still are not linted. What am I missing?

from grunt-lesslint.

jgable avatar jgable commented on July 30, 2024

Can you post an example that is not working that you feel should be?

from grunt-lesslint.

erquhart avatar erquhart commented on July 30, 2024
lesslint: {
  options: {
    imports: [
      'src/less/**/*.less',
      'src/pages/**/*.less',
      'src/features/**/*.less',
      'bower_components/charter-ui/src/**/*.less'
    ],
    csslint: {
      csslintrc: '.csslintrc'
    }
  },
  src: [
    'src/pages/*/*.less',
    'src/less/<%= pkg.name %>.less'
  ]
}

from grunt-lesslint.

erquhart avatar erquhart commented on July 30, 2024

Hmm...now that I've pasted it on Github for all the world to see, that doesn't look quite right...

from grunt-lesslint.

erquhart avatar erquhart commented on July 30, 2024

Updated to this, still no dice:

lesslint: {
  options: {
    csslint: {
      csslintrc: '.csslintrc'
    }
  },
  build: {
    src: [
      'src/pages/*/*.less',
      'src/less/<%= pkg.name %>.less'
    ],
    imports: [
      'src/less/**/*.less',
      'src/pages/**/*.less',
      'src/features/**/*.less'
    ]
  }
}

from grunt-lesslint.

jgable avatar jgable commented on July 30, 2024

Imports must be an option in the options hash. And it's kind of odd that you have your src files are also in your imports files.

lesslint: {
  options: {
    csslint: {
      csslintrc: '.csslintrc'
    }
  },
  build: {
    src: [
      'src/pages/*/*.less',
      'src/less/<%= pkg.name %>.less'
    ],
    options: {
    imports: [
      'src/less/**/*.less',
      'src/pages/**/*.less',
      'src/features/**/*.less',
      'bower_components/charter-ui/src/**/*.less'
    ]
    }
  }
}

from grunt-lesslint.

erquhart avatar erquhart commented on July 30, 2024

Still no dice. In this project, each page is a single page app, so we'll have a page.less file that simply imports from subfolders, such as pulling in widgets/my-widget.less. So everything is in the same directory.

I've placed an error in the first included file in one of my primary page less files. If that same error is in the less file itself, it gets flagged. In the import, no flag. However, if I remove code from the import that the calling file depends on, lesslint knows about it. So the files are being read, I'm just not receiving any warnings.

from grunt-lesslint.

jgable avatar jgable commented on July 30, 2024

We have a unit test that covers this specific case, and it is still passing. I'm gonna need to see an example repo setup that reproduces this to dig any deeper.

from grunt-lesslint.

erquhart avatar erquhart commented on July 30, 2024

Alright, I'll put something together and post in a bit. Thanks for taking the time.

from grunt-lesslint.

erquhart avatar erquhart commented on July 30, 2024

Here ya go - just install and run the task:

https://github.com/serquhart/serquhart-test-lesslint

The variable definition from the imported file is observed, but the error is overlooked. All rules are turned off except ie6/7 star hack, and the hack is used in the imported file.

from grunt-lesslint.

jgable avatar jgable commented on July 30, 2024

I see an error:

Running "lesslint:build" (lesslint) task
src/page.less (1)
Property with star prefix found. Checks for the star property hack (targets IE6/7) (star-property-hack)
>> src/page/feature.less [Line 4, Column 3]:     *height: 100px;

>> 1 lint error in 1 file.
Warning: Task "lesslint:build" failed. Use --force to continue.

Aborted due to warnings.

What is your node version, lessc version and all that? Have you run npm update in your project?

from grunt-lesslint.

erquhart avatar erquhart commented on July 30, 2024

Node: 0.10.31
Lesslint: 1.1.10

Yes, updated. Does lesslint require node 0.10.32?

from grunt-lesslint.

jgable avatar jgable commented on July 30, 2024

No, I'm on 0.10.28. I also just tried it on 0.10.31 and it also produced
the same error when running grunt lesslint

I have no idea what is going on for you but it sounds like an environment
issue.

from grunt-lesslint.

erquhart avatar erquhart commented on July 30, 2024

Are there any known issues for lesslint on windows? Running windows 8.1.

from grunt-lesslint.

jgable avatar jgable commented on July 30, 2024

Not sure. Don't have anything running windows to test with.

from grunt-lesslint.

erquhart avatar erquhart commented on July 30, 2024

Interesting development - the error from the imported file does show up in generated reports, but the cli shows 0 errors.

from grunt-lesslint.

erquhart avatar erquhart commented on July 30, 2024

So here's the moral of the story: lesslint's messages.filter creates a stripped version of each less file's path, and all have a preceding slash. Those paths are then compared to the import glob patterns provided in the Gruntfile, and if those patterns don't also have a preceding slash, it's considered a mismatch.

'my/pattern/**/*.less' != '/my/pattern/what/ever.less'

This seems to only affect Windows (go figure). I'll be submitting a PR to fix soon.

from grunt-lesslint.

vianch avatar vianch commented on July 30, 2024

Warning: Task "lesslint:src" failed.� Use --force to continue.

node version > v0.10.33
lesslint version: 1.1.13

from grunt-lesslint.

vianch avatar vianch commented on July 30, 2024

ERROR
in less-lint-task.js

return queue.drain = function() {
        writeToFormatters(options, results);
        if (errorCount === 0) {
          grunt.log.ok("" + fileCount + " " + (grunt.util.pluralize(fileCount, 'file/files')) + " lint free.");
          return done();
        } else {
          grunt.log.writeln();
          grunt.log.error("" + errorCount + " lint " + (grunt.util.pluralize(errorCount, 'error/errors')) + " in " + fileCount + " " + (grunt.util.pluralize(fileCount, 'file/files')) + ".");
          return done(false);
        }
      };

errorCount ever is > 0 when the less have issue
i change the return on else to return done(true) and works

from grunt-lesslint.

erquhart avatar erquhart commented on July 30, 2024

@vianch this is a closed issue, and it's not clear that your problem is associated. I'd suggest opening a new issue.

from grunt-lesslint.

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.