Skip to content

Commit

Permalink
[I18n] Remove JSON5 dependency from kbn-i18n (#26634)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeanidShutau authored Dec 5, 2018
1 parent 0b6e8af commit c50e641
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
2 changes: 0 additions & 2 deletions packages/kbn-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"@babel/preset-typescript": "^7.1.0",
"@kbn/dev-utils": "1.0.0",
"@types/intl-relativeformat": "^2.1.0",
"@types/json5": "^0.0.30",
"@types/react-intl": "^2.3.11",
"del": "^3.0.0",
"getopts": "^2.2.3",
Expand All @@ -32,7 +31,6 @@
"intl-format-cache": "^2.1.0",
"intl-messageformat": "^2.2.0",
"intl-relativeformat": "^2.1.0",
"json5": "^2.0.1",
"prop-types": "^15.6.2",
"react": "^16.3.0",
"react-intl": "^2.7.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
messages: {
test: 'test' // JSON5 test
"messages": {
"test": "test"
}
}
2 changes: 1 addition & 1 deletion packages/kbn-i18n/src/loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('I18n loader', () => {
});
});

test('should return translation messages from JSON5 file', async () => {
test('should return translation messages from JSON file', async () => {
i18nLoader.registerTranslationFile(
join(__dirname, './__fixtures__/test_plugin_2/translations/fr.json')
);
Expand Down
5 changes: 2 additions & 3 deletions packages/kbn-i18n/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/

import { readFile } from 'fs';
import * as JSON5 from 'json5';
import * as path from 'path';
import { promisify } from 'util';

Expand Down Expand Up @@ -65,12 +64,12 @@ function getLocaleFromFileName(fullFileName: string) {
}

/**
* Loads file and parses it as JSON5
* Loads file and parses it as JSON
* @param pathToFile
* @returns
*/
async function loadFile(pathToFile: string): Promise<Translation> {
return JSON5.parse(await asyncReadFile(pathToFile, 'utf8'));
return JSON.parse(await asyncReadFile(pathToFile, 'utf8'));
}

/**
Expand Down
12 changes: 0 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1299,11 +1299,6 @@
resolved "https://registry.yarnpkg.com/@types/json-stable-stringify/-/json-stable-stringify-1.0.32.tgz#121f6917c4389db3923640b2e68de5fa64dda88e"
integrity sha512-q9Q6+eUEGwQkv4Sbst3J4PNgDOvpuVuKj79Hl/qnmBMEIPzB5QoFRUtjcgcg2xNUZyYUGXBk5wYIBKHt0A+Mxw==

"@types/json5@^0.0.30":
version "0.0.30"
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.30.tgz#44cb52f32a809734ca562e685c6473b5754a7818"
integrity sha512-sqm9g7mHlPY/43fcSNrCYfOeX9zkTTK+euO5E6+CVijSMm5tTjkVdwdqRkY3ljjIAf8679vps5jKUoJBCLsMDA==

"@types/jsonwebtoken@^7.2.7":
version "7.2.8"
resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-7.2.8.tgz#8d199dab4ddb5bba3234f8311b804d2027af2b3a"
Expand Down Expand Up @@ -12456,13 +12451,6 @@ json5@^1.0.1:
dependencies:
minimist "^1.2.0"

json5@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.0.1.tgz#3d6d0d1066039eb50984e66a7840e4f4b7a2c660"
integrity sha512-t6N/86QDIRYvOL259jR5c5TbtMnekl2Ib314mGeMh37zAwjgbWHieqijPH7pWaogmJq1F2I4Sphg19U1s+ZnXQ==
dependencies:
minimist "^1.2.0"

jsonfile@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66"
Expand Down

0 comments on commit c50e641

Please sign in to comment.