stylelint icon indicating copy to clipboard operation
stylelint copied to clipboard

Fix Node.js API glob returning empty array

Open lukasholzer opened this issue 5 years ago • 2 comments
trafficstars

Clearly describe the bug

The nodejs api is using globby to collect the scss files for linting. When used on windows it returns an empty array for the list of files in standalone.js - the filePaths is an empty array.

image

I've already opened a bug at https://github.com/sindresorhus/globby/issues/152

Workaround

It would be nice to have an option where I can provide the file paths on my own and not rely on any globbing so that I can pass a list of absolute file paths that should be linted.

Which version of stylelint are you using?

"version": "13.2.1"

How are you running stylelint: CLI, PostCSS plugin, Node.js API?

    import { lint, LinterResult } from 'stylelint';

    const files = ["./path/to/files/*.scss"];

    lintingOutcome = await lint({
      configFile: normalize(config),
      configBasedir: process.cwd(),
      files: files,
      formatter: junitFormatter,
    });

lukasholzer avatar Sep 09 '20 09:09 lukasholzer

@lukasholzer Thanks for the report.

Can you try 13.8.0, please? This issue may have been fixed by https://github.com/stylelint/stylelint/pull/4931.

jeddy3 avatar Nov 17 '20 17:11 jeddy3

@jeddy3 Thx is now working with the latest version. The question even though is for me can we implement the feature of passing the files directly? As this might be way more performant if I need to run only for a limited set of files.

Are you willing to take contributions on that?

lukasholzer avatar Nov 26 '20 13:11 lukasholzer

@lukasholzer yes we are. Can you open a new feature request for it?

Mouvedia avatar Feb 04 '23 16:02 Mouvedia