A more robust root check to fix an edge case #9

Merged
merged 1 commit into from Feb 1, 2017

Projects

None yet

2 participants

@asiandrummer
Contributor

Attending to one of the review comments from #8.

Saw a neat trick to check if the current directory is the root directory - use that instead to check /.graphqlrc edge case.

@asiandrummer asiandrummer requested a review from wincent Feb 1, 2017
@wincent
wincent approved these changes Feb 1, 2017 View changes

Looks good. Thanks for fixing this.

(I thought I'd found an edge case in it, but when I ran through it actually looks ok.)

let currentPath = path.resolve(dirPath);
let filePath;
- while (currentPath.length > 1) {
+ while (true) {
filePath = path.join(currentPath, '.graphqlrc');
@wincent
wincent Feb 1, 2017 Contributor

filePath is no longer used outside the loop, so I think we can make it const filePath = path.join('...').

@wincent wincent merged commit 5d9c7c4 into master Feb 1, 2017
@wincent wincent added a commit to wincent/graphql-language-service that referenced this pull request Feb 1, 2017
@wincent wincent Switch a let to a const
As suggested in:

graphql#9
8d92de1
@wincent wincent referenced this pull request Feb 1, 2017
Merged

Switch a let to a const #10

@wincent wincent deleted the find-graphqlrc-fix branch Feb 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment