Skip to content

Conversation

@vankop
Copy link
Member

@vankop vankop commented Oct 20, 2019

This PR contains a:

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

Motivation / Use-Case

#187

Breaking Changes

no

Additional Info

no

@codecov-io
Copy link

codecov-io commented Oct 20, 2019

Codecov Report

Merging #190 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #190   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           6      6           
  Lines         102    112   +10     
  Branches       20     23    +3     
=====================================
+ Hits          102    112   +10
Impacted Files Coverage Δ
src/LintDirtyModulesPlugin.js 100% <100%> (ø) ⬆️

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 435dd43...af0e7d6. Read the comment docs.

Copy link
Collaborator

@ricardogobbosouza ricardogobbosouza left a comment

Choose a reason for hiding this comment

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

Hi @vankop
Some considerations
Thanks

}

return fileTimestamps;
}
Copy link
Collaborator

@ricardogobbosouza ricardogobbosouza Oct 21, 2019

Choose a reason for hiding this comment

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

We have a big loss here mapping all the entries.
No need this function

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, you are right

mapFileTimestampsToOldFormat(compilation.fileSystemInfo._fileTimestamps)
);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

No need this function, create a const in apply function

this.isFirstRun = true;
}

apply(compilation, callback) {
Copy link
Collaborator

@ricardogobbosouza ricardogobbosouza Oct 21, 2019

Choose a reason for hiding this comment

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

Create a const here to check if exists fileSystemInfo

const fileTimestamps = compilation.fileTimestamps || compilation.fileSystemInfo.getDeprecatedFileTimestamps()

if (this.isFirstRun) {
this.isFirstRun = false;
this.prevTimestamps = compilation.fileTimestamps;
this.prevTimestamps = getFileTimestamps(compilation);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use new const fileTimestamps

}

const dirtyOptions = { ...this.options };
const newTimestamps = getFileTimestamps(compilation);
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need

const newTimestamps = getFileTimestamps(compilation);
const glob = dirtyOptions.files.join('|').replace(/\\/g, '/');
const changedFiles = this.getChangedFiles(compilation.fileTimestamps, glob);
const changedFiles = this.getChangedFiles(newTimestamps, glob);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use new const fileTimestamps

const changedFiles = this.getChangedFiles(newTimestamps, glob);

this.prevTimestamps = compilation.fileTimestamps;
this.prevTimestamps = newTimestamps;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use new const fileTimestamps

@ricardogobbosouza
Copy link
Collaborator

We need to add tests

return (
compilation.fileTimestamps ||
// eslint-disable-next-line no-underscore-dangle
mapFileTimestampsToOldFormat(compilation.fileSystemInfo._fileTimestamps)
Copy link
Member

Choose a reason for hiding this comment

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

_fileTimestamps is private. Don't do that! That's not how FileSystemInfo works. fileSystemInfo._fileTimestamps is a cache, while in webpack 4 compilation.fileTimestamps was a complete list.

Use the public functions to access timestamps of files.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just use getDeprecatedFileTimestamps from FileSystemInfo

Copy link
Collaborator

@ricardogobbosouza ricardogobbosouza Oct 21, 2019

Choose a reason for hiding this comment

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

@sokra could we have a method getFileTimestamps so as not to depend on a getDeprecatedFileTimestamps function that will be depreciated?

getFileTimestamps() {
 return this._fileTimestamps;
}

@vankop
Copy link
Member Author

vankop commented Oct 21, 2019

Thanks for all your replies!

_fileTimestamps is private. Don't do that! That's not how FileSystemInfo works. fileSystemInfo._fileTimestamps is a cache

I found out that it is cache (all timestamps that was created via getFileTimestamp method), but did not understand how to take all timestamps in other way (since getDeprecatedFileTimestamps also use cache) or my vision is mistaken and we must use just getDeprecatedFileTimestamps here? Maybe we can use snapshots here somehow? @sokra could you please guide me a little bit here

Just use getDeprecatedFileTimestamps from FileSystemInfo

@ricardogobbosouza Unfortunately getDeprecatedFileTimestamps will not work as expected either. Hope @sokra will clarify usage a little bit.

We need to add tests

So I can upgrade dev dependency to webpack@5 ?

@vankop
Copy link
Member Author

vankop commented Oct 22, 2019

Lets wait for webpack/webpack#9679

@thasmo
Copy link

thasmo commented Nov 20, 2019

@vankop, seems like the PR was merged and should be included with the next beta (beta.7) when released.

@lf-jeremy
Copy link

lf-jeremy commented Nov 21, 2019

beta.7 is out and does include the PR

@alexander-akait
Copy link
Member

/cc @vankop @ricardogobbosouza what is status?

@vankop
Copy link
Member Author

vankop commented Nov 21, 2019

@evilebottnawi sorry I did not have time, hope on the nearest weekend I can try to migrate on beta.7 .

@ricardogobbosouza
Copy link
Collaborator

ricardogobbosouza commented Dec 2, 2019

@vankop @evilebottnawi
I created another PR #199, with a simpler integration.

@ricardogobbosouza ricardogobbosouza mentioned this pull request Dec 2, 2019
6 tasks
@vankop vankop deleted the lint-dirty-modules-plugin branch December 4, 2019 14:57
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.

7 participants