Skip to content

Conversation

@ricardogobbosouza
Copy link
Collaborator

@ricardogobbosouza ricardogobbosouza commented May 24, 2021

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

✨   New Options

  • Exclude (Specify the files and/or directories to exclude. Must be relative to options.context)
  • Extensions (Specify extensions that should be checked)
  • Output Report (Write the output of the errors to a file, for example a json file for use for reporting)
  • Threads

Refactor

  • Updates to emitError and emitWarning

Setting only emitError to true will no longer exclusively print files with errors
and disregard the files with warnings. Similarly, setting only emitWarning to true
will no longer exclusively print files with warnings disregard the files with errors.

  • fix: use quiet to override emitError and emitWarning
  • quiet is essentially syntactic sugar for setting emitError to true
    and emitWarning to false

Additional Info

This plugin has been rewritten to work only with import graph files, reducing its execution time and linting necessary files.
It will probably be the last release with support for webpack 4.

@ricardogobbosouza
Copy link
Collaborator Author

Hi @jsg2021
Your review would be very helpful, since this plugin is very similar to eslint-webpack-plugin

Copy link

@jsg2021 jsg2021 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a high level, it looks good to me. Any idea why it doesn't work with threads?

@ricardogobbosouza
Copy link
Collaborator Author

At a high level, it looks good to me. Any idea why it doesn't work with threads?

@jsg2021
Some problem with the stylelint.lint function.
Error: DataCloneError: [object Function] could not be cloned.

@ricardogobbosouza
Copy link
Collaborator Author

I managed to solve it by writing the result, strange, but it worked ...

// Reset result to work with worker
  return results.map((result) => {
    return {
      source: result.source,
      errored: result.errored,
      ignored: result.ignored,
      warnings: result.warnings,
      deprecations: result.deprecations,
      invalidOptionWarnings: result.invalidOptionWarnings,
    };
  });

@codecov
Copy link

codecov bot commented May 25, 2021

Codecov Report

Merging #230 (3a67d1f) into master (171a3a2) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            master      #230    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files            7         8     +1     
  Lines          125       231   +106     
  Branches        25        54    +29     
==========================================
+ Hits           125       231   +106     
Impacted Files Coverage Δ
src/StylelintError.js 100.00% <ø> (ø)
src/getStylelint.js 100.00% <100.00%> (ø)
src/index.js 100.00% <100.00%> (ø)
src/linter.js 100.00% <100.00%> (ø)
src/options.js 100.00% <100.00%> (ø)
src/utils.js 100.00% <100.00%> (ø)
src/worker.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 171a3a2...3a67d1f. Read the comment docs.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I ran quickly and everything looks good, did we solve the problem with fileDependencies?

@ricardogobbosouza
Copy link
Collaborator Author

@alexander-akait
Copy link
Member

@ricardogobbosouza It is only for initial lint?

@ricardogobbosouza
Copy link
Collaborator Author

ricardogobbosouza commented May 26, 2021

@alexander-akait it is like this:

  • When the webpack starts, all style sheets will be linted, regardless of whether they are being used or not.
  • After initialization, only the files modified will be linted, regardless of whether they are being used or not.

@ricardogobbosouza
Copy link
Collaborator Author

ricardogobbosouza commented May 26, 2021

The idea was to get the dependencies of the stylesheet module, to really linting only the files used, but the only way I found was using module.buildInfo.snapshot which is not recommended, maybe leave this improvement for v3 where we will depreciate the support for webpack4.

@alexander-akait
Copy link
Member

@ricardogobbosouza sorry for delay, I agree, let's postpone, also we can improve it in any time in future

@alexander-akait
Copy link
Member

@ricardogobbosouza friendly ping

@ricardogobbosouza
Copy link
Collaborator Author

@alexander-akait I'm waiting for your review 😄

@ricardogobbosouza ricardogobbosouza merged commit 9523f0c into master Jun 15, 2021
@ricardogobbosouza ricardogobbosouza deleted the feat-update-plugin branch June 15, 2021 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants