Giter Site home page Giter Site logo

Comments (10)

Arcanemagus avatar Arcanemagus commented on May 30, 2024

This is due to us using the Node API's lint() call on the raw text (to support linting on the fly), instead of a file.

@davidtheclark is there anyway to specify the filename of a block of code so stylelint will check it against this, or should I file an issue about that over there? 😛

from linter-stylelint.

davidtheclark avatar davidtheclark commented on May 30, 2024

@Arcanemagus I hadn't run into this need before. May as well file an issue with stylelint. But I can't think of any use-case for this other than text editors figuring out whether to ignore the file??? Can anyone else?

I guess there could be a from option in the node API for specifying a source file name that should be attributed to the direct code input string, and if it's in the ignoreFiles glob it will be ignored.

Isn't another way to handle this to expect the text editor plugins to read the ignoreFiles glob and determine whether to run stylelint or not?

Or I guess another possibility is that instead of calling stylelint with code you actually provide it with the filename. It then finds the file, loads the config, checks the ignoreFiles, etc. Or would that slow things down too much? I don't know: wouldn't it only add one fs call (to get the file)?

from linter-stylelint.

Arcanemagus avatar Arcanemagus commented on May 30, 2024

The problem with a file is linting on the fly, we would need to use a temporary file (the helper library makes this simple), I just don't know how involved other files are in the checking process. If linting a file only involves that file, it would be relatively simple to have the helper library copy to a temporary directory and then run on that.

from linter-stylelint.

davidtheclark avatar davidtheclark commented on May 30, 2024

@Arcanemagus Interesting. Well, stylelint wouldn't need anything other than the file to run. We could look into that option at some point.

from linter-stylelint.

Arcanemagus avatar Arcanemagus commented on May 30, 2024

As an FYI, several linters that provide a Node API, and are able to ignore files based on matching a pattern, support specifying the file name for code/stdin... but there are also a few that don't where it has had to be worked around in the provider here.

from linter-stylelint.

davidtheclark avatar davidtheclark commented on May 30, 2024

@Arcanemagus: Could you point me to some linters that do? I'd like to see what the conventions are.

from linter-stylelint.

Arcanemagus avatar Arcanemagus commented on May 30, 2024

@1000ch Do you want to work on moving to the temporary file method?

@davidtheclark eslint is the first one that pops into mind: http://eslint.org/docs/developer-guide/nodejs-api

from linter-stylelint.

davidtheclark avatar davidtheclark commented on May 30, 2024

@Arcanemagus: This is a pretty easy addition to stylelint. I will get a PR up before breakfast.

from linter-stylelint.

1000ch avatar 1000ch commented on May 30, 2024

@paulrobertlloyd This may be resolved in v1.13.0. Thanks @davidtheclark 👍

from linter-stylelint.

paulrobertlloyd avatar paulrobertlloyd commented on May 30, 2024

Yup, it works. Fantastic, thank-you!

from linter-stylelint.

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.