-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Enforce browser order in compatibility tables [MERGE #2889 FIRST] #2890
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,26 @@ | |
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
function orderSupportBlock(name, val) { | ||
if (name == 'support') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
"test": {
"support": {
"property": {},
"method": {}
}
} would be made invalid, whereas: "test": {
"other": {
"property": {},
"method": {}
}
} would remain valid. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, wrong indentation. |
||
/* | ||
Return a new "support_block" object whose first-level properties | ||
(browser names) have been ordered according to Array.prototype.sort, | ||
and so will be stringified in that order as well. This relies on | ||
guaranteed "own" property ordering, which is insertion order for | ||
non-integer keys (which is our case). See: | ||
|
||
http://2ality.com/2015/10/property-traversal-order-es6.html | ||
http://node.green/#ES2015-misc-own-property-order | ||
*/ | ||
return Object.keys(val).sort().reduce(function(result, key) { | ||
result[key] = val[key]; | ||
return result; | ||
}, {}); | ||
} | ||
return val; | ||
} | ||
|
||
function jsonDiff(actual, expected) { | ||
var actualLines = actual.split(/\n/); | ||
var expectedLines = expected.split(/\n/); | ||
|
@@ -20,7 +40,7 @@ function jsonDiff(actual, expected) { | |
function testStyle(filename) { | ||
let hasErrors = false; | ||
let actual = fs.readFileSync(filename, 'utf-8').trim(); | ||
let expected = JSON.stringify(JSON.parse(actual), null, 2); | ||
let expected = JSON.stringify(JSON.parse(actual), orderSupportBlock, 2); | ||
|
||
const {platform} = require("os"); | ||
if (platform() === "win32") { // prevent false positives from git.core.autocrlf on Windows | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, stop breaking the last newline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly don't know why the newline keeps trying to get removed. It might be the JSON editor I'm using (which is out of date anyways). :/