Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak esignore #16372

Merged
merged 3 commits into from
Oct 26, 2017
Merged

Tweak esignore #16372

merged 3 commits into from
Oct 26, 2017

Conversation

refack
Copy link
Contributor

@refack refack commented Oct 21, 2017

Fixes issue with unicode paths not being ignored by eslint
b485bc4 solves what #16010 tried to acomplish
The second commit solves it at the root

Refs: #16010
Refs: #16278

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

tools,test

@nodejs-github-bot nodejs-github-bot added the tools Issues and PRs related to the tools directory. label Oct 21, 2017
@refack refack added test Issues and PRs related to the tests. windows Issues and PRs related to the Windows platform. labels Oct 21, 2017
@refack
Copy link
Contributor Author

refack commented Oct 21, 2017

/cc @Trott @chrisbudy @nodejs/testing

@Trott
Copy link
Member

Trott commented Oct 22, 2017

First commit seems fine. Not clear on how/why the second commit. Can you elaborate a bit?

@refack
Copy link
Contributor Author

refack commented Oct 22, 2017

  1. The original bug is caused by
    return (/^\\\\\?\\/.test(str) || /[^\x00-\x80]+/.test(str) ? str : str.replace(/\\/g, '/')

    in ignore. This RegExp fails when there are non ASCII characters in the path. so it fails to "posix"ise the path
  2. ignore slices the path by / then test east slice for a match exclusion with the exclusion rules
  3. eslint has a default ignore rule to exclude any path starting with . so if the temp directories we create start with dot we don't need an extra rule, and it's not slice dependant.

@Trott
Copy link
Member

Trott commented Oct 22, 2017

@refack Thanks for the clear explanation. Does the bug only manifest on Windows? I've not seen it anywhere else... EDIT: Never mind, I see that the buggy code is indeed Windows-specific.

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

LGTM if CI is green. I dislike using .tmp instead of tmp but that's an aesthetic decision, and working around bugs is more important than accommodating my aesthetic preferences.

@refack
Copy link
Contributor Author

refack commented Oct 22, 2017

The bug manifests only on Windows because the step that is sensitive to unicode (or UTF-8) is the conversion from \ to /.

@Trott
Copy link
Member

Trott commented Oct 22, 2017

I guess it makes sense to leave test/tmp* in .gitignore because those directories will still be hanging around after this commit lands in someone's clone.

Maybe it makes sense to add test/tmp* (and test/.tmp* because why not?) to the clean target in Makefile and vcbuild.bat so that there's a chance of removal of test/tmp* from .gitignore eventually? Could be a separate PR, especially if we think a fix might be coming to ignore.js and people might actively dislike the change to .tmp for whatever reason.

@refack
Copy link
Contributor Author

refack commented Oct 22, 2017

Maybe it makes sense to add test/tmp* (and test/.tmp* because why not?) to the clean target in Makefile and vcbuild.bat so that there's a chance of removal of test/tmp* from .gitignore eventually? Could be a separate PR, especially if we think a fix might be coming to ignore.js and people might actively dislike the change to .tmp for whatever reason.

I'm a big believer in git clean -Xfd (Capital X to remove ignored files), but for those who are used to make targets will do...

@refack
Copy link
Contributor Author

refack commented Oct 22, 2017

I guess it makes sense to leave test/tmp* in .gitignore because those directories will still be hanging around after this commit lands in someone's clone.

P.S. a .gitignore cleanup/refactor in the works...

@refack
Copy link
Contributor Author

refack commented Oct 22, 2017

RE the third commit (25ff3343d326c4295f580db32e7d0c7b5a1a8127) I'm doing it semi blind, so would appreciate some extra manual validation.
Decided to un-document the vcbuild.bat command since it seems vestigial (does very little actual cleaning), and only relevant for release build scenarios.

Makefile Outdated
@@ -102,11 +102,14 @@ uninstall:

clean:
$(RM) -r out/Makefile $(NODE_EXE) $(NODE_G_EXE) out/$(BUILDTYPE)/$(NODE_EXE) \
out/$(BUILDTYPE)/node.exp
out/$(BUILDTYPE)/node.exp
Copy link
Member

Choose a reason for hiding this comment

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

I think the indentation in the current Makefile makes more sense because this is a continuation of the previous line and not a new command.

@@ -38,7 +38,7 @@ const noop = () => {};

exports.fixturesDir = fixturesDir;

exports.tmpDirName = 'tmp';
exports.tmpDirName = '.tmp';
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a comment? Maybe something like:

// Eslint ignores directories beginning with '.' by default.

Makefile Outdated
@if [ -d out ]; then find out/ -name '*.o' -o -name '*.a' -o -name '*.d' | xargs $(RM) -r; fi
$(RM) -r node_modules
@if [ -d deps/icu ]; then echo deleting deps/icu; $(RM) -r deps/icu; fi
$(RM) test.tap
$(RM) -r test/tmp*
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we need this, if we never had it before, then why not just stick with the new one? (partly a question for @Trott )

If we are adding it (and it's already legacy) then could you add a comment saying # Remove this at some point

@@ -541,7 +541,7 @@ echo Failed to create vc project files.
goto exit

:help
echo vcbuild.bat [debug/release] [msi] [test/test-ci/test-all/test-uv/test-internet/test-pummel/test-simple/test-message/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [clean] [noprojgen] [small-icu/full-icu/without-intl] [nobuild] [sign] [x86/x64] [vs2015/vs2017] [download-all] [enable-vtune] [lint/lint-ci] [no-NODE-OPTIONS] [link-module path-to-module]
echo vcbuild.bat [debug/release] [msi] [test/test-ci/test-all/test-uv/test-internet/test-pummel/test-simple/test-message/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [noprojgen] [small-icu/full-icu/without-intl] [nobuild] [sign] [x86/x64] [vs2015/vs2017] [download-all] [enable-vtune] [lint/lint-ci] [no-NODE-OPTIONS] [link-module path-to-module]
Copy link
Member

Choose a reason for hiding this comment

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

So this is only used in a few places right?

node/vcbuild.bat

Lines 171 to 177 in 7a171fd

if "%target%"=="Clean" echo deleting %~dp0deps\icu
if "%target%"=="Clean" rmdir /S /Q %~dp0deps\icu
:no-depsicu
call :getnodeversion || exit /b 1
if "%target%"=="Clean" rmdir /Q /S "%~dp0%config%\node-v%FULLVERSION%-win-%target_arch%" > nul 2> nul

Agreed that it doesn't look like a user-facing thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Might have been once... Now it seems more like clean-release-artifacts. So, confusing.

@@ -1,10 +1,9 @@
lib/internal/v8_prof_polyfill.js
lib/punycode.js
test/addons/??_*/
test/addons/??_*
Copy link
Member

Choose a reason for hiding this comment

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

So how exactly does this make the ignoring more correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's an ignore thing, it builds the exclusion regex based on this line (requiring a terminal /), then the directory itself is matched as test/addons/12_XFD (with no trailing /) so it passes and all it's children are enumerated (only they fail).
So the line pre PR is equivalent to test/addons/??_*/* and test/addons/??_* make it exclude the directories and not even enumerate their content.

@@ -38,7 +38,9 @@ const noop = () => {};

exports.fixturesDir = fixturesDir;

exports.tmpDirName = 'tmp';
// Using a `.` prefixed name, which is the convention for "hidden" on POSIX,
// get tools to ignore it by default, especially git and eslint.
Copy link
Member

Choose a reason for hiding this comment

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

Git doesn't ignore it by default, so maybe remove git and

Makes eslint exclude directories without enumerating their content

PR-URL: nodejs#16372
Refs: nodejs#16010
Refs: nodejs#16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
`.tmp` prefix allows easier exclusion

PR-URL: nodejs#16372
Refs: nodejs#16010
Refs: nodejs#16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
also undocument the `vcbuild.bat` command since it's broken
and seems to only be relevant to release builds

PR-URL: nodejs#16372
Refs: nodejs#16010
Refs: nodejs#16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@refack refack merged commit 9ab6481 into nodejs:master Oct 26, 2017
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
Makes eslint exclude directories without enumerating their content

PR-URL: #16372
Refs: #16010
Refs: #16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
`.tmp` prefix allows easier exclusion

PR-URL: #16372
Refs: #16010
Refs: #16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
also undocument the `vcbuild.bat` command since it's broken
and seems to only be relevant to release builds

PR-URL: #16372
Refs: #16010
Refs: #16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
Makes eslint exclude directories without enumerating their content

PR-URL: #16372
Refs: #16010
Refs: #16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
`.tmp` prefix allows easier exclusion

PR-URL: #16372
Refs: #16010
Refs: #16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
also undocument the `vcbuild.bat` command since it's broken
and seems to only be relevant to release builds

PR-URL: #16372
Refs: #16010
Refs: #16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
Makes eslint exclude directories without enumerating their content

PR-URL: #16372
Refs: #16010
Refs: #16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
`.tmp` prefix allows easier exclusion

PR-URL: #16372
Refs: #16010
Refs: #16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
also undocument the `vcbuild.bat` command since it's broken
and seems to only be relevant to release builds

PR-URL: #16372
Refs: #16010
Refs: #16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@gibfahn gibfahn mentioned this pull request Oct 31, 2017
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
Makes eslint exclude directories without enumerating their content

PR-URL: nodejs/node#16372
Refs: nodejs/node#16010
Refs: nodejs/node#16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
`.tmp` prefix allows easier exclusion

PR-URL: nodejs/node#16372
Refs: nodejs/node#16010
Refs: nodejs/node#16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
also undocument the `vcbuild.bat` command since it's broken
and seems to only be relevant to release builds

PR-URL: nodejs/node#16372
Refs: nodejs/node#16010
Refs: nodejs/node#16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
Makes eslint exclude directories without enumerating their content

PR-URL: nodejs/node#16372
Refs: nodejs/node#16010
Refs: nodejs/node#16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
`.tmp` prefix allows easier exclusion

PR-URL: nodejs/node#16372
Refs: nodejs/node#16010
Refs: nodejs/node#16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
also undocument the `vcbuild.bat` command since it's broken
and seems to only be relevant to release builds

PR-URL: nodejs/node#16372
Refs: nodejs/node#16010
Refs: nodejs/node#16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins
Copy link
Contributor

Should this be backported to v6.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label.

This should likely be part of a batch update to eslint

addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
Makes eslint exclude directories without enumerating their content

PR-URL: nodejs/node#16372
Refs: nodejs/node#16010
Refs: nodejs/node#16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
`.tmp` prefix allows easier exclusion

PR-URL: nodejs/node#16372
Refs: nodejs/node#16010
Refs: nodejs/node#16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
also undocument the `vcbuild.bat` command since it's broken
and seems to only be relevant to release builds

PR-URL: nodejs/node#16372
Refs: nodejs/node#16010
Refs: nodejs/node#16278
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@refack refack deleted the tweak-esignore branch April 26, 2018 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants