webpack-contrib / stylelint-webpack-plugin

A Stylelint plugin for webpack
MIT License
426 stars 73 forks source link

chore: update dependencies to the latest version #311

Closed ersachin3112 closed 1 year ago

ersachin3112 commented 1 year ago

This PR contains a:

Motivation / Use-Case

update dependencies to the latest version

Breaking Changes

No

Additional Info

No

ricardogobbosouza commented 1 year ago

https://github.com/stylelint/stylelint/pull/6415#issuecomment-1337682121

ybiquitous commented 1 year ago

The following patch should work:

diff --git a/src/index.js b/src/index.js
index 0192bef..a4bb5c9 100644
--- a/src/index.js
+++ b/src/index.js
@@ -3,6 +3,9 @@ const { isAbsolute, join } = require('path');
 const globby = require('globby');
 const { isMatch } = require('micromatch');

+// @ts-expect-error
+const isPathIgnored = require('stylelint/lib/isPathIgnored');
+
 const { getOptions } = require('./options');
 const linter = require('./linter');
 const { arrify, parseFiles, parseFoldersToGlobs } = require('./utils');
@@ -127,7 +130,7 @@ class StylelintWebpackPlugin {
               : globby.sync(wanted, { dot: true, ignore: exclude })
             ).map(async (file) => {
               try {
-                return (await api.isPathIgnored(file)) ? false : file;
+                return (await isPathIgnored(api, file)) ? false : file;
               } catch (e) {
                 return file;
               }

But note that isPathIgnored is internal and may change in future releases.

alexander-akait commented 1 year ago

@ybiquitous Sounds like it is good candidate to be public, because when we handle graph, we need to have API to undestand that the file was ignored

ybiquitous commented 1 year ago

@alexander-akait I have no objections now. Could you please open an issue?

alexander-akait commented 1 year ago

@ricardogobbosouza let's refactor our code to avoid breaking change using addional guards like typeof require('stylelint/lib/isPathIgnored') ? ... : ..., so we will still support old and new versions

ricardogobbosouza commented 1 year ago

I was already working on it, remembering that the stylelint path can be changed.

I just think this stylelint internal change should be a major release

alexander-akait commented 1 year ago

Yeah, I write about it, as minimum they should be marked as internal (_ or @internal)

ricardogobbosouza commented 1 year ago

312