From d5c549260cc013ca14994341cb31e54c080f406a Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 3 Dec 2021 23:32:14 +0100 Subject: [PATCH] meta: drop stringify-object dependency to generate locales We can use `JSON.stringify` and rely on ESLint auto-fixing. --- .eslintrc.js | 2 +- package.json | 1 - packages/@uppy/locales/src/en_US.js | 3 ++- private/locale-pack/index.mjs | 7 +------ private/locale-pack/package.json | 3 +-- yarn.lock | 31 ++--------------------------- 6 files changed, 7 insertions(+), 40 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index f9c53b7cd6..711c591f15 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -192,7 +192,7 @@ module.exports = { ], rules: { camelcase: ['off'], - 'quote-props': ['off'], + 'quote-props': ['error', 'as-needed', { 'numbers': true }], }, }, diff --git a/package.json b/package.json index 817245baab..32c26e6871 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,6 @@ "resolve": "^1.17.0", "sass": "^1.29.0", "size-limit": "4.5.6", - "stringify-object": "^3.3.0", "stylelint": "^13.13.1", "stylelint-config-rational-order": "^0.1.2", "stylelint-config-standard": "^22.0.0", diff --git a/packages/@uppy/locales/src/en_US.js b/packages/@uppy/locales/src/en_US.js index 751b6b276a..47c61b29cf 100644 --- a/packages/@uppy/locales/src/en_US.js +++ b/packages/@uppy/locales/src/en_US.js @@ -88,7 +88,7 @@ en_US.strings = { myDevice: 'My Device', noCameraDescription: 'In order to take pictures or record video, please connect a camera device', noCameraTitle: 'Camera Not Available', - noDuplicates: 'Cannot add the duplicate file \'%{fileName}\', it already exists', + noDuplicates: "Cannot add the duplicate file '%{fileName}', it already exists", noFilesFound: 'You have no files or folders here', noInternetConnection: 'No Internet connection', noMoreFilesAllowed: 'Cannot add more files', @@ -134,6 +134,7 @@ en_US.strings = { '1': 'Select %{smart_count}', }, sessionRestored: 'Session restored', + showErrorDetails: 'Show error details', signInWithGoogle: 'Sign in with Google', smile: 'Smile!', startCapturing: 'Begin screen capturing', diff --git a/private/locale-pack/index.mjs b/private/locale-pack/index.mjs index a98166d860..fb25217c5c 100644 --- a/private/locale-pack/index.mjs +++ b/private/locale-pack/index.mjs @@ -5,7 +5,6 @@ import { readFile, writeFile } from 'node:fs/promises' import { fileURLToPath } from 'node:url' import dedent from 'dedent' -import stringifyObject from 'stringify-object' import { remark } from 'remark' import { headingRange } from 'mdast-util-heading-range' import remarkFrontmatter from 'remark-frontmatter' @@ -88,11 +87,7 @@ function createCombinedLocale (locales) { } function populateTemplate (fileString, combinedLocale) { - const formattedLocale = stringifyObject(combinedLocale, { - indent: ' ', - singleQuotes: true, - inlineCharacterLimit: 12, - }) + const formattedLocale = JSON.stringify(combinedLocale, null, ' ') return fileString.replace('en_US.strings = {}', `en_US.strings = ${formattedLocale}`) } diff --git a/private/locale-pack/package.json b/private/locale-pack/package.json index cef3d6905c..d4ce0dce69 100644 --- a/private/locale-pack/package.json +++ b/private/locale-pack/package.json @@ -14,7 +14,6 @@ "glob": "^7.2.0", "mdast-util-heading-range": "^3.1.0", "remark": "^14.0.1", - "remark-frontmatter": "^4.0.1", - "stringify-object": "^4.0.0" + "remark-frontmatter": "^4.0.1" } } diff --git a/yarn.lock b/yarn.lock index 74c7e2da77..fc9fb914cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21048,7 +21048,7 @@ __metadata: languageName: node linkType: hard -"get-own-enumerable-property-symbols@npm:^3.0.0, get-own-enumerable-property-symbols@npm:^3.0.2": +"get-own-enumerable-property-symbols@npm:^3.0.0": version: 3.0.2 resolution: "get-own-enumerable-property-symbols@npm:3.0.2" checksum: 8f0331f14159f939830884799f937343c8c0a2c330506094bc12cbee3665d88337fe97a4ea35c002cc2bdba0f5d9975ad7ec3abb925015cdf2a93e76d4759ede @@ -24263,13 +24263,6 @@ hexo-filter-github-emojis@arturi/hexo-filter-github-emojis: languageName: node linkType: hard -"is-obj@npm:^3.0.0": - version: 3.0.0 - resolution: "is-obj@npm:3.0.0" - checksum: 75e97a99ed0b0884778887f8e913791864151307774914283b068b06b57ca86f695b024aa1ba5ed04411918edef93e2bfd8f84d68c6b6aab417802cc76f5061b - languageName: node - linkType: hard - "is-object@npm:^1.0.1": version: 1.0.2 resolution: "is-object@npm:1.0.2" @@ -24432,13 +24425,6 @@ hexo-filter-github-emojis@arturi/hexo-filter-github-emojis: languageName: node linkType: hard -"is-regexp@npm:^3.0.0": - version: 3.1.0 - resolution: "is-regexp@npm:3.1.0" - checksum: d39dbd9892f0a25d01ee1a8e650c3f2e045bf7b1fa87eafb50b31dd29342869aa9135fd372628202254398956bf7f4b62094bdda39283ec2a9bb749fbb7f427c - languageName: node - linkType: hard - "is-resolvable@npm:^1.0.0, is-resolvable@npm:^1.1.0": version: 1.1.0 resolution: "is-resolvable@npm:1.1.0" @@ -26953,7 +26939,6 @@ hexo-filter-github-emojis@arturi/hexo-filter-github-emojis: mdast-util-heading-range: ^3.1.0 remark: ^14.0.1 remark-frontmatter: ^4.0.1 - stringify-object: ^4.0.0 languageName: unknown linkType: soft @@ -39257,7 +39242,7 @@ hexo-filter-github-emojis@arturi/hexo-filter-github-emojis: languageName: node linkType: hard -"stringify-object@npm:3.3.0, stringify-object@npm:^3.3.0": +"stringify-object@npm:3.3.0": version: 3.3.0 resolution: "stringify-object@npm:3.3.0" dependencies: @@ -39268,17 +39253,6 @@ hexo-filter-github-emojis@arturi/hexo-filter-github-emojis: languageName: node linkType: hard -"stringify-object@npm:^4.0.0": - version: 4.0.0 - resolution: "stringify-object@npm:4.0.0" - dependencies: - get-own-enumerable-property-symbols: ^3.0.2 - is-obj: ^3.0.0 - is-regexp: ^3.0.0 - checksum: 8fffae04044f0a4f7fa70e05b857750e35a54e6117cdf69cad2d1ef318ff4b0c8fec57a7731646fca0ca7c07ae723cb12edbbbc863377607aec9c83adb9ff5a3 - languageName: node - linkType: hard - "strip-ansi@npm:6.0.0": version: 6.0.0 resolution: "strip-ansi@npm:6.0.0" @@ -42334,7 +42308,6 @@ hexo-filter-github-emojis@arturi/hexo-filter-github-emojis: resolve: ^1.17.0 sass: ^1.29.0 size-limit: 4.5.6 - stringify-object: ^3.3.0 stylelint: ^13.13.1 stylelint-config-rational-order: ^0.1.2 stylelint-config-standard: ^22.0.0