From 59b9348093b4da6fac67a146dd1f685aad1ca6bb Mon Sep 17 00:00:00 2001 From: CommanderRoot Date: Mon, 28 Mar 2022 19:29:56 +0200 Subject: [PATCH] chore: replace deprecated String.prototype.substr() (#6333) * chore: replace deprecated String.prototype.substr() .substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher * refactor: add prefer slice lint rule and fix errors Co-authored-by: erezrokah --- .eslintrc.js | 3 +- dev-test/backends/test/index.html | 2 +- dev-test/index.html | 2 +- package.json | 3 +- packages/netlify-cms-backend-azure/src/API.ts | 2 +- .../netlify-cms-backend-github/src/API.ts | 8 +- .../src/__tests__/API.spec.js | 2 +- packages/netlify-cms-core/src/backend.ts | 2 +- .../Collection/Entries/EntriesCollection.js | 4 +- .../components/Collection/NestedCollection.js | 2 +- .../src/formats/frontmatter.ts | 11 +- .../netlify-cms-core/src/lib/textHelper.js | 1 + packages/netlify-cms-lib-util/src/APIUtils.ts | 6 +- packages/netlify-cms-lib-util/src/path.ts | 8 +- .../src/stringTemplate.ts | 4 +- .../src/middlewares/utils/fs.ts | 2 +- .../src/withFileControl.js | 1 + .../src/serializers/slateRemark.js | 2 + scripts/webpack.js | 2 +- yarn.lock | 196 +++++++++++------- 20 files changed, 157 insertions(+), 106 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 780ff299..b3ab23c9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -51,8 +51,9 @@ module.exports = { destructuring: 'all', }, ], + 'unicorn/prefer-string-slice': 'error', }, - plugins: ['babel', '@emotion', 'cypress'], + plugins: ['babel', '@emotion', 'cypress', 'unicorn'], settings: { react: { version: 'detect', diff --git a/dev-test/backends/test/index.html b/dev-test/backends/test/index.html index 0a68d4e3..cde4d1d4 100644 --- a/dev-test/backends/test/index.html +++ b/dev-test/backends/test/index.html @@ -183,7 +183,7 @@ h('h2', {}, 'Related Post'), h('h3', {}, post.get('title')), h('img', { src: post.get('image') }), - h('p', {}, post.get('body', '').substr(0, 100) + '...'), + h('p', {}, post.get('body', '').slice(0, 100) + '...'), ) : null; } }); diff --git a/dev-test/index.html b/dev-test/index.html index 0a68d4e3..cde4d1d4 100644 --- a/dev-test/index.html +++ b/dev-test/index.html @@ -183,7 +183,7 @@ h('h2', {}, 'Related Post'), h('h3', {}, post.get('title')), h('img', { src: post.get('image') }), - h('p', {}, post.get('body', '').substr(0, 100) + '...'), + h('p', {}, post.get('body', '').slice(0, 100) + '...'), ) : null; } }); diff --git a/package.json b/package.json index e22f2ad1..14796312 100644 --- a/package.json +++ b/package.json @@ -128,11 +128,12 @@ "cypress-jest-adapter": "^0.1.1", "cypress-plugin-tab": "^1.0.0", "dotenv": "^10.0.0", - "eslint": "^7.0.0", + "eslint": "^8.12.0", "eslint-plugin-cypress": "^2.6.0", "eslint-plugin-import": "^2.18.2", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-react": "^7.17.0", + "eslint-plugin-unicorn": "^41.0.1", "execa": "^5.0.0", "friendly-errors-webpack-plugin": "^1.7.0", "fs-extra": "^10.0.0", diff --git a/packages/netlify-cms-backend-azure/src/API.ts b/packages/netlify-cms-backend-azure/src/API.ts index 536f2b9c..bbc1668a 100644 --- a/packages/netlify-cms-backend-azure/src/API.ts +++ b/packages/netlify-cms-backend-azure/src/API.ts @@ -293,7 +293,7 @@ export default class API { fromBase64 = (str: string) => Base64.decode(str); branchToRef = (branch: string): string => `refs/heads/${branch}`; - refToBranch = (ref: string): string => ref.substr('refs/heads/'.length); + refToBranch = (ref: string): string => ref.slice('refs/heads/'.length); user = async () => { const result = await this.requestJSON({ diff --git a/packages/netlify-cms-backend-github/src/API.ts b/packages/netlify-cms-backend-github/src/API.ts index bc773364..449b95b0 100644 --- a/packages/netlify-cms-backend-github/src/API.ts +++ b/packages/netlify-cms-backend-github/src/API.ts @@ -361,7 +361,7 @@ export default class API { return parseContentKey(contentKey); } - return parseContentKey(contentKey.substring(this.repo.length + 1)); + return parseContentKey(contentKey.slice(this.repo.length + 1)); } checkMetadataRef() { @@ -728,7 +728,7 @@ export default class API { async migrateToVersion1(pullRequest: GitHubPull, metadata: Metadata) { // hard code key/branch generation logic to ignore future changes - const oldContentKey = pullRequest.head.ref.substring(`cms/`.length); + const oldContentKey = pullRequest.head.ref.slice(`cms/`.length); const newContentKey = `${metadata.collection}/${oldContentKey}`; const newBranchName = `cms/${newContentKey}`; @@ -765,7 +765,7 @@ export default class API { async migrateToPullRequestLabels(pullRequest: GitHubPull, metadata: Metadata) { await this.setPullRequestStatus(pullRequest, metadata.status); - const contentKey = pullRequest.head.ref.substring(`cms/`.length); + const contentKey = pullRequest.head.ref.slice(`cms/`.length); await this.deleteMetadata(contentKey); } @@ -829,7 +829,7 @@ export default class API { // open authoring branches can exist without a pr const cmsBranches: Octokit.GitListMatchingRefsResponse = await this.getOpenAuthoringBranches(); - branches = cmsBranches.map(b => b.ref.substring('refs/heads/'.length)); + branches = cmsBranches.map(b => b.ref.slice('refs/heads/'.length)); // filter irrelevant branches const branchesWithFilter = await Promise.all( branches.map(b => this.filterOpenAuthoringBranches(b)), diff --git a/packages/netlify-cms-backend-github/src/__tests__/API.spec.js b/packages/netlify-cms-backend-github/src/__tests__/API.spec.js index 2537589e..49db20a6 100644 --- a/packages/netlify-cms-backend-github/src/__tests__/API.spec.js +++ b/packages/netlify-cms-backend-github/src/__tests__/API.spec.js @@ -11,7 +11,7 @@ describe('github API', () => { function mockAPI(api, responses) { api.request = jest.fn().mockImplementation((path, options = {}) => { - const normalizedPath = path.indexOf('?') !== -1 ? path.substr(0, path.indexOf('?')) : path; + const normalizedPath = path.indexOf('?') !== -1 ? path.slice(0, path.indexOf('?')) : path; const response = responses[normalizedPath]; return typeof response === 'function' ? Promise.resolve(response(options)) diff --git a/packages/netlify-cms-core/src/backend.ts b/packages/netlify-cms-core/src/backend.ts index eed16974..b328dac8 100644 --- a/packages/netlify-cms-core/src/backend.ts +++ b/packages/netlify-cms-core/src/backend.ts @@ -292,7 +292,7 @@ function prepareMetaPath(path: string, collection: Collection) { return path; } const dir = dirname(path); - return dir.substr(collection.get('folder')!.length + 1) || '/'; + return dir.slice(collection.get('folder')!.length + 1) || '/'; } function collectionDepth(collection: Collection) { diff --git a/packages/netlify-cms-core/src/components/Collection/Entries/EntriesCollection.js b/packages/netlify-cms-core/src/components/Collection/Entries/EntriesCollection.js index 07e6aa2e..ccc74094 100644 --- a/packages/netlify-cms-core/src/components/Collection/Entries/EntriesCollection.js +++ b/packages/netlify-cms-core/src/components/Collection/Entries/EntriesCollection.js @@ -117,7 +117,7 @@ export class EntriesCollection extends React.Component { export function filterNestedEntries(path, collectionFolder, entries) { const filtered = entries.filter(e => { - const entryPath = e.get('path').substring(collectionFolder.length + 1); + const entryPath = e.get('path').slice(collectionFolder.length + 1); if (!entryPath.startsWith(path)) { return false; } @@ -125,7 +125,7 @@ export function filterNestedEntries(path, collectionFolder, entries) { // only show immediate children if (path) { // non root path - const trimmed = entryPath.substring(path.length + 1); + const trimmed = entryPath.slice(path.length + 1); return trimmed.split('/').length === 2; } else { // root path diff --git a/packages/netlify-cms-core/src/components/Collection/NestedCollection.js b/packages/netlify-cms-core/src/components/Collection/NestedCollection.js index c4b6029c..dbc81298 100644 --- a/packages/netlify-cms-core/src/components/Collection/NestedCollection.js +++ b/packages/netlify-cms-core/src/components/Collection/NestedCollection.js @@ -144,7 +144,7 @@ export function getTreeData(collection, entries) { const rootFolder = '/'; const entriesObj = entries .toJS() - .map(e => ({ ...e, path: e.path.substring(collectionFolder.length) })); + .map(e => ({ ...e, path: e.path.slice(collectionFolder.length) })); const dirs = entriesObj.reduce((acc, entry) => { let dir = dirname(entry.path); diff --git a/packages/netlify-cms-core/src/formats/frontmatter.ts b/packages/netlify-cms-core/src/formats/frontmatter.ts index 5c6715ed..2cc4945f 100644 --- a/packages/netlify-cms-core/src/formats/frontmatter.ts +++ b/packages/netlify-cms-core/src/formats/frontmatter.ts @@ -27,7 +27,7 @@ const parsers = { parse: (input: string) => { let JSONinput = input.trim(); // Fix JSON if leading and trailing brackets were trimmed. - if (JSONinput.substr(0, 1) !== '{') { + if (JSONinput.slice(0, 1) !== '{') { JSONinput = '{' + JSONinput + '}'; } return jsonFormatter.fromFile(JSONinput); @@ -35,7 +35,8 @@ const parsers = { stringify: (metadata: object) => { let JSONoutput = jsonFormatter.toFile(metadata).trim(); // Trim leading and trailing brackets. - if (JSONoutput.substr(0, 1) === '{' && JSONoutput.substr(-1) === '}') { + if (JSONoutput.slice(0, 1) === '{' && JSONoutput.slice(-1) === '}') { + // eslint-disable-next-line unicorn/prefer-string-slice JSONoutput = JSONoutput.substring(1, JSONoutput.length - 1); } return JSONoutput; @@ -54,8 +55,9 @@ const parsers = { }; function inferFrontmatterFormat(str: string) { - const firstLine = str.substr(0, str.indexOf('\n')).trim(); - if (firstLine.length > 3 && firstLine.substr(0, 3) === '---') { + // eslint-disable-next-line unicorn/prefer-string-slice + const firstLine = str.substring(0, str.indexOf('\n')).trim(); + if (firstLine.length > 3 && firstLine.slice(0, 3) === '---') { // No need to infer, `gray-matter` will handle things like `---toml` for us. return; } @@ -130,6 +132,7 @@ export class FrontmatterFormatter { comments, ...format, }); + // eslint-disable-next-line unicorn/prefer-string-slice return trimLastLineBreak && file.slice(-1) === '\n' ? file.substring(0, file.length - 1) : file; } } diff --git a/packages/netlify-cms-core/src/lib/textHelper.js b/packages/netlify-cms-core/src/lib/textHelper.js index eff09bc2..69352ef9 100644 --- a/packages/netlify-cms-core/src/lib/textHelper.js +++ b/packages/netlify-cms-core/src/lib/textHelper.js @@ -7,5 +7,6 @@ export function stringToRGB(str) { const c = (hash & 0x00ffffff).toString(16).toUpperCase(); + // eslint-disable-next-line unicorn/prefer-string-slice return '00000'.substring(0, 6 - c.length) + c; } diff --git a/packages/netlify-cms-lib-util/src/APIUtils.ts b/packages/netlify-cms-lib-util/src/APIUtils.ts index 49a9a0c2..a604630d 100644 --- a/packages/netlify-cms-lib-util/src/APIUtils.ts +++ b/packages/netlify-cms-lib-util/src/APIUtils.ts @@ -13,7 +13,7 @@ export function isCMSLabel(label: string, labelPrefix: string) { } export function labelToStatus(label: string, labelPrefix: string) { - return label.substr(getLabelPrefix(labelPrefix).length); + return label.slice(getLabelPrefix(labelPrefix).length); } export function statusToLabel(status: string, labelPrefix: string) { @@ -26,11 +26,11 @@ export function generateContentKey(collectionName: string, slug: string) { export function parseContentKey(contentKey: string) { const index = contentKey.indexOf('/'); - return { collection: contentKey.substr(0, index), slug: contentKey.substr(index + 1) }; + return { collection: contentKey.slice(0, index), slug: contentKey.slice(index + 1) }; } export function contentKeyFromBranch(branch: string) { - return branch.substring(`${CMS_BRANCH_PREFIX}/`.length); + return branch.slice(`${CMS_BRANCH_PREFIX}/`.length); } export function branchFromContentKey(contentKey: string) { diff --git a/packages/netlify-cms-lib-util/src/path.ts b/packages/netlify-cms-lib-util/src/path.ts index 7d4caff0..7353d2ea 100644 --- a/packages/netlify-cms-lib-util/src/path.ts +++ b/packages/netlify-cms-lib-util/src/path.ts @@ -36,9 +36,9 @@ export function basename(p: string, ext = '') { } // Remove the extension, if need be. if (ext.length > 0) { - const lastPartExt = lastPart.substr(lastPart.length - ext.length); + const lastPartExt = lastPart.slice(-ext.length); if (lastPartExt === ext) { - return lastPart.substr(0, lastPart.length - ext.length); + return lastPart.slice(0, -ext.length); } } return lastPart; @@ -68,7 +68,7 @@ export function fileExtensionWithSeparator(p: string) { if (i === -1 || i === 0) { return ''; } - return p.substr(i); + return p.slice(i); } /** @@ -82,5 +82,5 @@ export function fileExtensionWithSeparator(p: string) { */ export function fileExtension(p: string) { const ext = fileExtensionWithSeparator(p); - return ext === '' ? ext : ext.substr(1); + return ext === '' ? ext : ext.slice(1); } diff --git a/packages/netlify-cms-lib-widgets/src/stringTemplate.ts b/packages/netlify-cms-lib-widgets/src/stringTemplate.ts index 1b08e202..43f16a16 100644 --- a/packages/netlify-cms-lib-widgets/src/stringTemplate.ts +++ b/packages/netlify-cms-lib-widgets/src/stringTemplate.ts @@ -135,7 +135,7 @@ function getExplicitFieldReplacement(key: string, data: Map) { if (!key.startsWith(FIELD_PREFIX)) { return; } - const fieldName = key.substring(FIELD_PREFIX.length); + const fieldName = key.slice(FIELD_PREFIX.length); const value = data.getIn(keyToPathArray(fieldName)); if (typeof value === 'object' && value !== null) { return JSON.stringify(value); @@ -241,7 +241,7 @@ export function addFileTemplateFields(entryPath: string, fields: Map { map.set('dirname', dirnameExcludingFolder); map.set('filename', filename); - map.set('extension', extension === '' ? extension : extension.substr(1)); + map.set('extension', extension === '' ? extension : extension.slice(1)); }); return fields; diff --git a/packages/netlify-cms-proxy-server/src/middlewares/utils/fs.ts b/packages/netlify-cms-proxy-server/src/middlewares/utils/fs.ts index 73f4f6cc..a15c1e09 100644 --- a/packages/netlify-cms-proxy-server/src/middlewares/utils/fs.ts +++ b/packages/netlify-cms-proxy-server/src/middlewares/utils/fs.ts @@ -29,7 +29,7 @@ export async function listRepoFiles( depth: number, ) { const files = await listFiles(path.join(repoPath, folder), extension, depth); - return files.map(f => f.substr(repoPath.length + 1)); + return files.map(f => f.slice(repoPath.length + 1)); } export async function writeFile(filePath: string, content: Buffer | string) { diff --git a/packages/netlify-cms-widget-file/src/withFileControl.js b/packages/netlify-cms-widget-file/src/withFileControl.js index 00932830..32a15af0 100644 --- a/packages/netlify-cms-widget-file/src/withFileControl.js +++ b/packages/netlify-cms-widget-file/src/withFileControl.js @@ -319,6 +319,7 @@ export default function withFileControl({ forImage } = {}) { if (!value || value.length <= size) { return value; } + // eslint-disable-next-line unicorn/prefer-string-slice const text = `${value.substring(0, size / 2)}\u2026${value.substring( value.length - size / 2 + 1, value.length, diff --git a/packages/netlify-cms-widget-markdown/src/serializers/slateRemark.js b/packages/netlify-cms-widget-markdown/src/serializers/slateRemark.js index 8ef3be34..c2236ea8 100644 --- a/packages/netlify-cms-widget-markdown/src/serializers/slateRemark.js +++ b/packages/netlify-cms-widget-markdown/src/serializers/slateRemark.js @@ -177,7 +177,9 @@ export default function slateToRemark(raw, { voidCodeBlock }) { const index = node.text.search(exp); if (index > -1) { const substringIndex = trailing ? index : index + 1; + // eslint-disable-next-line unicorn/prefer-string-slice const firstSplit = node.text.substring(0, substringIndex); + // eslint-disable-next-line unicorn/prefer-string-slice const secondSplit = node.text.substring(substringIndex); const whitespace = trailing ? secondSplit : firstSplit; const text = trailing ? firstSplit : secondSplit; diff --git a/scripts/webpack.js b/scripts/webpack.js index d3a1b9fc..b2acfed8 100644 --- a/scripts/webpack.js +++ b/scripts/webpack.js @@ -138,7 +138,7 @@ function baseConfig({ target = isProduction ? 'umd' : 'umddir' } = {}) { * Exclude peer dependencies from package bundles. */ externals: - target.substr(0, 3) === 'umd' + target.slice(0, 3) === 'umd' ? umdExternals : (context, request, cb) => { const externals = Object.keys(pkg.peerDependencies || {}); diff --git a/yarn.lock b/yarn.lock index c90e589e..470d30b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -26,13 +26,6 @@ "@nicolo-ribaudo/chokidar-2" "2.1.8-no-fsevents.3" chokidar "^3.4.0" -"@babel/code-frame@7.12.11": - version "7.12.11" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" - integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== - dependencies: - "@babel/highlight" "^7.10.4" - "@babel/code-frame@7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" @@ -305,7 +298,7 @@ dependencies: "@babel/types" "^7.16.7" -"@babel/helper-validator-identifier@^7.16.7": +"@babel/helper-validator-identifier@^7.15.7", "@babel/helper-validator-identifier@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad" integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== @@ -334,7 +327,7 @@ "@babel/traverse" "^7.17.3" "@babel/types" "^7.17.0" -"@babel/highlight@^7.0.0", "@babel/highlight@^7.10.4", "@babel/highlight@^7.16.7": +"@babel/highlight@^7.0.0", "@babel/highlight@^7.16.7": version "7.16.10" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.16.10.tgz#744f2eb81579d6eea753c227b0f570ad785aba88" integrity sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw== @@ -1534,18 +1527,18 @@ resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz#8eed982e2ee6f7f4e44c253e12962980791efd46" integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA== -"@eslint/eslintrc@^0.4.3": - version "0.4.3" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" - integrity sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw== +"@eslint/eslintrc@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.2.1.tgz#8b5e1c49f4077235516bc9ec7d41378c0f69b8c6" + integrity sha512-bxvbYnBPN1Gibwyp6NrpnFzA3YtRL3BBAyEAFVIpNTm2Rn4Vy87GA5M4aSn3InRrlsbX5N0GW7XIx+U4SAEKdQ== dependencies: ajv "^6.12.4" - debug "^4.1.1" - espree "^7.3.0" + debug "^4.3.2" + espree "^9.3.1" globals "^13.9.0" - ignore "^4.0.6" + ignore "^5.2.0" import-fresh "^3.2.1" - js-yaml "^3.13.1" + js-yaml "^4.1.0" minimatch "^3.0.4" strip-json-comments "^3.1.1" @@ -1594,16 +1587,16 @@ dependencies: "@hapi/hoek" "^9.0.0" -"@humanwhocodes/config-array@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9" - integrity sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg== +"@humanwhocodes/config-array@^0.9.2": + version "0.9.5" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.9.5.tgz#2cbaf9a89460da24b5ca6531b8bbfc23e1df50c7" + integrity sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw== dependencies: - "@humanwhocodes/object-schema" "^1.2.0" + "@humanwhocodes/object-schema" "^1.2.1" debug "^4.1.1" minimatch "^3.0.4" -"@humanwhocodes/object-schema@^1.2.0": +"@humanwhocodes/object-schema@^1.2.1": version "1.2.1" resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== @@ -4266,12 +4259,12 @@ acorn@^6.4.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ== -acorn@^7.1.1, acorn@^7.4.0: +acorn@^7.1.1: version "7.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.2.4, acorn@^8.4.1: +acorn@^8.2.4, acorn@^8.4.1, acorn@^8.7.0: version "8.7.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.0.tgz#90951fde0f8f09df93549481e5fc141445b791cf" integrity sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ== @@ -5771,6 +5764,11 @@ bufferutil@^4.0.1: dependencies: node-gyp-build "^4.3.0" +builtin-modules@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.2.0.tgz#45d5db99e7ee5e6bc4f362e008bf917ab5049887" + integrity sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA== + builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" @@ -6158,7 +6156,7 @@ ci-info@^2.0.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== -ci-info@^3.2.0: +ci-info@^3.2.0, ci-info@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.3.0.tgz#b4ed1fb6818dea4803a55c623041f9165d2066b2" integrity sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw== @@ -6193,6 +6191,13 @@ clean-css@^4.2.3: dependencies: source-map "~0.6.0" +clean-regexp@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/clean-regexp/-/clean-regexp-1.0.0.tgz#8df7c7aae51fd36874e8f8d05b9180bc11a3fed7" + integrity sha1-jffHquUf02h06PjQW5GAvBGj/tc= + dependencies: + escape-string-regexp "^1.0.5" + clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" @@ -7267,7 +7272,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.8, debug@^2.6. dependencies: ms "2.0.0" -debug@4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.1, debug@^4.3.1: +debug@4, debug@^4.0.0, debug@^4.1.1, debug@^4.3.1: version "4.3.3" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== @@ -7288,7 +7293,7 @@ debug@^3.0.0, debug@^3.1.0, debug@^3.1.1, debug@^3.2.5, debug@^3.2.7: dependencies: ms "^2.1.1" -debug@^4.1.0, debug@^4.3.2, debug@^4.3.4: +debug@^4.1.0, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -7939,7 +7944,7 @@ enhanced-resolve@^5.7.0: graceful-fs "^4.2.4" tapable "^2.2.0" -enquirer@^2.3.5, enquirer@^2.3.6: +enquirer@^2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== @@ -8205,6 +8210,26 @@ eslint-plugin-react@^7.17.0: semver "^6.3.0" string.prototype.matchall "^4.0.6" +eslint-plugin-unicorn@^41.0.1: + version "41.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-41.0.1.tgz#b49205b38e71e227d21fb5776f8d078a1dc637ca" + integrity sha512-gF5vo2dIj0YdNMQ/IMegiBkQdQ22GBFFVpdkJP+0og3w7XD4ypea0xQVRv6iofkLVR2w0phAdikcnU01ybd4Ow== + dependencies: + "@babel/helper-validator-identifier" "^7.15.7" + ci-info "^3.3.0" + clean-regexp "^1.0.0" + eslint-utils "^3.0.0" + esquery "^1.4.0" + indent-string "^4.0.0" + is-builtin-module "^3.1.0" + lodash "^4.17.21" + pluralize "^8.0.0" + read-pkg-up "^7.0.1" + regexp-tree "^0.1.24" + safe-regex "^2.1.1" + semver "^7.3.5" + strip-indent "^3.0.0" + eslint-rule-composer@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9" @@ -8234,12 +8259,13 @@ eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-utils@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" - integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== +eslint-scope@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" + integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== dependencies: - eslint-visitor-keys "^1.1.0" + esrecurse "^4.3.0" + estraverse "^5.2.0" eslint-utils@^3.0.0: version "3.0.0" @@ -8248,7 +8274,7 @@ eslint-utils@^3.0.0: dependencies: eslint-visitor-keys "^2.0.0" -eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: +eslint-visitor-keys@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== @@ -8258,65 +8284,60 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== -eslint-visitor-keys@^3.0.0: +eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@^7.0.0: - version "7.32.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" - integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA== +eslint@^8.12.0: + version "8.12.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.12.0.tgz#c7a5bd1cfa09079aae64c9076c07eada66a46e8e" + integrity sha512-it1oBL9alZg1S8UycLm5YDMAkIhtH6FtAzuZs6YvoGVldWjbS08BkAdb/ymP9LlAyq8koANu32U7Ib/w+UNh8Q== dependencies: - "@babel/code-frame" "7.12.11" - "@eslint/eslintrc" "^0.4.3" - "@humanwhocodes/config-array" "^0.5.0" + "@eslint/eslintrc" "^1.2.1" + "@humanwhocodes/config-array" "^0.9.2" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" - debug "^4.0.1" + debug "^4.3.2" doctrine "^3.0.0" - enquirer "^2.3.5" escape-string-regexp "^4.0.0" - eslint-scope "^5.1.1" - eslint-utils "^2.1.0" - eslint-visitor-keys "^2.0.0" - espree "^7.3.1" + eslint-scope "^7.1.1" + eslint-utils "^3.0.0" + eslint-visitor-keys "^3.3.0" + espree "^9.3.1" esquery "^1.4.0" esutils "^2.0.2" fast-deep-equal "^3.1.3" file-entry-cache "^6.0.1" functional-red-black-tree "^1.0.1" - glob-parent "^5.1.2" + glob-parent "^6.0.1" globals "^13.6.0" - ignore "^4.0.6" + ignore "^5.2.0" import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" - js-yaml "^3.13.1" + js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" lodash.merge "^4.6.2" minimatch "^3.0.4" natural-compare "^1.4.0" optionator "^0.9.1" - progress "^2.0.0" - regexpp "^3.1.0" - semver "^7.2.1" - strip-ansi "^6.0.0" + regexpp "^3.2.0" + strip-ansi "^6.0.1" strip-json-comments "^3.1.0" - table "^6.0.9" text-table "^0.2.0" v8-compile-cache "^2.0.3" -espree@^7.3.0, espree@^7.3.1: - version "7.3.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" - integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== +espree@^9.3.1: + version "9.3.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.3.1.tgz#8793b4bc27ea4c778c19908e0719e7b8f4115bcd" + integrity sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ== dependencies: - acorn "^7.4.0" + acorn "^8.7.0" acorn-jsx "^5.3.1" - eslint-visitor-keys "^1.3.0" + eslint-visitor-keys "^3.3.0" esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" @@ -9369,6 +9390,13 @@ glob-parent@^5.1.1, glob-parent@^5.1.2, glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" +glob-parent@^6.0.1: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + glob-to-regexp@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" @@ -10144,11 +10172,6 @@ ignore@^3.3.5: resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== -ignore@^4.0.6: - version "4.0.6" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" - integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== - ignore@^5.1.8, ignore@^5.1.9, ignore@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" @@ -10477,6 +10500,13 @@ is-buffer@^2.0.0: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== +is-builtin-module@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.1.0.tgz#6fdb24313b1c03b75f8b9711c0feb8c30b903b00" + integrity sha512-OV7JjAgOTfAFJmHZLvpSTb4qi0nIILDV1gWPYDnDJUTNFM5aGlRAhk4QcT8i7TuAleeEV5Fdkqn3t4mS+Q11fg== + dependencies: + builtin-modules "^3.0.0" + is-callable@^1.1.4, is-callable@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945" @@ -11539,7 +11569,7 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^4.0.0: +js-yaml@^4.0.0, js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== @@ -14331,6 +14361,11 @@ plist@^3.0.1: base64-js "^1.5.1" xmlbuilder "^9.0.7" +pluralize@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" + integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== + pngjs@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.4.0.tgz#99ca7d725965fb655814eaf65f38f12bbdbf555f" @@ -14578,11 +14613,6 @@ process@^0.11.10: resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= -progress@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" - integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== - promise-inflight@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" @@ -15643,6 +15673,11 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" +regexp-tree@^0.1.24, regexp-tree@~0.1.1: + version "0.1.24" + resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.24.tgz#3d6fa238450a4d66e5bc9c4c14bb720e2196829d" + integrity sha512-s2aEVuLhvnVJW6s/iPgEGK6R+/xngd2jNQ+xy4bXNDKxZKJH6jpPHY6kVeVv1IeLCHgswRj+Kl3ELaDjG6V1iw== + regexp.prototype.flags@^1.2.0, regexp.prototype.flags@^1.3.1: version "1.4.1" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.4.1.tgz#b3f4c0059af9e47eca9f3f660e51d81307e72307" @@ -15651,7 +15686,7 @@ regexp.prototype.flags@^1.2.0, regexp.prototype.flags@^1.3.1: call-bind "^1.0.2" define-properties "^1.1.3" -regexpp@^3.1.0, regexpp@^3.2.0: +regexpp@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== @@ -16117,6 +16152,13 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" +safe-regex@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-2.1.1.tgz#f7128f00d056e2fe5c11e81a1324dd974aadced2" + integrity sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A== + dependencies: + regexp-tree "~0.1.1" + safe-stable-stringify@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz#ab67cbe1fe7d40603ca641c5e765cb942d04fc73" @@ -16238,7 +16280,7 @@ semver@7.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== -semver@7.3.5, semver@7.x, semver@^7.1.1, semver@^7.1.3, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5: +semver@7.3.5, semver@7.x, semver@^7.1.1, semver@^7.1.3, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5: version "7.3.5" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== @@ -17521,7 +17563,7 @@ sywac@^1.2.2: resolved "https://registry.yarnpkg.com/sywac/-/sywac-1.3.0.tgz#324789bdb8bd7d0d66625c9144fce81ab5ba6f99" integrity sha512-LDt2stNTp4bVPMgd70Jj9PWrSa4batl+bv+Ea5NLNGT7ufc4oQPtRfQ73wbddNV6RilaPqnEt6y1Wkm5FVTNEg== -table@^6.0.9, table@^6.8.0: +table@^6.8.0: version "6.8.0" resolved "https://registry.yarnpkg.com/table/-/table-6.8.0.tgz#87e28f14fa4321c3377ba286f07b79b281a3b3ca" integrity sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==