forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] cross-os jsonlint (mui#19377)
- Loading branch information
1 parent
20c4703
commit aee6cf8
Showing
4 changed files
with
57 additions
and
56 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* eslint-disable no-console */ | ||
const chalk = require('chalk'); | ||
const fse = require('fs-extra'); | ||
const glob = require('glob-gitignore'); | ||
const path = require('path'); | ||
|
||
const passMessage = message => `✓ ${chalk.gray(message)}`; | ||
const failMessage = message => `✗ ${chalk.whiteBright(message)}`; | ||
|
||
async function run() { | ||
const workspaceRoot = path.resolve(__dirname, '..'); | ||
|
||
const eslintignoreContent = await fse.readFile(path.join(workspaceRoot, '.eslintignore'), { | ||
encoding: 'utf8', | ||
}); | ||
const eslintignore = eslintignoreContent.split(/\r?\n/).slice(0, -1); | ||
|
||
const filenames = glob.sync('**/*.json', { | ||
cwd: workspaceRoot, | ||
ignore: eslintignore, | ||
}); | ||
|
||
let passed = true; | ||
const checks = filenames.map(async filename => { | ||
const content = await fse.readFile(path.join(workspaceRoot, filename), { encoding: 'utf8' }); | ||
try { | ||
JSON.parse(content); | ||
console.log(passMessage(filename)); | ||
} catch (error) { | ||
passed = false; | ||
console.error(failMessage(`Error parsing ${filename}:\n\n${String(error)}`)); | ||
} | ||
}); | ||
|
||
await Promise.all(checks); | ||
if (passed === false) { | ||
throw new Error('At least one file did not pass. Check the console output'); | ||
} | ||
} | ||
|
||
run().catch(error => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
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 |
---|---|---|
|
@@ -2677,11 +2677,6 @@ JSONStream@^1.0.4, JSONStream@^1.3.4: | |
jsonparse "^1.2.0" | ||
through ">=2.2.7 <3" | ||
|
||
JSV@^4.0.x: | ||
version "4.0.2" | ||
resolved "https://registry.yarnpkg.com/JSV/-/JSV-4.0.2.tgz#d077f6825571f82132f9dffaed587b4029feff57" | ||
integrity sha1-0Hf2glVx+CEy+d/67Vh7QCn+/1c= | ||
|
||
abab@^2.0.3: | ||
version "2.0.3" | ||
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" | ||
|
@@ -2957,19 +2952,14 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: | |
dependencies: | ||
color-convert "^1.9.0" | ||
|
||
ansi-styles@^4.0.0: | ||
version "4.2.0" | ||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.0.tgz#5681f0dcf7ae5880a7841d8831c4724ed9cc0172" | ||
integrity sha512-7kFQgnEaMdRtwf6uSfUnVr9gSGC7faurn+J/Mv90/W+iTtN0405/nLdopfMWwchyxhbGYl6TC4Sccn9TUkGAgg== | ||
ansi-styles@^4.0.0, ansi-styles@^4.1.0: | ||
version "4.2.1" | ||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" | ||
integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA== | ||
dependencies: | ||
"@types/color-name" "^1.1.1" | ||
color-convert "^2.0.1" | ||
|
||
ansi-styles@~1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-1.0.0.tgz#cb102df1c56f5123eab8b67cd7b98027a0279178" | ||
integrity sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg= | ||
|
||
any-promise@^1.0.0, any-promise@^1.3.0: | ||
version "1.3.0" | ||
resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" | ||
|
@@ -4223,14 +4213,13 @@ chalk@^1.0.0, chalk@^1.1.3: | |
strip-ansi "^3.0.0" | ||
supports-color "^2.0.0" | ||
|
||
chalk@~0.4.0: | ||
version "0.4.0" | ||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-0.4.0.tgz#5199a3ddcd0c1efe23bc08c1b027b06176e0c64f" | ||
integrity sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8= | ||
chalk@^3.0.0: | ||
version "3.0.0" | ||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" | ||
integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== | ||
dependencies: | ||
ansi-styles "~1.0.0" | ||
has-color "~0.1.0" | ||
strip-ansi "~0.1.0" | ||
ansi-styles "^4.1.0" | ||
supports-color "^7.1.0" | ||
|
||
chardet@^0.7.0: | ||
version "0.7.0" | ||
|
@@ -7639,11 +7628,6 @@ has-binary2@~1.0.2: | |
dependencies: | ||
isarray "2.0.1" | ||
|
||
has-color@~0.1.0: | ||
version "0.1.7" | ||
resolved "https://registry.yarnpkg.com/has-color/-/has-color-0.1.7.tgz#67144a5260c34fc3cca677d041daf52fe7b78b2f" | ||
integrity sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8= | ||
|
||
[email protected]: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/has-cors/-/has-cors-1.1.0.tgz#5e474793f7ea9843d1bb99c23eef49ff126fff39" | ||
|
@@ -8924,14 +8908,6 @@ jsonify@~0.0.0: | |
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" | ||
integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= | ||
|
||
jsonlint@^1.6.3: | ||
version "1.6.3" | ||
resolved "https://registry.yarnpkg.com/jsonlint/-/jsonlint-1.6.3.tgz#cb5e31efc0b78291d0d862fbef05900adf212988" | ||
integrity sha512-jMVTMzP+7gU/IyC6hvKyWpUU8tmTkK5b3BPNuMI9U8Sit+YAWLlZwB6Y6YrdCxfg2kNz05p3XY3Bmm4m26Nv3A== | ||
dependencies: | ||
JSV "^4.0.x" | ||
nomnom "^1.5.x" | ||
|
||
jsonparse@^1.2.0: | ||
version "1.3.1" | ||
resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" | ||
|
@@ -10589,14 +10565,6 @@ node-releases@^1.1.44: | |
dependencies: | ||
semver "^6.3.0" | ||
|
||
nomnom@^1.5.x: | ||
version "1.8.1" | ||
resolved "https://registry.yarnpkg.com/nomnom/-/nomnom-1.8.1.tgz#2151f722472ba79e50a76fc125bb8c8f2e4dc2a7" | ||
integrity sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc= | ||
dependencies: | ||
chalk "~0.4.0" | ||
underscore "~1.6.0" | ||
|
||
[email protected]: | ||
version "1.0.10" | ||
resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee" | ||
|
@@ -14090,11 +14058,6 @@ strip-ansi@^6.0.0: | |
dependencies: | ||
ansi-regex "^5.0.0" | ||
|
||
strip-ansi@~0.1.0: | ||
version "0.1.1" | ||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-0.1.1.tgz#39e8a98d044d150660abe4a6808acf70bb7bc991" | ||
integrity sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE= | ||
|
||
strip-bom@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" | ||
|
@@ -14815,11 +14778,6 @@ umask@^1.1.0: | |
resolved "https://registry.yarnpkg.com/umask/-/umask-1.1.0.tgz#f29cebf01df517912bb58ff9c4e50fde8e33320d" | ||
integrity sha1-8pzr8B31F5ErtY/5xOUP3o4zMg0= | ||
|
||
underscore@~1.6.0: | ||
version "1.6.0" | ||
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.6.0.tgz#8b38b10cacdef63337b8b24e4ff86d45aea529a8" | ||
integrity sha1-izixDKze9jM3uLJOT/htRa6lKag= | ||
|
||
[email protected]: | ||
version "4.1.0" | ||
resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.1.0.tgz#6ec2dd0de887e58a4dee83a050ded80ffc4137db" | ||
|