diff --git a/.babelrc.js b/.babelrc.js index 4eb42997a778d..e5e04f5b4fd9e 100644 --- a/.babelrc.js +++ b/.babelrc.js @@ -1,13 +1,13 @@ -let ignore = [`**/dist`] +const ignore = [`**/dist`] // Jest needs to compile this code, but generally we don't want this copied // to output folders -if (process.env.NODE_ENV !== `test`) { - ignore.push(`**/__tests__`) -} +// if (process.env.NODE_ENV !== `test`) { +// ignore.push(`**/__tests__`) +// } module.exports = { sourceMaps: true, - presets: ["babel-preset-gatsby-package"], + presets: [`babel-preset-gatsby-package`], ignore, } diff --git a/.circleci/config.yml b/.circleci/config.yml index 8eaa26d9ebe79..b62fb7c0287c8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -200,7 +200,7 @@ jobs: - run: name: "remove workspaces from package.json" command: | - sed -i ':a;N;$!ba;s/,\n\s*"workspaces":\s\[[^]]*]//g' package.json + sed -i ':a;N;$!ba;s/,\n\s*"workspaces":\s\[[^]]*]/,"workspaces":\["packages\/babel-preset-gatsby"\]/g' package.json - <<: *install_node_modules - run: yarn lint:code - run: yarn lint:docs diff --git a/.eslintignore b/.eslintignore index 1bd8c9b7ab64e..9468f0f87e4d8 100644 --- a/.eslintignore +++ b/.eslintignore @@ -26,6 +26,7 @@ packages/gatsby/cache-dir/commonjs/**/* packages/gatsby-admin/public packages/gatsby/gatsby-admin-public packages/gatsby-codemods/transforms +packages/gatsby-source-graphql/batching packages/gatsby-source-wordpress/test-site/** !packages/gatsby-source-wordpress/test-site/__tests__ diff --git a/.eslintrc.js b/.eslintrc.js index 0f24250a0acc8..d2415067377b8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,23 +1,22 @@ -const TSEslint = require("@typescript-eslint/eslint-plugin") - module.exports = { - parser: "babel-eslint", + parser: `@babel/eslint-parser`, extends: [ - "google", - "eslint:recommended", - "plugin:flowtype/recommended", - "plugin:react/recommended", - "prettier", - "prettier/flowtype", - "prettier/react", + `google`, + `eslint:recommended`, + `plugin:flowtype/recommended`, + `plugin:react/recommended`, + `prettier`, ], - plugins: ["flowtype", "prettier", "react", "filenames"], + plugins: [`flowtype`, `prettier`, `react`, `filenames`, `@babel`], parserOptions: { ecmaVersion: 2016, - sourceType: "module", + sourceType: `module`, ecmaFeatures: { jsx: true, }, + babelOptions: { + configFile: `./.babelrc.js`, + }, }, env: { browser: true, @@ -39,43 +38,63 @@ module.exports = { __ASSET_PREFIX__: true, }, rules: { - "arrow-body-style": [ - "error", - "as-needed", - { requireReturnForObjectLiteral: true }, - ], - "no-unused-expressions": [ - "error", + "@babel/no-unused-expressions": [ + `error`, { allowTaggedTemplates: true, }, ], + "no-unused-expressions": `off`, + "@babel/no-invalid-this": `error`, + "no-invalid-this": `off`, + "arrow-body-style": [ + `error`, + `as-needed`, + { requireReturnForObjectLiteral: true }, + ], + "new-cap": `off`, "no-unused-vars": [ - "warn", + `warn`, { - varsIgnorePattern: "^_", - argsIgnorePattern: "^_", + varsIgnorePattern: `^_`, + argsIgnorePattern: `^_`, ignoreRestSiblings: true, }, ], - "consistent-return": ["error"], - "filenames/match-regex": ["error", "^[a-z-\\d\\.]+$", true], - "no-console": "off", - "no-inner-declarations": "off", - "prettier/prettier": "error", - quotes: ["error", "backtick"], - "react/display-name": "off", - "react/jsx-key": "warn", - "react/no-unescaped-entities": "off", - "react/prop-types": "off", - "require-jsdoc": "off", - "valid-jsdoc": "off", + "consistent-return": [`error`], + "filenames/match-regex": [`error`, `^[a-z-\\d\\.]+$`, true], + "no-console": `off`, + "no-inner-declarations": `off`, + "prettier/prettier": `error`, + quotes: [`error`, `backtick`], + "react/display-name": `off`, + "react/jsx-key": `warn`, + "react/no-unescaped-entities": `off`, + "react/prop-types": `off`, + "require-jsdoc": `off`, + "valid-jsdoc": `off`, + "prefer-promise-reject-errors": `warn`, + "no-prototype-builtins": `warn`, + "guard-for-in": `warn`, + "spaced-comment": [ + `error`, + `always`, + { markers: [`/`], exceptions: [`*`, `+`] }, + ], + camelcase: [ + `error`, + { + properties: `never`, + ignoreDestructuring: true, + allow: [`^unstable_`], + }, + ], }, overrides: [ { files: [ - "packages/**/gatsby-browser.js", - "packages/gatsby/cache-dir/**/*", + `packages/**/gatsby-browser.js`, + `packages/gatsby/cache-dir/**/*`, ], env: { browser: true, @@ -86,106 +105,106 @@ module.exports = { }, }, { - files: ["**/cypress/integration/**/*", "**/cypress/support/**/*"], + files: [`**/cypress/integration/**/*`, `**/cypress/support/**/*`], globals: { cy: false, Cypress: false, }, }, { - files: ["*.ts", "*.tsx"], - parser: "@typescript-eslint/parser", - plugins: ["@typescript-eslint/eslint-plugin"], + files: [`*.ts`, `*.tsx`], + parser: `@typescript-eslint/parser`, + plugins: [`@typescript-eslint/eslint-plugin`], + extends: [`plugin:@typescript-eslint/recommended`], rules: { - ...TSEslint.configs.recommended.rules, // We should absolutely avoid using ts-ignore, but it's not always possible. // particular when a dependencies types are incorrect. "@typescript-eslint/ban-ts-comment": [ - "warn", - { "ts-ignore": "allow-with-description" } + `warn`, + { "ts-ignore": `allow-with-description` }, ], // This rule is great. It helps us not throw on types for areas that are // easily inferrable. However we have a desire to have all function inputs // and outputs declaratively typed. So this let's us ignore the parameters // inferrable lint. "@typescript-eslint/no-inferrable-types": [ - "error", + `error`, { ignoreParameters: true }, ], "@typescript-eslint/ban-types": [ - "error", + `error`, { extendDefaults: true, types: { "{}": { - fixWith: "Record", + fixWith: `Record`, }, object: { - fixWith: "Record", + fixWith: `Record`, }, }, }, ], - "camelcase": "off", + camelcase: `off`, // TODO: These rules allow a lot of stuff and don't really enforce. If we want to apply our styleguide, we'd need to fix a lot of stuff "@typescript-eslint/naming-convention": [ - "error", + `error`, { - selector: "default", - format: ["camelCase"], + selector: `default`, + format: [`camelCase`], }, { - selector: "variable", - format: ["camelCase", "UPPER_CASE", "PascalCase"], - leadingUnderscore: "allowSingleOrDouble", - trailingUnderscore: "allowSingleOrDouble", + selector: `variable`, + format: [`camelCase`, `UPPER_CASE`, `PascalCase`], + leadingUnderscore: `allowSingleOrDouble`, + trailingUnderscore: `allowSingleOrDouble`, }, { - selector: "function", - format: ["camelCase", "PascalCase"], - leadingUnderscore: "allow", + selector: `function`, + format: [`camelCase`, `PascalCase`], + leadingUnderscore: `allow`, }, { - selector: "parameter", - format: ["camelCase", "PascalCase", "snake_case"], - leadingUnderscore: "allowSingleOrDouble", + selector: `parameter`, + format: [`camelCase`, `PascalCase`, `snake_case`], + leadingUnderscore: `allowSingleOrDouble`, }, { - selector: "enumMember", - format: ["camelCase", "UPPER_CASE", "PascalCase"] + selector: `enumMember`, + format: [`camelCase`, `UPPER_CASE`, `PascalCase`], }, { - selector: "typeLike", - format: ["PascalCase"], + selector: `typeLike`, + format: [`PascalCase`], }, { - selector: "typeAlias", - format: ["camelCase", "PascalCase"] + selector: `typeAlias`, + format: [`camelCase`, `PascalCase`], }, { - selector: "property", - format: ["PascalCase", "UPPER_CASE", "camelCase", "snake_case"], - leadingUnderscore: "allowSingleOrDouble", + selector: `property`, + format: [`PascalCase`, `UPPER_CASE`, `camelCase`, `snake_case`], + leadingUnderscore: `allowSingleOrDouble`, }, { - selector: "objectLiteralProperty", - format: ["PascalCase", "UPPER_CASE", "camelCase", "snake_case"], - leadingUnderscore: "allowSingleOrDouble", - trailingUnderscore: "allowSingleOrDouble", + selector: `objectLiteralProperty`, + format: [`PascalCase`, `UPPER_CASE`, `camelCase`, `snake_case`], + leadingUnderscore: `allowSingleOrDouble`, + trailingUnderscore: `allowSingleOrDouble`, }, { - selector: "enum", - format: ["PascalCase", "UPPER_CASE"] + selector: `enum`, + format: [`PascalCase`, `UPPER_CASE`], }, { - selector: "method", - format: ["PascalCase", "camelCase"], - leadingUnderscore: "allowSingleOrDouble", + selector: `method`, + format: [`PascalCase`, `camelCase`], + leadingUnderscore: `allowSingleOrDouble`, }, { - selector: "interface", - format: ["PascalCase"], - prefix: ["I"], + selector: `interface`, + format: [`PascalCase`], + prefix: [`I`], }, ], // This rule tries to prevent using `require()`. However in node code, @@ -193,8 +212,8 @@ module.exports = { // problems in our tests where we often want this functionality for module // mocking. At this point it's easier to have it off and just encourage // using top-level imports via code reviews. - "@typescript-eslint/no-var-requires": "off", - "@typescript-eslint/no-extra-semi": "off", + "@typescript-eslint/no-var-requires": `off`, + "@typescript-eslint/no-extra-semi": `off`, // This rule ensures that typescript types do not have semicolons // at the end of their lines, since our prettier setup is to have no semicolons // e.g., @@ -203,50 +222,50 @@ module.exports = { // + baz: string // } "@typescript-eslint/member-delimiter-style": [ - "error", + `error`, { multiline: { - delimiter: "none", + delimiter: `none`, }, }, ], - "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-empty-function": `off`, // This ensures that we always type the return type of functions // a high level focus of our TS setup is typing fn inputs and outputs. - "@typescript-eslint/explicit-function-return-type": "error", + "@typescript-eslint/explicit-function-return-type": `error`, // This forces us to use interfaces over types aliases for object definitions. // Type is still useful for opaque types // e.g., // type UUID = string "@typescript-eslint/consistent-type-definitions": [ - "error", - "interface", + `error`, + `interface`, ], "@typescript-eslint/no-use-before-define": [ - "error", + `error`, { functions: false }, ], // Allows us to write unions like `type Foo = "baz" | "bar"` // otherwise eslint will want to switch the strings to backticks, // which then crashes the ts compiler - quotes: "off", + quotes: `off`, "@typescript-eslint/quotes": [ 2, - "backtick", + `backtick`, { avoidEscape: true, }, ], // bump to @typescript-eslint/parser started showing Flow related errors in ts(x) files // so disabling them in .ts(x) files - "flowtype/no-types-missing-file-annotation": "off", - "@typescript-eslint/array-type": ["error", { default: "generic" }], + "flowtype/no-types-missing-file-annotation": `off`, + "@typescript-eslint/array-type": [`error`, { default: `generic` }], }, }, ], settings: { react: { - version: "16.9.0", + version: `16.9.0`, }, }, } diff --git a/deprecated-packages/gatsby-plugin-guess-js/src/gatsby-ssr.js b/deprecated-packages/gatsby-plugin-guess-js/src/gatsby-ssr.js index bb32ba5feccb7..4a8817d640564 100644 --- a/deprecated-packages/gatsby-plugin-guess-js/src/gatsby-ssr.js +++ b/deprecated-packages/gatsby-plugin-guess-js/src/gatsby-ssr.js @@ -41,7 +41,7 @@ exports.onRenderBody = ( matchedPages.forEach(p => { if (p && p.componentChunkName) { const fetchKey = `assetsByChunkName[${p.componentChunkName}]` - let chunks = _.get(stats, fetchKey) + const chunks = _.get(stats, fetchKey) componentUrls = [...componentUrls, ...chunks] } }) diff --git a/e2e-tests/development-runtime/src/components/class-component.js b/e2e-tests/development-runtime/src/components/class-component.js index 1bf40e6c9ce16..0c3553b15237b 100644 --- a/e2e-tests/development-runtime/src/components/class-component.js +++ b/e2e-tests/development-runtime/src/components/class-component.js @@ -1,7 +1,6 @@ import React, { Component } from "react" class ClassComponent extends Component { - // eslint-disable-next-line no-undef state = { custom: true, } diff --git a/package.json b/package.json index d69cea3cf8ce7..c6fe66f59b080 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,11 @@ { "devDependencies": { - "@babel/core": "^7.12.3", - "@babel/node": "^7.12.6", - "@babel/plugin-transform-typescript": "^7.12.1", - "@babel/runtime": "^7.12.5", + "@babel/core": "^7.13.8", + "@babel/eslint-parser": "^7.13.8", + "@babel/eslint-plugin": "^7.13.0", + "@babel/node": "^7.13.0", + "@babel/plugin-transform-typescript": "^7.13.0", + "@babel/runtime": "^7.13.9", "@lerna/prompt": "3.18.5", "@types/babel__code-frame": "^7.0.2", "@types/better-queue": "^3.8.2", @@ -27,7 +29,6 @@ "@types/webpack-merge": "^4.1.5", "@typescript-eslint/eslint-plugin": "^4.14.2", "@typescript-eslint/parser": "^4.14.2", - "babel-eslint": "^10.1.0", "babel-jest": "^24.9.0", "chalk": "^4.1.0", "chokidar": "^3.5.1", @@ -35,11 +36,11 @@ "danger": "^10.6.1", "date-fns": "^1.30.1", "dictionary-en": "^3.1.0", - "eslint": "^5.16.0", + "eslint": "^7.21.0", "eslint-config-google": "^0.14.0", - "eslint-config-prettier": "^6.15.0", + "eslint-config-prettier": "^8.1.0", "eslint-plugin-filenames": "^1.3.2", - "eslint-plugin-flowtype": "^3.13.0", + "eslint-plugin-flowtype": "^5.3.1", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-prettier": "^3.3.1", diff --git a/packages/create-gatsby/src/components/form.js b/packages/create-gatsby/src/components/form.js index 01b4fd6dba937..2ffe1018daaa4 100644 --- a/packages/create-gatsby/src/components/form.js +++ b/packages/create-gatsby/src/components/form.js @@ -6,31 +6,32 @@ export class FormInput extends Form { async renderChoice(choice, i) { await this.onChoice(choice, i) - let { state, styles } = this + const { state, styles } = this let { cursor, initial = ``, name, input = `` } = choice - let { muted, submitted, primary, danger } = styles + const { muted, submitted, primary, danger } = styles - let focused = this.index === i - let validate = choice.validate || (() => true) - let sep = await this.choiceSeparator(choice, i) + const focused = this.index === i + const validate = choice.validate || (() => true) + const sep = await this.choiceSeparator(choice, i) let msg = choice.message if (this.align === `right`) msg = msg.padStart(this.longest + 1, ` `) if (this.align === `left`) msg = msg.padEnd(this.longest + 1, ` `) // re-populate the form values (answers) object - let value = (this.values[name] = input || initial) + const value = (this.values[name] = input || initial) let color = input ? `success` : `dark` if ((await validate.call(choice, value, this.state)) !== true) { color = `danger` } - let style = styles[color] - let indicator = style(await this.indicator(choice, i)) + (choice.pad || ``) + const style = styles[color] + const indicator = + style(await this.indicator(choice, i)) + (choice.pad || ``) - let indent = this.indent(choice) - let line = () => + const indent = this.indent(choice) + const line = () => [indent, indicator, msg + sep, input].filter(Boolean).join(` `) if (state.submitted) { @@ -42,8 +43,14 @@ export class FormInput extends Form { if (choice.format) { input = await choice.format.call(this, input, choice, i) } else { - let color = this.styles.muted - let options = { input, initial, pos: cursor, showCursor: focused, color } + const color = this.styles.muted + const options = { + input, + initial, + pos: cursor, + showCursor: focused, + color, + } input = placeholder(this, options) } diff --git a/packages/create-gatsby/src/components/placeholder.js b/packages/create-gatsby/src/components/placeholder.js index e16f6d7315c92..8ba2505859316 100644 --- a/packages/create-gatsby/src/components/placeholder.js +++ b/packages/create-gatsby/src/components/placeholder.js @@ -22,11 +22,11 @@ export default (prompt, options = {}) => { prompt.cursorHide() let { input = ``, initial = ``, pos, showCursor = true, color } = options - let style = color || prompt.styles.placeholder - let inverse = prompt.styles.primary.inverse + const style = color || prompt.styles.placeholder + const inverse = prompt.styles.primary.inverse let blinker = str => inverse(str) let output = input - let char = ` ` + const char = ` ` let reverse = blinker(char) if (prompt.blink && prompt.blink.off === true) { @@ -45,7 +45,7 @@ export default (prompt, options = {}) => { initial = isPrimitive(initial) ? `${initial}` : `` input = isPrimitive(input) ? `${input}` : `` - let placeholder = initial && initial.startsWith(input) && initial !== input + const placeholder = initial && initial.startsWith(input) && initial !== input let cursor = placeholder ? blinker(initial[input.length]) : reverse if (pos !== input.length && showCursor === true) { @@ -58,7 +58,7 @@ export default (prompt, options = {}) => { } if (placeholder) { - let raw = prompt.styles.unstyle(output + cursor) + const raw = prompt.styles.unstyle(output + cursor) return output + cursor + style(initial.slice(raw.length)) } diff --git a/packages/gatsby-admin/src/components/recipes-gui/index.js b/packages/gatsby-admin/src/components/recipes-gui/index.js index c9544981176ef..b60660845281c 100644 --- a/packages/gatsby-admin/src/components/recipes-gui/index.js +++ b/packages/gatsby-admin/src/components/recipes-gui/index.js @@ -19,15 +19,15 @@ import Step from "./recipe-step" import { components, removeJsx, log } from "./utils" import ResourceMessage from "./resource-message" -let isSubscriptionConnected = false +const isSubscriptionConnected = false let isRecipeStarted = false let sessionId let sendEvent let projectRoot -let api_endpoint +let apiEndpoint const checkServerSession = async () => { - const response = await fetch(`${api_endpoint}/session`) + const response = await fetch(`${apiEndpoint}/session`) const newSessionId = await response.text() if (!sessionId) { sessionId = newSessionId @@ -84,7 +84,7 @@ const RecipeInterpreter = ({ recipe }) => { .then(json => { if (json.metadata) projectRoot = json.metadata.sitePath if (json.recipesgraphqlserver) { - api_endpoint = `http://localhost:${json.recipesgraphqlserver.port}` + apiEndpoint = `http://localhost:${json.recipesgraphqlserver.port}` const newClient = createUrqlClient({ port: json.recipesgraphqlserver.port, connectionCallback: async () => { @@ -182,7 +182,7 @@ const RecipeInterpreter = ({ recipe }) => { }) } - let { plan, stepsAsJS, exports } = state.context + const { plan, stepsAsJS, exports } = state.context const groupedPlansByResource = lodash.groupBy(plan, p => p.resourceName) diff --git a/packages/gatsby-cli/src/reporter/redux/__tests__/integration.ts b/packages/gatsby-cli/src/reporter/redux/__tests__/integration.ts index 4a6f595a218ed..2881ba847566b 100644 --- a/packages/gatsby-cli/src/reporter/redux/__tests__/integration.ts +++ b/packages/gatsby-cli/src/reporter/redux/__tests__/integration.ts @@ -4,7 +4,8 @@ import { ISetStatus } from "../types" jest.useFakeTimers() describe(`integration`, () => { - let dispatchSpy, internalActions + let dispatchSpy + let internalActions const getDispatchedSetStatusActions = (): Array => dispatchSpy.mock.calls diff --git a/packages/gatsby-cli/src/reporter/redux/__tests__/internal-actions.ts b/packages/gatsby-cli/src/reporter/redux/__tests__/internal-actions.ts index 7e2dc75b1bbf6..4d96df564b956 100644 --- a/packages/gatsby-cli/src/reporter/redux/__tests__/internal-actions.ts +++ b/packages/gatsby-cli/src/reporter/redux/__tests__/internal-actions.ts @@ -107,7 +107,7 @@ describe(`setStatus action creator`, () => { jest.runOnlyPendingTimers() - //we are still in progress, so we shouldn't emit anything other than initial IN_PROGRESS + // we are still in progress, so we shouldn't emit anything other than initial IN_PROGRESS expect(dispatch).toHaveBeenCalledTimes(1) }) }) diff --git a/packages/gatsby-cli/src/reporter/redux/index.ts b/packages/gatsby-cli/src/reporter/redux/index.ts index 3c6fa020b3cc8..227ec01bd4b4c 100644 --- a/packages/gatsby-cli/src/reporter/redux/index.ts +++ b/packages/gatsby-cli/src/reporter/redux/index.ts @@ -41,7 +41,6 @@ export const dispatch = (action: ActionsUnion | Thunk): void => { action = { ...action, - // eslint-disable-next-line @typescript-eslint/ban-ts-ignore // @ts-ignore this is a typescript no-no.. // And i'm pretty sure this timestamp isn't used anywhere. // but for now, the structured logs integration tests expect it diff --git a/packages/gatsby-cli/src/reporter/redux/internal-actions.ts b/packages/gatsby-cli/src/reporter/redux/internal-actions.ts index 51700f8204cfc..c36c9f28ad546 100644 --- a/packages/gatsby-cli/src/reporter/redux/internal-actions.ts +++ b/packages/gatsby-cli/src/reporter/redux/internal-actions.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/camelcase */ - import uuidv4 from "uuid" import { trackCli } from "gatsby-telemetry" import signalExit from "signal-exit" diff --git a/packages/gatsby-codemods/src/transforms/gatsby-plugin-image.js b/packages/gatsby-codemods/src/transforms/gatsby-plugin-image.js index cbd96f2778297..cf79756330384 100644 --- a/packages/gatsby-codemods/src/transforms/gatsby-plugin-image.js +++ b/packages/gatsby-codemods/src/transforms/gatsby-plugin-image.js @@ -329,7 +329,7 @@ function processArguments(queryArguments, fragment, layout, state) { } queryArguments.push(placeholderArgument) } - let transformOptionsToNest = [] + const transformOptionsToNest = [] let newLayout = layout queryArguments.forEach((argument, index) => { if (argument.name.value === `maxWidth`) { diff --git a/packages/gatsby-codemods/src/transforms/global-graphql-calls.js b/packages/gatsby-codemods/src/transforms/global-graphql-calls.js index be5dd74bf8323..8c77c630ad444 100644 --- a/packages/gatsby-codemods/src/transforms/global-graphql-calls.js +++ b/packages/gatsby-codemods/src/transforms/global-graphql-calls.js @@ -8,20 +8,20 @@ function findGatsbyRequire(root, j) { }, }) - let string = requires.find(j.VariableDeclarator, { + const string = requires.find(j.VariableDeclarator, { init: { arguments: [{ value: MODULE_NAME }] }, }) if (string.length) return string // require(`gatsby`) return requires.filter(path => { - let template = path.get(`init`, `arguments`, 0, `quasis`, 0).node + const template = path.get(`init`, `arguments`, 0, `quasis`, 0).node return !!template && template.value.raw === MODULE_NAME }) } function addEsmImport(j, root, tag) { - let existingImport = root.find(j.ImportDeclaration, { + const existingImport = root.find(j.ImportDeclaration, { source: { value: `gatsby` }, }) @@ -46,7 +46,7 @@ function addEsmImport(j, root, tag) { const namespace = existingImport.find(j.ImportNamespaceSpecifier) if (namespace.length) { - let { name } = namespace.get(0).node.local + const { name } = namespace.get(0).node.local root .find(j.TaggedTemplateExpression, { tag: { name: `graphql` } }) .replaceWith(({ node }) => { @@ -58,14 +58,14 @@ function addEsmImport(j, root, tag) { }) return } - let { specifiers } = existingImport.get(0).node + const { specifiers } = existingImport.get(0).node existingImport .get(`specifiers`, specifiers.length - 1) .insertAfter(j.importSpecifier(j.identifier(IMPORT_NAME))) } function addRequire(j, root, tag) { - let existingImport = findGatsbyRequire(root, j) + const existingImport = findGatsbyRequire(root, j) if (existingImport.find(j.Identifier, { value: IMPORT_NAME }).length) return // already exists @@ -84,7 +84,7 @@ function addRequire(j, root, tag) { const pattern = existingImport.find(j.ObjectPattern) if (!pattern.length) { - let { name } = existingImport.get(`id`).node + const { name } = existingImport.get(`id`).node root .find(j.TaggedTemplateExpression, { tag: { name: `graphql` } }) .replaceWith(({ node }) => { @@ -96,8 +96,8 @@ function addRequire(j, root, tag) { }) return } - let { properties } = pattern.get(0).node - let property = j.objectProperty( + const { properties } = pattern.get(0).node + const property = j.objectProperty( j.identifier(IMPORT_NAME), j.identifier(IMPORT_NAME) ) @@ -115,7 +115,7 @@ module.exports = (file, api, options) => { if (!tags.length) return false - let tag = tags.get(0) + const tag = tags.get(0) const useImportSyntax = root.find(j.ImportDeclaration, { importKind: `value` }).length > 0 || diff --git a/packages/gatsby-codemods/src/transforms/import-link.js b/packages/gatsby-codemods/src/transforms/import-link.js index 693db1519fdcf..90263486f3221 100644 --- a/packages/gatsby-codemods/src/transforms/import-link.js +++ b/packages/gatsby-codemods/src/transforms/import-link.js @@ -8,14 +8,14 @@ function findGatsbyRequire(root, j) { }, }) - let string = requires.find(j.VariableDeclarator, { + const string = requires.find(j.VariableDeclarator, { init: { arguments: [{ value: MODULE_NAME }] }, }) if (string.length) return string // require(`gatsby`) return requires.filter(path => { - let template = path.get(`init`, `arguments`, 0, `quasis`, 0).node + const template = path.get(`init`, `arguments`, 0, `quasis`, 0).node return !!template && template.value.raw === MODULE_NAME }) } @@ -25,7 +25,7 @@ function getFirstNode(j, root) { } function addEsmImport(j, root) { - let existingImport = root.find(j.ImportDeclaration, { + const existingImport = root.find(j.ImportDeclaration, { source: { value: `gatsby` }, }) @@ -60,7 +60,7 @@ function addEsmImport(j, root) { const namespace = existingImport.find(j.ImportNamespaceSpecifier) if (namespace.length) { - let { name } = namespace.get(0).node.local + const { name } = namespace.get(0).node.local root .find(j.JSXIdentifier, { name: IMPORT_NAME }) .replaceWith(({ node }) => { @@ -69,7 +69,7 @@ function addEsmImport(j, root) { }) return } - let { specifiers } = existingImport.get(0).node + const { specifiers } = existingImport.get(0).node existingImport .get(`specifiers`, specifiers.length - 1) .insertAfter(j.importSpecifier(j.identifier(IMPORT_NAME))) @@ -111,7 +111,7 @@ function removeGatsbyLinkRequire(j, root) { } function addRequire(j, root) { - let existingImport = findGatsbyRequire(root, j) + const existingImport = findGatsbyRequire(root, j) if (existingImport.find(j.Identifier, { value: IMPORT_NAME }).length) return // already exists @@ -130,7 +130,7 @@ function addRequire(j, root) { const pattern = existingImport.find(j.ObjectPattern) if (!pattern.length) { - let { name } = existingImport.get(`id`).node + const { name } = existingImport.get(`id`).node root .find(j.JSXIdentifier, { name: IMPORT_NAME }) .replaceWith(({ node }) => { @@ -139,8 +139,8 @@ function addRequire(j, root) { }) return } - let { properties } = pattern.get(0).node - let property = j.objectProperty( + const { properties } = pattern.get(0).node + const property = j.objectProperty( j.identifier(IMPORT_NAME), j.identifier(IMPORT_NAME) ) diff --git a/packages/gatsby-codemods/src/transforms/navigate-calls.js b/packages/gatsby-codemods/src/transforms/navigate-calls.js index ce8c4cf6ee8d6..3e3a36064dec5 100644 --- a/packages/gatsby-codemods/src/transforms/navigate-calls.js +++ b/packages/gatsby-codemods/src/transforms/navigate-calls.js @@ -62,7 +62,7 @@ const addGatsbyImport = (j, root) => { if (!gatsbyImport.length) { const [first] = getFirstNode(j, root) - let statement = j.importDeclaration( + const statement = j.importDeclaration( [j.importSpecifier(j.identifier(METHOD))], j.literal(MODULE_NAME) ) @@ -86,7 +86,7 @@ const addGatsbyRequire = (j, root, requires) => { if (!gatsbyRequire.length) { const [first] = getFirstNode(j, root) - let statement = j.template.statement([ + const statement = j.template.statement([ `const { ${METHOD} } = require('${MODULE_NAME}');\n`, ]) first.insertAfter(statement) diff --git a/packages/gatsby-cypress/src/api-handler.js b/packages/gatsby-cypress/src/api-handler.js index b77551384ae2a..1105e8f18b1f9 100644 --- a/packages/gatsby-cypress/src/api-handler.js +++ b/packages/gatsby-cypress/src/api-handler.js @@ -1,3 +1,4 @@ +/* eslint-disable @babel/no-invalid-this */ let resolve = null let awaitingAPI = null diff --git a/packages/gatsby-design-tokens/src/media-queries.js b/packages/gatsby-design-tokens/src/media-queries.js index d9223c271193f..be1e009b03ab8 100644 --- a/packages/gatsby-design-tokens/src/media-queries.js +++ b/packages/gatsby-design-tokens/src/media-queries.js @@ -1,7 +1,7 @@ import { breakpoints } from "./breakpoints" -let mq = {} -for (let breakpoint in breakpoints) { +const mq = {} +for (const breakpoint in breakpoints) { mq[breakpoint] = `@media (min-width: ${breakpoints[breakpoint]})` } diff --git a/packages/gatsby-dev-cli/src/index.js b/packages/gatsby-dev-cli/src/index.js index 7690a2f28adcb..3c6f003ae448c 100644 --- a/packages/gatsby-dev-cli/src/index.js +++ b/packages/gatsby-dev-cli/src/index.js @@ -86,7 +86,7 @@ const monoRepoPackages = fs.readdirSync(path.join(gatsbyLocation, `packages`)) const localPkg = JSON.parse(fs.readFileSync(`package.json`)) // intersect dependencies with monoRepoPackages to get list of packages that are used -let localPackages = _.intersection( +const localPackages = _.intersection( monoRepoPackages, Object.keys(_.merge({}, localPkg.dependencies, localPkg.devDependencies)) ) diff --git a/packages/gatsby-dev-cli/src/local-npm-registry/index.js b/packages/gatsby-dev-cli/src/local-npm-registry/index.js index 334b42d7a9bd6..f1fcf45725c16 100644 --- a/packages/gatsby-dev-cli/src/local-npm-registry/index.js +++ b/packages/gatsby-dev-cli/src/local-npm-registry/index.js @@ -55,7 +55,7 @@ exports.publishPackagesLocallyAndInstall = async ({ const newlyPublishedPackageVersions = {} - for (let packageName of packagesToPublish) { + for (const packageName of packagesToPublish) { newlyPublishedPackageVersions[packageName] = await publishPackage({ packageName, packagesToPublish, diff --git a/packages/gatsby-dev-cli/src/watch.js b/packages/gatsby-dev-cli/src/watch.js index 2e81881806366..58f26d13adf9e 100644 --- a/packages/gatsby-dev-cli/src/watch.js +++ b/packages/gatsby-dev-cli/src/watch.js @@ -129,7 +129,7 @@ async function watch( ? _.intersection(packages, seenPackages) : seenPackages - let ignoredPackageJSON = new Map() + const ignoredPackageJSON = new Map() const ignorePackageJSONChanges = (packageName, contentArray) => { ignoredPackageJSON.set(packageName, contentArray) @@ -295,7 +295,7 @@ async function watch( return } - let localCopies = [copyPath(filePath, newPath, quiet, packageName)] + const localCopies = [copyPath(filePath, newPath, quiet, packageName)] // If this is from "cache-dir" also copy it into the site's .cache if (_.includes(filePath, `cache-dir`)) { diff --git a/packages/gatsby-graphiql-explorer/src/app/app.js b/packages/gatsby-graphiql-explorer/src/app/app.js index 199e6e5c79c7c..a39db9a02c966 100644 --- a/packages/gatsby-graphiql-explorer/src/app/app.js +++ b/packages/gatsby-graphiql-explorer/src/app/app.js @@ -21,7 +21,7 @@ window.location.search .substr(1) .split(`&`) .forEach(function (entry) { - var eq = entry.indexOf(`=`) + const eq = entry.indexOf(`=`) if (eq >= 0) { parameters[decodeURIComponent(entry.slice(0, eq))] = decodeURIComponent( entry.slice(eq + 1) @@ -48,7 +48,7 @@ const graphqlParamNames = { explorerIsOpen: true, } const otherParams = {} -for (var k in parameters) { +for (const k in parameters) { if (parameters.hasOwnProperty(k) && graphqlParamNames[k] !== true) { otherParams[k] = parameters[k] } diff --git a/packages/gatsby-image/src/index.js b/packages/gatsby-image/src/index.js index 237db60cb2861..cd4b732d410e1 100644 --- a/packages/gatsby-image/src/index.js +++ b/packages/gatsby-image/src/index.js @@ -20,7 +20,7 @@ const logDeprecationNotice = (prop, replacement) => { // Handle legacy props during their deprecation phase const convertProps = props => { - let convertedProps = { ...props } + const convertedProps = { ...props } const { resolutions, sizes, critical } = convertedProps if (resolutions) { diff --git a/packages/gatsby-link/src/__tests__/index.js b/packages/gatsby-link/src/__tests__/index.js index 444c0df280f71..fba2a5b6ce8e1 100644 --- a/packages/gatsby-link/src/__tests__/index.js +++ b/packages/gatsby-link/src/__tests__/index.js @@ -35,10 +35,10 @@ const getWithAssetPrefix = (prefix = ``) => { } const setup = ({ sourcePath = `/`, linkProps, pathPrefix = `` } = {}) => { - let intersectionInstances = new WeakMap() + const intersectionInstances = new WeakMap() // mock intersectionObserver global.IntersectionObserver = jest.fn(cb => { - let instance = { + const instance = { observe: ref => { intersectionInstances.set(ref, instance) }, diff --git a/packages/gatsby-link/src/parse-path.js b/packages/gatsby-link/src/parse-path.js index 3ce61599b15bf..a108d0b00de39 100644 --- a/packages/gatsby-link/src/parse-path.js +++ b/packages/gatsby-link/src/parse-path.js @@ -3,13 +3,13 @@ export function parsePath(path) { let search = `` let hash = `` - let hashIndex = pathname.indexOf(`#`) + const hashIndex = pathname.indexOf(`#`) if (hashIndex !== -1) { hash = pathname.substr(hashIndex) pathname = pathname.substr(0, hashIndex) } - let searchIndex = pathname.indexOf(`?`) + const searchIndex = pathname.indexOf(`?`) if (searchIndex !== -1) { search = pathname.substr(searchIndex) pathname = pathname.substr(0, searchIndex) diff --git a/packages/gatsby-plugin-catch-links/src/__tests__/catch-links.js b/packages/gatsby-plugin-catch-links/src/__tests__/catch-links.js index a5a4585644fa4..ba262b04ca03a 100644 --- a/packages/gatsby-plugin-catch-links/src/__tests__/catch-links.js +++ b/packages/gatsby-plugin-catch-links/src/__tests__/catch-links.js @@ -494,7 +494,7 @@ describe(`pathPrefix is handled if caught link to ${pathPrefix}/article navigate describe(`navigation is routed through browser without SVGAnimatedString support`, () => { let hrefHandler let eventDestroyer - let oldSVGAnimatedString = SVGAnimatedString + const oldSVGAnimatedString = SVGAnimatedString beforeAll(() => { hrefHandler = jest.fn() diff --git a/packages/gatsby-plugin-feed/src/gatsby-node.js b/packages/gatsby-plugin-feed/src/gatsby-node.js index 1291224d730d1..17f6ce1c1106b 100644 --- a/packages/gatsby-plugin-feed/src/gatsby-node.js +++ b/packages/gatsby-plugin-feed/src/gatsby-node.js @@ -22,7 +22,7 @@ exports.onPostBuild = async ({ graphql, reporter }, pluginOptions) => { const baseQuery = await runQuery(graphql, options.query) - for (let { ...feed } of options.feeds) { + for (const { ...feed } of options.feeds) { if (feed.query) { feed.query = await runQuery(graphql, feed.query).then(result => merge({}, baseQuery, result) diff --git a/packages/gatsby-plugin-gatsby-cloud/src/build-headers-program.js b/packages/gatsby-plugin-gatsby-cloud/src/build-headers-program.js index 1c7b584e05593..99178ce89257e 100644 --- a/packages/gatsby-plugin-gatsby-cloud/src/build-headers-program.js +++ b/packages/gatsby-plugin-gatsby-cloud/src/build-headers-program.js @@ -94,7 +94,7 @@ function headersPath(pathPrefix, path) { } function preloadHeadersByPage({ pages, manifest, pathPrefix, publicFolder }) { - let linksByPage = {} + const linksByPage = {} const appDataPath = publicFolder(PAGE_DATA_DIR, `app-data.json`) const hasAppData = existsSync(appDataPath) diff --git a/packages/gatsby-plugin-gatsby-cloud/src/gatsby-node.js b/packages/gatsby-plugin-gatsby-cloud/src/gatsby-node.js index c5a083a7b6dcf..768da4d54a39e 100644 --- a/packages/gatsby-plugin-gatsby-cloud/src/gatsby-node.js +++ b/packages/gatsby-plugin-gatsby-cloud/src/gatsby-node.js @@ -7,7 +7,7 @@ import { readJSON } from "fs-extra" import { joinPath } from "gatsby-core-utils" import { DEFAULT_OPTIONS, BUILD_HTML_STAGE, BUILD_CSS_STAGE } from "./constants" -let assetsManifest = {} +const assetsManifest = {} // Inject a webpack plugin to get the file manifests so we can translate all link headers exports.onCreateWebpackConfig = ({ actions, stage }) => { diff --git a/packages/gatsby-plugin-glamor/src/gatsby-ssr.js b/packages/gatsby-plugin-glamor/src/gatsby-ssr.js index 0bc84f63b7338..d5fb2e38143b3 100644 --- a/packages/gatsby-plugin-glamor/src/gatsby-ssr.js +++ b/packages/gatsby-plugin-glamor/src/gatsby-ssr.js @@ -7,7 +7,7 @@ exports.replaceRenderer = ({ replaceBodyHTMLString, setHeadComponents, }) => { - let { html, css, ids } = renderStaticOptimized(() => + const { html, css, ids } = renderStaticOptimized(() => renderToString(bodyComponent) ) diff --git a/packages/gatsby-plugin-google-tagmanager/src/gatsby-browser.js b/packages/gatsby-plugin-google-tagmanager/src/gatsby-browser.js index 78ecea5ba5f67..8b7bf8038dfb3 100644 --- a/packages/gatsby-plugin-google-tagmanager/src/gatsby-browser.js +++ b/packages/gatsby-plugin-google-tagmanager/src/gatsby-browser.js @@ -5,10 +5,10 @@ exports.onRouteUpdate = (_, pluginOptions) => { ) { // wrap inside a timeout to ensure the title has properly been changed setTimeout(() => { - let data = pluginOptions.dataLayerName + const data = pluginOptions.dataLayerName ? window[pluginOptions.dataLayerName] : window.dataLayer - let eventName = pluginOptions.routeChangeEventName + const eventName = pluginOptions.routeChangeEventName ? pluginOptions.routeChangeEventName : `gatsby-route-change` diff --git a/packages/gatsby-plugin-less/src/__tests__/gatsby-node.js b/packages/gatsby-plugin-less/src/__tests__/gatsby-node.js index 7c82ad091be38..196a6ee3fbbab 100644 --- a/packages/gatsby-plugin-less/src/__tests__/gatsby-node.js +++ b/packages/gatsby-plugin-less/src/__tests__/gatsby-node.js @@ -53,7 +53,7 @@ describe(`gatsby-plugin-less`, () => { } tests.stages.forEach(stage => { - for (let label in tests.options) { + for (const label in tests.options) { const options = tests.options[label] it(`Stage: ${stage} / ${label}`, () => { onCreateWebpackConfig({ actions, loaders, stage }, options) diff --git a/packages/gatsby-plugin-manifest/src/__tests__/gatsby-node.js b/packages/gatsby-plugin-manifest/src/__tests__/gatsby-node.js index 2cc398f6d5213..e9d1b8087969a 100644 --- a/packages/gatsby-plugin-manifest/src/__tests__/gatsby-node.js +++ b/packages/gatsby-plugin-manifest/src/__tests__/gatsby-node.js @@ -16,7 +16,7 @@ jest.mock(`fs`, () => { */ jest.mock(`sharp`, () => { - let sharp = jest.fn( + const sharp = jest.fn( () => new (class { resize() { diff --git a/packages/gatsby-plugin-manifest/src/gatsby-node.js b/packages/gatsby-plugin-manifest/src/gatsby-node.js index a2a108f1e74cd..927671797ceac 100644 --- a/packages/gatsby-plugin-manifest/src/gatsby-node.js +++ b/packages/gatsby-plugin-manifest/src/gatsby-node.js @@ -86,7 +86,7 @@ exports.onPostBootstrap = async ( activity.start() - let cache = new Map() + const cache = new Map() await makeManifest({ cache, reporter, pluginOptions: manifest, basePath }) @@ -173,12 +173,12 @@ const makeManifest = async ({ } // Determine destination path for icons. - let paths = {} + const paths = {} manifest.icons.forEach(icon => { const iconPath = path.join(`public`, path.dirname(icon.src)) if (!paths[iconPath]) { const exists = fs.existsSync(iconPath) - //create destination directory if it doesn't exist + // create destination directory if it doesn't exist if (!exists) { fs.mkdirSync(iconPath, { recursive: true }) } @@ -206,7 +206,7 @@ const makeManifest = async ({ ) } - //add cache busting + // add cache busting const cacheMode = typeof pluginOptions.cache_busting_mode !== `undefined` ? pluginOptions.cache_busting_mode @@ -219,7 +219,7 @@ const makeManifest = async ({ * the source icon image. */ async function processIconSet(iconSet) { - //if cacheBusting is being done via url query icons must be generated before cache busting runs + // if cacheBusting is being done via url query icons must be generated before cache busting runs if (cacheMode === `query`) { await Promise.all( iconSet.map(dstIcon => @@ -230,13 +230,13 @@ const makeManifest = async ({ if (cacheMode !== `none`) { iconSet = iconSet.map(icon => { - let newIcon = { ...icon } + const newIcon = { ...icon } newIcon.src = addDigestToPath(icon.src, iconDigest, cacheMode) return newIcon }) } - //if file names are being modified by cacheBusting icons must be generated after cache busting runs + // if file names are being modified by cacheBusting icons must be generated after cache busting runs if (cacheMode !== `query`) { await Promise.all( iconSet.map(dstIcon => @@ -261,7 +261,7 @@ const makeManifest = async ({ } } - //Fix #18497 by prefixing paths + // Fix #18497 by prefixing paths manifest.icons = manifest.icons.map(icon => { return { ...icon, @@ -273,7 +273,7 @@ const makeManifest = async ({ manifest.start_url = path.posix.join(basePath, manifest.start_url) } - //Write manifest + // Write manifest fs.writeFileSync( path.join(`public`, `manifest${suffix}.webmanifest`), JSON.stringify(manifest) diff --git a/packages/gatsby-plugin-manifest/src/gatsby-ssr.js b/packages/gatsby-plugin-manifest/src/gatsby-ssr.js index 2c8e7354f1a74..ac94c06e32b71 100644 --- a/packages/gatsby-plugin-manifest/src/gatsby-ssr.js +++ b/packages/gatsby-plugin-manifest/src/gatsby-ssr.js @@ -17,7 +17,7 @@ exports.onRenderBody = ( icons: pluginIcons, include_favicon: insertFaviconLinkTag, theme_color_in_head: insertMetaTag, - theme_color, + theme_color: themeColor, crossOrigin = `anonymous`, } ) => { @@ -69,12 +69,12 @@ exports.onRenderBody = ( ) // The user has an option to opt out of the theme_color meta tag being inserted into the head. - if (theme_color && insertMetaTag) { + if (themeColor && insertMetaTag) { headComponents.push( ) } diff --git a/packages/gatsby-plugin-manifest/src/pluginOptionsSchema.js b/packages/gatsby-plugin-manifest/src/pluginOptionsSchema.js index 0cbbe47ac29f1..5e502d461c84d 100644 --- a/packages/gatsby-plugin-manifest/src/pluginOptionsSchema.js +++ b/packages/gatsby-plugin-manifest/src/pluginOptionsSchema.js @@ -23,7 +23,7 @@ export default function pluginOptionSchema({ Joi }) { `itunes`, `microsoft`, `webapp` - ) //https://w3c.github.io/manifest-app-info/#platform-member + ) // https://w3c.github.io/manifest-app-info/#platform-member .description(`The platform on which the application can be found.`) const FingerPrint = Joi.object().keys({ diff --git a/packages/gatsby-plugin-manifest/src/safe-sharp.js b/packages/gatsby-plugin-manifest/src/safe-sharp.js index 6d97dfddd16a0..e92a40063c28c 100644 --- a/packages/gatsby-plugin-manifest/src/safe-sharp.js +++ b/packages/gatsby-plugin-manifest/src/safe-sharp.js @@ -44,7 +44,7 @@ const getDetailedMessage = () => { return dependency.dependencies.sharp.version } - for (let depName of Object.keys(dependency.dependencies)) { + for (const depName of Object.keys(dependency.dependencies)) { const v = findSharpVersion(dependency.dependencies[depName]) if (v) { return v @@ -78,7 +78,7 @@ const getDetailedMessage = () => { } ) - let packagesToUpdate = [] + const packagesToUpdate = [] // list top level dependencies msg = msg.concat([ `List of installed packages that depend on sharp:`, diff --git a/packages/gatsby-plugin-mdx/gatsby/on-create-node.js b/packages/gatsby-plugin-mdx/gatsby/on-create-node.js index 022eea4000778..ddfdb381407b2 100644 --- a/packages/gatsby-plugin-mdx/gatsby/on-create-node.js +++ b/packages/gatsby-plugin-mdx/gatsby/on-create-node.js @@ -19,6 +19,7 @@ function unstable_shouldOnCreateNode({ node }, pluginOptions) { return _unstable_shouldOnCreateNode({ node }, options) } +// eslint-disable-next-line camelcase function _unstable_shouldOnCreateNode({ node }, options) { // options check to stop transformation of the node if (options.shouldBlockNodeFromTransformation(node)) { @@ -214,7 +215,7 @@ class BabelPluginTransformRelativeImports { return { visitor: { StringLiteral({ node }) { - let split = node.value.split(`!`) + const split = node.value.split(`!`) const nodePath = split.pop() const loaders = `${split.join(`!`)}${split.length > 0 ? `!` : ``}` if (nodePath.startsWith(`.`)) { diff --git a/packages/gatsby-plugin-mdx/gatsby/source-nodes.js b/packages/gatsby-plugin-mdx/gatsby/source-nodes.js index 9addd9b6488d9..04971a3f8fdb7 100644 --- a/packages/gatsby-plugin-mdx/gatsby/source-nodes.js +++ b/packages/gatsby-plugin-mdx/gatsby/source-nodes.js @@ -20,7 +20,7 @@ const { mdxHTMLLoader: loader } = require(`../utils/render-html`) const { interopDefault } = require(`../utils/interop-default`) async function getCounts({ mdast }) { - let counts = {} + const counts = {} // convert the mdxast to back to mdast remove(mdast, `import`) @@ -93,12 +93,12 @@ module.exports = ( /** * Support gatsby-remark parser plugins */ - for (let plugin of options.gatsbyRemarkPlugins) { + for (const plugin of options.gatsbyRemarkPlugins) { debug(`requiring`, plugin.resolve) const requiredPlugin = interopDefault(require(plugin.resolve)) debug(`required`, plugin) if (_.isFunction(requiredPlugin.setParserPlugins)) { - for (let parserPlugin of requiredPlugin.setParserPlugins( + for (const parserPlugin of requiredPlugin.setParserPlugins( plugin.options || {} )) { if (_.isArray(parserPlugin)) { diff --git a/packages/gatsby-plugin-mdx/loaders/mdx-loader.js b/packages/gatsby-plugin-mdx/loaders/mdx-loader.js index dd1d98a42ffcf..54454c0ccc3eb 100644 --- a/packages/gatsby-plugin-mdx/loaders/mdx-loader.js +++ b/packages/gatsby-plugin-mdx/loaders/mdx-loader.js @@ -72,9 +72,10 @@ const hasDefaultExport = (str, options) => { isExport(value) || isImport(value) ? -1 : 1 function esSyntax() { - var Parser = this.Parser - var tokenizers = Parser.prototype.blockTokenizers - var methods = Parser.prototype.blockMethods + // eslint-disable-next-line @babel/no-invalid-this + const Parser = this.Parser + const tokenizers = Parser.prototype.blockTokenizers + const methods = Parser.prototype.blockMethods tokenizers.esSyntax = tokenizeEsSyntax @@ -181,12 +182,12 @@ ${contentWithoutFrontmatter}` /** * Support gatsby-remark parser plugins */ - for (let plugin of options.gatsbyRemarkPlugins) { + for (const plugin of options.gatsbyRemarkPlugins) { debug(`requiring`, plugin.resolve) const requiredPlugin = interopDefault(require(plugin.resolve)) debug(`required`, plugin) if (_.isFunction(requiredPlugin.setParserPlugins)) { - for (let parserPlugin of requiredPlugin.setParserPlugins( + for (const parserPlugin of requiredPlugin.setParserPlugins( plugin.options || {} )) { if (_.isArray(parserPlugin)) { diff --git a/packages/gatsby-plugin-mdx/loaders/mdx-loader.test.js b/packages/gatsby-plugin-mdx/loaders/mdx-loader.test.js index 0c5da2e6d2b6b..9fcfda0f782d3 100644 --- a/packages/gatsby-plugin-mdx/loaders/mdx-loader.test.js +++ b/packages/gatsby-plugin-mdx/loaders/mdx-loader.test.js @@ -55,7 +55,7 @@ const fixtures = new BaseN([true, false], 3) describe(`mdx-loader`, () => { expect.addSnapshotSerializer({ - print(val /*, serialize */) { + print(val /* , serialize */) { return prettier.format(val, { parser: `babel` }) }, test() { diff --git a/packages/gatsby-plugin-mdx/utils/babel-plugin-html-attr-to-jsx-attr.js b/packages/gatsby-plugin-mdx/utils/babel-plugin-html-attr-to-jsx-attr.js index 91cae28ffcbc3..51379b2f774b4 100644 --- a/packages/gatsby-plugin-mdx/utils/babel-plugin-html-attr-to-jsx-attr.js +++ b/packages/gatsby-plugin-mdx/utils/babel-plugin-html-attr-to-jsx-attr.js @@ -501,7 +501,7 @@ const propsKeysVisitor = { } }, } -var jsxAttributeFromHTMLAttributeVisitor = { +const jsxAttributeFromHTMLAttributeVisitor = { JSXAttribute: function (node) { const nameNode = node.node.name const name = nameNode.name @@ -522,7 +522,7 @@ var jsxAttributeFromHTMLAttributeVisitor = { node.node.value.type === `StringLiteral` // node.node.value.type !== "JSXExpressionContainer" ) { - let styleArray = [] + const styleArray = [] styleToObject(node.node.value.extra.rawValue, function ( name, value, diff --git a/packages/gatsby-plugin-mdx/utils/gen-mdx.js b/packages/gatsby-plugin-mdx/utils/gen-mdx.js index d493a5233f37a..a991745f032a1 100644 --- a/packages/gatsby-plugin-mdx/utils/gen-mdx.js +++ b/packages/gatsby-plugin-mdx/utils/gen-mdx.js @@ -66,7 +66,7 @@ async function genMDX( } } - let results = { + const results = { mdast: undefined, hast: undefined, html: undefined, @@ -128,7 +128,7 @@ export const _frontmatter = ${JSON.stringify(data)}` ) debug(`running mdx`) - let code = await mdx(content, { + const code = await mdx(content, { filepath: node.fileAbsolutePath, ...options, remarkPlugins: options.remarkPlugins.concat( diff --git a/packages/gatsby-plugin-mdx/utils/mdx.js b/packages/gatsby-plugin-mdx/utils/mdx.js index 257abcf21bfbd..624861d05aef6 100644 --- a/packages/gatsby-plugin-mdx/utils/mdx.js +++ b/packages/gatsby-plugin-mdx/utils/mdx.js @@ -11,7 +11,7 @@ const grayMatter = require(`gray-matter`) module.exports = async function mdxToJsx(source, options) { const { data, content } = grayMatter(source) - let code = await mdx(content, options || {}) + const code = await mdx(content, options || {}) return `${code} diff --git a/packages/gatsby-plugin-mdx/utils/render-html.js b/packages/gatsby-plugin-mdx/utils/render-html.js index 4813d9942b5de..c52e616930b74 100644 --- a/packages/gatsby-plugin-mdx/utils/render-html.js +++ b/packages/gatsby-plugin-mdx/utils/render-html.js @@ -4,9 +4,9 @@ const evaluate = require(`eval`) const debug = require(`debug`)(`gatsby-plugin-mdx:render-html`) const { default: PQueue } = require(`p-queue`) -//const StaticSiteGeneratorPlugin = require("static-site-generator-webpack-plugin"); +// const StaticSiteGeneratorPlugin = require("static-site-generator-webpack-plugin"); const { cloneDeep } = require(`lodash`) -//const { store: ogStore} = require("gatsby/dist/redux"); +// const { store: ogStore} = require("gatsby/dist/redux"); const DataLoader = require(`dataloader`) const queue = new PQueue({ @@ -22,20 +22,20 @@ queue.on(`active`, () => { ) }) -var findAsset = function (src, compilation, webpackStatsJson) { +const findAsset = function (src, compilation, webpackStatsJson) { if (!src) { - var chunkNames = Object.keys(webpackStatsJson.assetsByChunkName) + const chunkNames = Object.keys(webpackStatsJson.assetsByChunkName) src = chunkNames[0] } - var asset = compilation.assets[src] + const asset = compilation.assets[src] if (asset) { return asset } - var chunkValue = webpackStatsJson.assetsByChunkName[src] + let chunkValue = webpackStatsJson.assetsByChunkName[src] if (!chunkValue) { return null @@ -54,7 +54,7 @@ let renderMdxBody = undefined class MdxHtmlBuilderWebpackPlugin { apply(compiler) { const self = this - var afterEmit = (compilation, callback) => { + const afterEmit = (compilation, callback) => { // var options = compiler.options; /* var stats = compilation.getStats().toJson({ * hash: true, @@ -67,18 +67,18 @@ class MdxHtmlBuilderWebpackPlugin { * timings: false * }); */ // console.log(Object.keys(compilation.assets)); - var webpackStats = compilation.getStats() - var webpackStatsJson = webpackStats.toJson() + const webpackStats = compilation.getStats() + const webpackStatsJson = webpackStats.toJson() try { - var asset = findAsset(self.entry, compilation, webpackStatsJson) + const asset = findAsset(self.entry, compilation, webpackStatsJson) if (asset == null) { throw new Error(`Source file not found: "` + self.entry + `"`) } - var source = asset.source() - var render = evaluate( + const source = asset.source() + let render = evaluate( source, /* filename: */ self.entry, /* scope: */ self.globals, @@ -103,7 +103,7 @@ class MdxHtmlBuilderWebpackPlugin { } } if (compiler.hooks) { - var plugin = { name: `MdxHtmlBuilderWebpackPlugin` } + const plugin = { name: `MdxHtmlBuilderWebpackPlugin` } compiler.hooks.afterEmit.tapAsync(plugin, afterEmit) } else { diff --git a/packages/gatsby-plugin-netlify-cms/src/cms-identity.js b/packages/gatsby-plugin-netlify-cms/src/cms-identity.js index 142f2f30ed44e..697d173639cbd 100644 --- a/packages/gatsby-plugin-netlify-cms/src/cms-identity.js +++ b/packages/gatsby-plugin-netlify-cms/src/cms-identity.js @@ -1,4 +1,4 @@ -/* global __PATH_PREFIX__ CMS_PUBLIC_PATH */ +/* global CMS_PUBLIC_PATH */ import netlifyIdentityWidget from "netlify-identity-widget" window.netlifyIdentity = netlifyIdentityWidget diff --git a/packages/gatsby-plugin-netlify-cms/src/gatsby-browser.js b/packages/gatsby-plugin-netlify-cms/src/gatsby-browser.js index bcd162797379d..576c34876d428 100644 --- a/packages/gatsby-plugin-netlify-cms/src/gatsby-browser.js +++ b/packages/gatsby-plugin-netlify-cms/src/gatsby-browser.js @@ -1,5 +1,3 @@ -/* global __PATH_PREFIX__ */ - // Taken from https://github.com/netlify/netlify-identity-widget const routes = /(confirmation|invite|recovery|email_change)_token=([^&]+)/ const errorRoute = /error=access_denied&error_description=403/ diff --git a/packages/gatsby-plugin-netlify/src/build-headers-program.js b/packages/gatsby-plugin-netlify/src/build-headers-program.js index da80f36887693..072996ab9fde9 100644 --- a/packages/gatsby-plugin-netlify/src/build-headers-program.js +++ b/packages/gatsby-plugin-netlify/src/build-headers-program.js @@ -93,7 +93,7 @@ function headersPath(pathPrefix, path) { } function preloadHeadersByPage({ pages, manifest, pathPrefix, publicFolder }) { - let linksByPage = {} + const linksByPage = {} const appDataPath = publicFolder(PAGE_DATA_DIR, `app-data.json`) const hasAppData = existsSync(appDataPath) diff --git a/packages/gatsby-plugin-netlify/src/create-redirects.js b/packages/gatsby-plugin-netlify/src/create-redirects.js index 76a2a67c0d14f..efaf6f6c75406 100644 --- a/packages/gatsby-plugin-netlify/src/create-redirects.js +++ b/packages/gatsby-plugin-netlify/src/create-redirects.js @@ -34,7 +34,7 @@ export default async function writeRedirectsFile( // The order for rest params (key-value pairs) is arbitrary. const pieces = [fromPath, toPath, status] - for (let key in rest) { + for (const key in rest) { const value = rest[key] if (typeof value === `string` && value.includes(` `)) { diff --git a/packages/gatsby-plugin-netlify/src/gatsby-node.js b/packages/gatsby-plugin-netlify/src/gatsby-node.js index 721cb8e2dbe45..7635529242808 100644 --- a/packages/gatsby-plugin-netlify/src/gatsby-node.js +++ b/packages/gatsby-plugin-netlify/src/gatsby-node.js @@ -7,7 +7,7 @@ import buildHeadersProgram from "./build-headers-program" import createRedirects from "./create-redirects" import { DEFAULT_OPTIONS, BUILD_HTML_STAGE, BUILD_CSS_STAGE } from "./constants" -let assetsManifest = {} +const assetsManifest = {} // Inject a webpack plugin to get the file manifests so we can translate all link headers exports.onCreateWebpackConfig = ({ actions, stage }) => { diff --git a/packages/gatsby-plugin-offline/src/__tests__/gatsby-browser.test.js b/packages/gatsby-plugin-offline/src/__tests__/gatsby-browser.test.js index aba58666e297f..273c89264c3fa 100644 --- a/packages/gatsby-plugin-offline/src/__tests__/gatsby-browser.test.js +++ b/packages/gatsby-plugin-offline/src/__tests__/gatsby-browser.test.js @@ -3,7 +3,7 @@ const { onServiceWorkerActive } = require(`../gatsby-browser`) it(`does not add prefetch for preconnect/prefetch/prerender`, () => { const addHeadElement = (tagName, attributes) => { const el = document.createElement(tagName) - for (let key in attributes) { + for (const key in attributes) { el.setAttribute(key, attributes[key]) } document.head.appendChild(el) diff --git a/packages/gatsby-plugin-offline/src/gatsby-node.js b/packages/gatsby-plugin-offline/src/gatsby-node.js index 96b0e152b0e46..01e8456f917e7 100644 --- a/packages/gatsby-plugin-offline/src/gatsby-node.js +++ b/packages/gatsby-plugin-offline/src/gatsby-node.js @@ -1,4 +1,5 @@ // use `let` to workaround https://github.com/jhnns/rewire/issues/144 +/* eslint-disable prefer-const */ let fs = require(`fs`) let workboxBuild = require(`workbox-build`) const path = require(`path`) diff --git a/packages/gatsby-plugin-sass/src/__tests__/gatsby-node.js b/packages/gatsby-plugin-sass/src/__tests__/gatsby-node.js index 80dcb615d0585..8db992b8348fb 100644 --- a/packages/gatsby-plugin-sass/src/__tests__/gatsby-node.js +++ b/packages/gatsby-plugin-sass/src/__tests__/gatsby-node.js @@ -52,7 +52,7 @@ describe(`gatsby-plugin-sass`, () => { } tests.stages.forEach(stage => { - for (let label in tests.options) { + for (const label in tests.options) { const options = tests.options[label] it(`Stage: ${stage} / ${label}`, () => { onCreateWebpackConfig({ actions, loaders, stage }, options) diff --git a/packages/gatsby-plugin-sharp/src/__tests__/index.js b/packages/gatsby-plugin-sharp/src/__tests__/index.js index 56c7504d3c0fe..dd8bbb209b32a 100644 --- a/packages/gatsby-plugin-sharp/src/__tests__/index.js +++ b/packages/gatsby-plugin-sharp/src/__tests__/index.js @@ -169,7 +169,7 @@ describe(`gatsby-plugin-sharp`, () => { }) describe(`fluid`, () => { - let actions = {} + const actions = {} beforeEach(() => { actions.createJobV2 = jest.fn().mockReturnValue(Promise.resolve()) setActions(actions) @@ -412,7 +412,7 @@ describe(`gatsby-plugin-sharp`, () => { }) describe(`fixed`, () => { - let actions = {} + const actions = {} beforeEach(() => { actions.createJobV2 = jest.fn().mockReturnValue(Promise.resolve()) setActions(actions) @@ -684,12 +684,12 @@ describe(`gatsby-plugin-sharp`, () => { } it(`fixed`, async () => { - let result = await fixed({ file, args }) + const result = await fixed({ file, args }) expect(result).toMatchSnapshot() }) it(`fluid`, async () => { - let result = await fluid({ file, args }) + const result = await fluid({ file, args }) expect(result).toMatchSnapshot() }) }) diff --git a/packages/gatsby-plugin-sharp/src/plugin-options.js b/packages/gatsby-plugin-sharp/src/plugin-options.js index 7e4c6c8f36db2..a72cb2e9609ed 100644 --- a/packages/gatsby-plugin-sharp/src/plugin-options.js +++ b/packages/gatsby-plugin-sharp/src/plugin-options.js @@ -1,6 +1,6 @@ const _ = require(`lodash`) -/// Plugin options are loaded onPreBootstrap in gatsby-node +// Plugin options are loaded onPreBootstrap in gatsby-node const pluginDefaults = { base64Width: 20, forceBase64Format: ``, // valid formats: png,jpg,webp @@ -94,7 +94,7 @@ exports.healOptions = ( fileExtension = ``, defaultArgs = {} ) => { - let options = _.defaults({}, args, { quality }, defaultArgs, generalArgs) + const options = _.defaults({}, args, { quality }, defaultArgs, generalArgs) options.quality = parseInt(options.quality, 10) options.pngCompressionLevel = parseInt(options.pngCompressionLevel, 10) options.pngCompressionSpeed = parseInt(options.pngCompressionSpeed, 10) diff --git a/packages/gatsby-plugin-sharp/src/process-file.js b/packages/gatsby-plugin-sharp/src/process-file.js index cc3428f956d4d..8fd06dbadad38 100644 --- a/packages/gatsby-plugin-sharp/src/process-file.js +++ b/packages/gatsby-plugin-sharp/src/process-file.js @@ -46,7 +46,7 @@ sharp.concurrency(1) * @property {import('sharp').FitEnum} fit */ -/**+ +/** + * @typedef {Object} Transform * @property {string} outputPath * @property {TransformArgs} args diff --git a/packages/gatsby-plugin-sharp/src/safe-sharp.js b/packages/gatsby-plugin-sharp/src/safe-sharp.js index 6d97dfddd16a0..e92a40063c28c 100644 --- a/packages/gatsby-plugin-sharp/src/safe-sharp.js +++ b/packages/gatsby-plugin-sharp/src/safe-sharp.js @@ -44,7 +44,7 @@ const getDetailedMessage = () => { return dependency.dependencies.sharp.version } - for (let depName of Object.keys(dependency.dependencies)) { + for (const depName of Object.keys(dependency.dependencies)) { const v = findSharpVersion(dependency.dependencies[depName]) if (v) { return v @@ -78,7 +78,7 @@ const getDetailedMessage = () => { } ) - let packagesToUpdate = [] + const packagesToUpdate = [] // list top level dependencies msg = msg.concat([ `List of installed packages that depend on sharp:`, diff --git a/packages/gatsby-plugin-sharp/src/scheduler.js b/packages/gatsby-plugin-sharp/src/scheduler.js index dcea32951d228..0c5a64b51e077 100644 --- a/packages/gatsby-plugin-sharp/src/scheduler.js +++ b/packages/gatsby-plugin-sharp/src/scheduler.js @@ -8,8 +8,6 @@ const worker = require(`./gatsby-worker`) const processImages = async (jobId, job, actions) => { try { await worker.IMAGE_PROCESSING(job) - } catch (err) { - throw err } finally { actions.endJob({ id: jobId }, { name: `gatsby-plugin-sharp` }) } diff --git a/packages/gatsby-plugin-sharp/src/trace-svg.js b/packages/gatsby-plugin-sharp/src/trace-svg.js index fe1a38819e13b..df7db5b1df961 100644 --- a/packages/gatsby-plugin-sharp/src/trace-svg.js +++ b/packages/gatsby-plugin-sharp/src/trace-svg.js @@ -117,40 +117,37 @@ exports.notMemoizedtraceSVG = async ({ file, args, fileArgs, reporter }) => { ) ) - try { - await exports.memoizedPrepareTraceSVGInputFile({ - tmpFilePath, - file, - options, - reporter, - }) + await exports.memoizedPrepareTraceSVGInputFile({ + tmpFilePath, + file, + options, + reporter, + }) - const svgToMiniDataURI = require(`mini-svg-data-uri`) - const potrace = require(`potrace`) - const trace = promisify(potrace.trace) + const svgToMiniDataURI = require(`mini-svg-data-uri`) + const potrace = require(`potrace`) + const trace = promisify(potrace.trace) - const defaultArgs = { - color: `lightgray`, - optTolerance: 0.4, - turdSize: 100, - turnPolicy: potrace.Potrace.TURNPOLICY_MAJORITY, - } + const defaultArgs = { + color: `lightgray`, + optTolerance: 0.4, + turdSize: 100, + turnPolicy: potrace.Potrace.TURNPOLICY_MAJORITY, + } - const optionsSVG = _.defaults({}, args, defaultArgs) + const optionsSVG = _.defaults({}, args, defaultArgs) - // `srcset` attribute rejects URIs with literal spaces - const encodeSpaces = str => str.replace(/ /gi, `%20`) + // `srcset` attribute rejects URIs with literal spaces + const encodeSpaces = str => str.replace(/ /gi, `%20`) - return trace(tmpFilePath, optionsSVG) - .then(optimize) - .then(svgToMiniDataURI) - .then(encodeSpaces) - } catch (e) { - throw e - } + return trace(tmpFilePath, optionsSVG) + .then(optimize) + .then(svgToMiniDataURI) + .then(encodeSpaces) } -let memoizedPrepareTraceSVGInputFile, memoizedTraceSVG +let memoizedPrepareTraceSVGInputFile +let memoizedTraceSVG const createMemoizedFunctions = () => { exports.memoizedPrepareTraceSVGInputFile = memoizedPrepareTraceSVGInputFile = _.memoize( exports.notMemoizedPrepareTraceSVGInputFile, diff --git a/packages/gatsby-plugin-sitemap/src/__tests__/gatsby-node.js b/packages/gatsby-plugin-sitemap/src/__tests__/gatsby-node.js index ffabf54178df5..7e4fdd55438bd 100644 --- a/packages/gatsby-plugin-sitemap/src/__tests__/gatsby-node.js +++ b/packages/gatsby-plugin-sitemap/src/__tests__/gatsby-node.js @@ -1,3 +1,4 @@ +/* eslint-disable no-import-assign */ jest.mock(`fs`) const fs = require(`fs`) @@ -86,7 +87,7 @@ describe(`Test plugin sitemap`, () => { path } } - } + } }` const options = { output: `custom-sitemap.xml`, diff --git a/packages/gatsby-plugin-stylus/src/__tests__/gatsby-node.js b/packages/gatsby-plugin-stylus/src/__tests__/gatsby-node.js index 4f45c975e175b..85bf0060104b9 100644 --- a/packages/gatsby-plugin-stylus/src/__tests__/gatsby-node.js +++ b/packages/gatsby-plugin-stylus/src/__tests__/gatsby-node.js @@ -39,7 +39,7 @@ describe(`gatsby-plugin-stylus`, () => { } tests.stages.forEach(stage => { - for (let label in tests.options) { + for (const label in tests.options) { const options = tests.options[label] it(`Stage: ${stage} / ${label}`, () => { onCreateWebpackConfig( diff --git a/packages/gatsby-plugin-twitter/src/gatsby-browser.js b/packages/gatsby-plugin-twitter/src/gatsby-browser.js index f1cbafbd802eb..9d5700067924d 100644 --- a/packages/gatsby-plugin-twitter/src/gatsby-browser.js +++ b/packages/gatsby-plugin-twitter/src/gatsby-browser.js @@ -1,6 +1,6 @@ const injectTwitterScript = () => { function addJS(jsCode) { - var s = document.createElement(`script`) + const s = document.createElement(`script`) s.type = `text/javascript` s.innerText = jsCode diff --git a/packages/gatsby-plugin-typography/src/gatsby-browser.js b/packages/gatsby-plugin-typography/src/gatsby-browser.js index f1f7e1633e27e..2f8bfe21cc6e7 100644 --- a/packages/gatsby-plugin-typography/src/gatsby-browser.js +++ b/packages/gatsby-plugin-typography/src/gatsby-browser.js @@ -31,8 +31,8 @@ if (process.env.BUILD_STAGE === `develop`) { ) // Parse the tag - let doc = new DOMParser().parseFromString(googleFonts, `text/html`) - let linkElement = doc.head.firstChild + const doc = new DOMParser().parseFromString(googleFonts, `text/html`) + const linkElement = doc.head.firstChild // Add custom identifier linkElement.setAttribute(`data-gatsby-typography`, `true`) const head = document.getElementsByTagName(`head`)[0] diff --git a/packages/gatsby-recipes/src/create-plan.js b/packages/gatsby-recipes/src/create-plan.js index ee05a3f76d032..01ad97c6418ec 100644 --- a/packages/gatsby-recipes/src/create-plan.js +++ b/packages/gatsby-recipes/src/create-plan.js @@ -1,10 +1,6 @@ import render from "./renderer" export default async function createPlan(context, cb) { - try { - const result = await render(context.recipe, cb, context) - return result - } catch (e) { - throw e - } + const result = await render(context.recipe, cb, context) + return result } diff --git a/packages/gatsby-recipes/src/joi-to-graphql/helpers/joi-to-graphql.js b/packages/gatsby-recipes/src/joi-to-graphql/helpers/joi-to-graphql.js index fa3141abb553e..9452d30e43859 100644 --- a/packages/gatsby-recipes/src/joi-to-graphql/helpers/joi-to-graphql.js +++ b/packages/gatsby-recipes/src/joi-to-graphql/helpers/joi-to-graphql.js @@ -190,7 +190,7 @@ internals.buildFields = fields => { attrs[key] = internals.setType(field.schema) } - cache = Object.create(null) //Empty cache + cache = Object.create(null) // Empty cache return function (recursiveType) { if (recursiveType) { diff --git a/packages/gatsby-recipes/src/parser/index.js b/packages/gatsby-recipes/src/parser/index.js index 933b1ffe228fb..1fa2103a5b340 100644 --- a/packages/gatsby-recipes/src/parser/index.js +++ b/packages/gatsby-recipes/src/parser/index.js @@ -18,7 +18,7 @@ const asRoot = node => { } const pluckExports = tree => { - let exports = [] + const exports = [] visit(tree, `export`, node => { exports.push(node) }) @@ -78,56 +78,52 @@ const toMdx = nodes => { } const parse = async src => { - try { - const ast = u.parse(src) - const exportNodes = pluckExports(ast) - const [intro, ...resourceSteps] = partitionSteps(ast) + const ast = u.parse(src) + const exportNodes = pluckExports(ast) + const [intro, ...resourceSteps] = partitionSteps(ast) + + const wrappedIntroStep = { + type: `mdxBlockElement`, + name: `RecipeIntroduction`, + attributes: [], + children: intro, + } - const wrappedIntroStep = { + const wrappedResourceSteps = resourceSteps.map((step, i) => { + return { type: `mdxBlockElement`, - name: `RecipeIntroduction`, - attributes: [], - children: intro, + name: `RecipeStep`, + attributes: [ + { + type: `mdxAttribute`, + name: `step`, + value: String(i + 1), + }, + { + type: `mdxAttribute`, + name: `totalSteps`, + value: String(resourceSteps.length), + }, + ], + children: step, } + }) - const wrappedResourceSteps = resourceSteps.map((step, i) => { - return { - type: `mdxBlockElement`, - name: `RecipeStep`, - attributes: [ - { - type: `mdxAttribute`, - name: `step`, - value: String(i + 1), - }, - { - type: `mdxAttribute`, - name: `totalSteps`, - value: String(resourceSteps.length), - }, - ], - children: step, - } - }) - - const steps = [wrappedIntroStep, ...wrappedResourceSteps] - ast.children = [...exportNodes, ...ast.children] - - const exportsAsMdx = exportNodes.map(toMdx) - const stepsAsMdx = steps.map(toMdx) - const stepsAsJS = stepsAsMdx.map(transformMdx) + const steps = [wrappedIntroStep, ...wrappedResourceSteps] + ast.children = [...exportNodes, ...ast.children] - return { - ast, - steps, - exports: exportNodes, - exportsAsMdx, - stepsAsMdx, - stepsAsJS, - recipe: exportsAsMdx.join(`\n`) + `\n\n` + stepsAsMdx.join(`\n`), - } - } catch (e) { - throw e + const exportsAsMdx = exportNodes.map(toMdx) + const stepsAsMdx = steps.map(toMdx) + const stepsAsJS = stepsAsMdx.map(transformMdx) + + return { + ast, + steps, + exports: exportNodes, + exportsAsMdx, + stepsAsMdx, + stepsAsJS, + recipe: exportsAsMdx.join(`\n`) + `\n\n` + stepsAsMdx.join(`\n`), } } diff --git a/packages/gatsby-recipes/src/providers/git/ignore.js b/packages/gatsby-recipes/src/providers/git/ignore.js index af71e4b8ec006..e37c644c63494 100644 --- a/packages/gatsby-recipes/src/providers/git/ignore.js +++ b/packages/gatsby-recipes/src/providers/git/ignore.js @@ -41,7 +41,7 @@ const fileExists = fullPath => { const create = async ({ root }, { name }) => { const fullPath = makePath(root) - let ignores = await all({ root }) + const ignores = await all({ root }) const exists = ignores.find(n => n.id === name) if (!exists) { diff --git a/packages/gatsby-recipes/src/recipe-machine/index.js b/packages/gatsby-recipes/src/recipe-machine/index.js index a69664a57cc7a..1aad9864e2416 100644 --- a/packages/gatsby-recipes/src/recipe-machine/index.js +++ b/packages/gatsby-recipes/src/recipe-machine/index.js @@ -130,24 +130,20 @@ const recipeMachine = Machine( invoke: { id: `createPlan`, src: (context, event) => async (cb, onReceive) => { - try { - let result = await createPlan(context, cb) - // Validate dependencies are met in the resources plan - result = result.map(r => { - const matches = findDependencyMatch(result, r) - // If there's any errors, replace the resource - // with the error - if (matches.some(m => m.error)) { - r.error = matches[0].error - delete r.diff - } - return r - }) + let result = await createPlan(context, cb) + // Validate dependencies are met in the resources plan + result = result.map(r => { + const matches = findDependencyMatch(result, r) + // If there's any errors, replace the resource + // with the error + if (matches.some(m => m.error)) { + r.error = matches[0].error + delete r.diff + } + return r + }) - return result - } catch (e) { - throw e - } + return result }, onDone: { target: `presentPlan`, diff --git a/packages/gatsby-recipes/src/renderer/index.js b/packages/gatsby-recipes/src/renderer/index.js index 2db9c1cf2eb95..b873daff5c833 100644 --- a/packages/gatsby-recipes/src/renderer/index.js +++ b/packages/gatsby-recipes/src/renderer/index.js @@ -43,16 +43,12 @@ export default function (mdxSrc, cb, context, isApply, isStream = false) { const component = new Function(...scopeKeys, transformCodeForEval(srcCode)) - try { - const result = render( - component(...scopeValues), - cb, - context, - isApply, - isStream - ) - return result - } catch (e) { - throw e - } + const result = render( + component(...scopeValues), + cb, + context, + isApply, + isStream + ) + return result } diff --git a/packages/gatsby-recipes/src/renderer/render.js b/packages/gatsby-recipes/src/renderer/render.js index ed74dc62a8e5d..22a72766f8acd 100644 --- a/packages/gatsby-recipes/src/renderer/render.js +++ b/packages/gatsby-recipes/src/renderer/render.js @@ -192,40 +192,35 @@ const handleResource = (resourceName, context, props) => { const fn = mode === `apply` ? `create` : `plan` - let promise - try { - promise = new Promise((resolve, reject) => { - // Multiple of the same promises can be queued due to re-rendering - // so this first checks for the cached result again before executing - // the request. - const cachedValue = resultCache.get(cacheKey) - if (cachedValue) { - resolve(cachedValue) - } else { - resources[resourceName][fn](context, props) - .then(result => { - if (fn === `create`) { - result.isDone = true - } - inFlightCache.set(cacheKey, false) - return result - }) - .then(result => { - resultCache.set(cacheKey, result) - return result - }) - .then(resolve) - .catch(e => { - if (e.name === `MissingInfoError`) { - inFlightCache.delete(cacheKey) - } - reject(e) - }) - } - }) - } catch (e) { - throw e - } + const promise = new Promise((resolve, reject) => { + // Multiple of the same promises can be queued due to re-rendering + // so this first checks for the cached result again before executing + // the request. + const cachedValue = resultCache.get(cacheKey) + if (cachedValue) { + resolve(cachedValue) + } else { + resources[resourceName][fn](context, props) + .then(result => { + if (fn === `create`) { + result.isDone = true + } + inFlightCache.set(cacheKey, false) + return result + }) + .then(result => { + resultCache.set(cacheKey, result) + return result + }) + .then(resolve) + .catch(e => { + if (e.name === `MissingInfoError`) { + inFlightCache.delete(cacheKey) + } + reject(e) + }) + } + }) inFlightCache.set(cacheKey, promise) diff --git a/packages/gatsby-remark-autolink-headers/src/gatsby-browser.js b/packages/gatsby-remark-autolink-headers/src/gatsby-browser.js index 9c780ee6c0a81..61e8385bc4187 100644 --- a/packages/gatsby-remark-autolink-headers/src/gatsby-browser.js +++ b/packages/gatsby-remark-autolink-headers/src/gatsby-browser.js @@ -5,14 +5,14 @@ const getTargetOffset = hash => { if (id !== ``) { const element = document.getElementById(id) if (element) { - let scrollTop = + const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop - let clientTop = + const clientTop = document.documentElement.clientTop || document.body.clientTop || 0 - let computedStyles = window.getComputedStyle(element) - let scrollMarginTop = + const computedStyles = window.getComputedStyle(element) + const scrollMarginTop = computedStyles.getPropertyValue(`scroll-margin-top`) || computedStyles.getPropertyValue(`scroll-snap-margin-top`) || `0px` diff --git a/packages/gatsby-remark-copy-linked-files/src/index.js b/packages/gatsby-remark-copy-linked-files/src/index.js index ab8592a787a26..0ce860234682c 100644 --- a/packages/gatsby-remark-copy-linked-files/src/index.js +++ b/packages/gatsby-remark-copy-linked-files/src/index.js @@ -1,3 +1,4 @@ +/* eslint-disable @babel/no-invalid-this */ const visit = require(`unist-util-visit`) const isRelativeUrl = require(`is-relative-url`) const fsExtra = require(`fs-extra`) @@ -62,9 +63,9 @@ const newLinkURL = (linkNode, options, pathPrefix) => { } function toArray(buf) { - var arr = new Array(buf.length) + const arr = new Array(buf.length) - for (var i = 0; i < buf.length; i++) { + for (let i = 0; i < buf.length; i++) { arr[i] = buf[i] } diff --git a/packages/gatsby-remark-graphviz/src/index.js b/packages/gatsby-remark-graphviz/src/index.js index ca77d321124be..369af4aaeac6a 100644 --- a/packages/gatsby-remark-graphviz/src/index.js +++ b/packages/gatsby-remark-graphviz/src/index.js @@ -8,7 +8,7 @@ const viz = new Viz({ Module, render }) const validLanguages = [`dot`, `circo`] module.exports = async ({ markdownAST }, pluginOptions = {}) => { - let codeNodes = [] + const codeNodes = [] visit(markdownAST, `code`, node => { const chunks = (node.lang || ``).match(/^(\S+)(\s+(.+))?/) diff --git a/packages/gatsby-remark-images-contentful/src/index.js b/packages/gatsby-remark-images-contentful/src/index.js index c8330f9795daa..b8730948a60ef 100644 --- a/packages/gatsby-remark-images-contentful/src/index.js +++ b/packages/gatsby-remark-images-contentful/src/index.js @@ -44,13 +44,7 @@ module.exports = async ( // This will also allow the use of html image tags const rawHtmlNodes = select(markdownAST, `html`) - const generateImagesAndUpdateNode = async function (node, resolve) { - // Ignore if it is not contentful image - - if (node.url.indexOf(`images.ctfassets.net`) === -1) { - return resolve() - } - + const generateImagesAndUpdateNode = async function (node) { let originalImg = node.url if (!/^(http|https)?:\/\//i.test(node.url)) { originalImg = `https:${node.url}` @@ -63,7 +57,7 @@ module.exports = async ( const optionsHash = createContentDigest(options) const cacheKey = `remark-images-ctf-${node.url}-${optionsHash}` - let cachedRawHTML = await cache.get(cacheKey) + const cachedRawHTML = await cache.get(cacheKey) if (cachedRawHTML) { return cachedRawHTML @@ -212,16 +206,17 @@ ${rawHTML} // Simple because there is no nesting in markdown markdownImageNodes.map( node => - new Promise(async (resolve, reject) => { + new Promise(resolve => { if (node.url.indexOf(`images.ctfassets.net`) !== -1) { - const rawHTML = await generateImagesAndUpdateNode(node, resolve) + return generateImagesAndUpdateNode(node).then(rawHTML => { + if (rawHTML) { + // Replace the image node with an inline HTML node. + node.type = `html` + node.value = rawHTML + } - if (rawHTML) { - // Replace the image node with an inline HTML node. - node.type = `html` - node.value = rawHTML - } - return resolve(node) + return resolve(node) + }) } else { // Image isn't relative so there's nothing for us to do. return resolve() @@ -234,6 +229,7 @@ ${rawHTML} // Complex because HTML nodes can contain multiple images rawHtmlNodes.map( node => + // eslint-disable-next-line no-async-promise-executor new Promise(async (resolve, reject) => { if (!node.value) { return resolve() @@ -245,14 +241,15 @@ ${rawHTML} return resolve() } - let imageRefs = [] + const imageRefs = [] $(`img`).each(function () { + // eslint-disable-next-line @babel/no-invalid-this imageRefs.push($(this)) }) - for (let thisImg of imageRefs) { + for (const thisImg of imageRefs) { // Get the details we need. - let formattedImgTag = {} + const formattedImgTag = {} formattedImgTag.url = thisImg.attr(`src`) formattedImgTag.title = thisImg.attr(`title`) formattedImgTag.alt = thisImg.attr(`alt`) diff --git a/packages/gatsby-remark-images-contentful/src/safe-sharp.js b/packages/gatsby-remark-images-contentful/src/safe-sharp.js index 6d97dfddd16a0..e92a40063c28c 100644 --- a/packages/gatsby-remark-images-contentful/src/safe-sharp.js +++ b/packages/gatsby-remark-images-contentful/src/safe-sharp.js @@ -44,7 +44,7 @@ const getDetailedMessage = () => { return dependency.dependencies.sharp.version } - for (let depName of Object.keys(dependency.dependencies)) { + for (const depName of Object.keys(dependency.dependencies)) { const v = findSharpVersion(dependency.dependencies[depName]) if (v) { return v @@ -78,7 +78,7 @@ const getDetailedMessage = () => { } ) - let packagesToUpdate = [] + const packagesToUpdate = [] // list top level dependencies msg = msg.concat([ `List of installed packages that depend on sharp:`, diff --git a/packages/gatsby-remark-images/src/index.js b/packages/gatsby-remark-images/src/index.js index 9795bb795cc8b..8e3845ce47f68 100644 --- a/packages/gatsby-remark-images/src/index.js +++ b/packages/gatsby-remark-images/src/index.js @@ -50,7 +50,7 @@ module.exports = ( // This will allow the use of html image tags // const rawHtmlNodes = select(markdownAST, `html`) - let rawHtmlNodes = [] + const rawHtmlNodes = [] visitWithParents(markdownAST, [`html`, `jsx`], (node, ancestors) => { const inLink = ancestors.some(findParentLinks) @@ -58,7 +58,7 @@ module.exports = ( }) // This will only work for markdown syntax image tags - let markdownImageNodes = [] + const markdownImageNodes = [] visitWithParents( markdownAST, @@ -148,7 +148,7 @@ module.exports = ( return resolve() } - let fluidResult = await fluid({ + const fluidResult = await fluid({ file: imageNode, args: options, reporter, @@ -387,14 +387,14 @@ module.exports = ( // Simple because there is no nesting in markdown markdownImageNodes.map( ({ node, inLink }) => - new Promise(async (resolve, reject) => { + new Promise(resolve => { const overWrites = {} let refNode if ( !node.hasOwnProperty(`url`) && node.hasOwnProperty(`identifier`) ) { - //consider as imageReference node + // consider as imageReference node refNode = node node = definitions(refNode.identifier) // pass original alt from referencing node @@ -414,22 +414,23 @@ module.exports = ( fileType !== `gif` && fileType !== `svg` ) { - const rawHTML = await generateImagesAndUpdateNode( + return generateImagesAndUpdateNode( node, resolve, inLink, overWrites - ) + ).then(rawHTML => { + if (rawHTML) { + // Replace the image or ref node with an inline HTML node. + if (refNode) { + node = refNode + } + node.type = `html` + node.value = rawHTML - if (rawHTML) { - // Replace the image or ref node with an inline HTML node. - if (refNode) { - node = refNode + resolve(node) } - node.type = `html` - node.value = rawHTML - } - return resolve(node) + }) } else { // Image isn't relative so there's nothing for us to do. return resolve() @@ -442,6 +443,7 @@ module.exports = ( // Complex because HTML nodes can contain multiple images rawHtmlNodes.map( ({ node, inLink }) => + // eslint-disable-next-line no-async-promise-executor new Promise(async (resolve, reject) => { if (!node.value) { return resolve() @@ -453,14 +455,15 @@ module.exports = ( return resolve() } - let imageRefs = [] + const imageRefs = [] $(`img`).each(function () { + // eslint-disable-next-line @babel/no-invalid-this imageRefs.push($(this)) }) - for (let thisImg of imageRefs) { + for (const thisImg of imageRefs) { // Get the details we need. - let formattedImgTag = {} + const formattedImgTag = {} formattedImgTag.url = thisImg.attr(`src`) formattedImgTag.title = thisImg.attr(`title`) formattedImgTag.alt = thisImg.attr(`alt`) diff --git a/packages/gatsby-remark-katex/src/__tests__/index.js b/packages/gatsby-remark-katex/src/__tests__/index.js index 5fffd21038814..8c76febebbc99 100644 --- a/packages/gatsby-remark-katex/src/__tests__/index.js +++ b/packages/gatsby-remark-katex/src/__tests__/index.js @@ -5,7 +5,7 @@ describe(`remark katex plugin`, () => { it(`renders inlineMath node properly`, () => { const equation = `$a^2 + b^2 = c^2$` let remark = new Remark() - for (let parserPlugins of plugin.setParserPlugins()) { + for (const parserPlugins of plugin.setParserPlugins()) { remark = remark.use(parserPlugins) } const markdownAST = remark.parse(equation) @@ -16,7 +16,7 @@ describe(`remark katex plugin`, () => { it(`renders double $ inlineMath node properly`, () => { const equation = `$$a^2 + b^2 = c^2$$` let remark = new Remark() - for (let parserPlugins of plugin.setParserPlugins()) { + for (const parserPlugins of plugin.setParserPlugins()) { remark = remark.use(parserPlugins) } const markdownAST = remark.parse(equation) @@ -27,7 +27,7 @@ describe(`remark katex plugin`, () => { it(`renders math node properly`, () => { const equation = `$$\na^2 + b^2 = c^2\n$$` let remark = new Remark() - for (let parserPlugins of plugin.setParserPlugins()) { + for (const parserPlugins of plugin.setParserPlugins()) { remark = remark.use(parserPlugins) } const markdownAST = remark.parse(equation) diff --git a/packages/gatsby-remark-prismjs/src/__tests__/add-line-numbers.js b/packages/gatsby-remark-prismjs/src/__tests__/add-line-numbers.js index 702ac9a49c4d6..363acd2adae64 100644 --- a/packages/gatsby-remark-prismjs/src/__tests__/add-line-numbers.js +++ b/packages/gatsby-remark-prismjs/src/__tests__/add-line-numbers.js @@ -19,7 +19,7 @@ describe(`returns the line numbers container`, () => { expect(numberOfLineNumbers).toEqual(3) }) it(`should return as many children as there are code lines and highlight classes`, () => { - //Expect 6 internal spans + // Expect 6 internal spans const highlightedCode = `line1\n` + `` + diff --git a/packages/gatsby-remark-prismjs/src/__tests__/load-prism-language-extension.js b/packages/gatsby-remark-prismjs/src/__tests__/load-prism-language-extension.js index 5b0cd8589a07a..3935598af84ee 100644 --- a/packages/gatsby-remark-prismjs/src/__tests__/load-prism-language-extension.js +++ b/packages/gatsby-remark-prismjs/src/__tests__/load-prism-language-extension.js @@ -12,12 +12,12 @@ describe(`extend/add prism language`, () => { expect(() => loadLanguageExtension(request)).toThrow() }) it(`should not throw an error if the request is an array`, () => { - let request = [] + const request = [] expect(() => loadLanguageExtension(request)).not.toThrow() }) it(`should not throw an error if the request is a valid object (containing 'language' and 'definition')`, () => { - let request = { + const request = { language: `aTypicalLanguage`, definition: /aRegexp/, } @@ -25,12 +25,12 @@ describe(`extend/add prism language`, () => { expect(() => loadLanguageExtension(request)).not.toThrow() }) it(`should throw an error if the request is not a valid object (containing 'language' and 'definition')`, () => { - let request = {} + const request = {} expect(() => loadLanguageExtension(request)).toThrow() }) it(`should throw an error if the request is an array containing an invalid object (not containing 'language' and 'definition')`, () => { - let request = [ + const request = [ { language: `aTypicalLanguage`, definition: /aRegexp/, @@ -86,7 +86,7 @@ describe(`extend/add prism language`, () => { loadLanguageExtension(request) - let languagesAfterLoaded = Object.keys(Prism.languages) + const languagesAfterLoaded = Object.keys(Prism.languages) expect(Prism.languages).toHaveProperty(request.language) expect(languagesAfterLoaded.length).toBe(languagesBeforeLoaded.length + 1) expect(Prism.languages[request.language][`flexc_keyword`]).toEqual( @@ -95,7 +95,7 @@ describe(`extend/add prism language`, () => { }) it(`should add new language`, () => { const request = { - language: `flexc2`, //Check if it is possible to reset scope somehow, instead of giving a new name. + language: `flexc2`, // Check if it is possible to reset scope somehow, instead of giving a new name. definition: { flexc_keyword: `(__cm|__circ|_lpp_indirect|__accum|__size_t|__ptrdiff_t|__wchar_t|__fixed|__abscall|__extcall|__stkcall|__sat|__i64_t|__i32_t|__i16_t|__r32_t|__r16_t|__u64_t|__u32_t|__u16_t|__a40_t|__a24_t)`, }, @@ -106,7 +106,7 @@ describe(`extend/add prism language`, () => { loadLanguageExtension(request) - let languagesAfterLoaded = Object.keys(Prism.languages) + const languagesAfterLoaded = Object.keys(Prism.languages) expect(Prism.languages).toHaveProperty(request.language) expect(languagesAfterLoaded.length).toBe(languagesBeforeLoaded.length + 1) expect(Prism.languages[request.language][`flexc_keyword`]).toEqual( @@ -116,7 +116,7 @@ describe(`extend/add prism language`, () => { it(`should work to make two requests by sending an array`, () => { const request = [ { - language: `flexc3`, //Check if it is possible to reset scope somehow, instead of giving a new name. + language: `flexc3`, // Check if it is possible to reset scope somehow, instead of giving a new name. definition: { flexc_keyword: `(__cm|__circ|_lpp_indirect|__accum|__size_t|__ptrdiff_t|__wchar_t|__fixed|__abscall|__extcall|__stkcall|__sat|__i64_t|__i32_t|__i16_t|__r32_t|__r16_t|__u64_t|__u32_t|__u16_t|__a40_t|__a24_t)`, }, @@ -135,7 +135,7 @@ describe(`extend/add prism language`, () => { loadLanguageExtension(request) - let languagesAfterLoaded = Object.keys(Prism.languages) + const languagesAfterLoaded = Object.keys(Prism.languages) expect(Prism.languages).toHaveProperty(`flexc3`) expect(languagesAfterLoaded.length).toBe(languagesBeforeLoaded.length + 1) expect(Prism.languages[`c`]).toHaveProperty(`new_token`) diff --git a/packages/gatsby-remark-prismjs/src/highlight-code.js b/packages/gatsby-remark-prismjs/src/highlight-code.js index 9b54ec43e88b3..0ec8299428e6f 100644 --- a/packages/gatsby-remark-prismjs/src/highlight-code.js +++ b/packages/gatsby-remark-prismjs/src/highlight-code.js @@ -48,7 +48,7 @@ module.exports = ( try { loadPrismLanguage(diffLanguage) } catch (e) { - let message = `unable to find prism language '${diffLanguage}' for highlighting.` + const message = `unable to find prism language '${diffLanguage}' for highlighting.` const lang = diffLanguage.toLowerCase() if (!unsupportedLanguages.has(lang)) { diff --git a/packages/gatsby-remark-prismjs/src/index.js b/packages/gatsby-remark-prismjs/src/index.js index e6bca48c5dc76..04ae85f2bc17b 100644 --- a/packages/gatsby-remark-prismjs/src/index.js +++ b/packages/gatsby-remark-prismjs/src/index.js @@ -31,13 +31,13 @@ module.exports = ( return aliases[lower] || lower } - //Load language extension if defined + // Load language extension if defined loadLanguageExtension(languageExtensions) visit(markdownAST, `code`, node => { let language = node.meta ? node.lang + node.meta : node.lang let diffLanguage - let { + const { splitLanguage, highlightLines, showLineNumbersLocal, @@ -98,7 +98,9 @@ module.exports = ( diffLanguage ) - let numLinesStyle, numLinesClass, numLinesNumber + let numLinesStyle + let numLinesClass + let numLinesNumber numLinesStyle = numLinesClass = numLinesNumber = `` if (showLineNumbers) { numLinesStyle = ` style="counter-reset: linenumber ${ @@ -137,7 +139,10 @@ module.exports = ( let languageName = `text` if (inlineCodeMarker) { - let [language, restOfValue] = node.value.split(`${inlineCodeMarker}`, 2) + const [language, restOfValue] = node.value.split( + `${inlineCodeMarker}`, + 2 + ) if (language && restOfValue) { languageName = normalizeLanguage(language) node.value = restOfValue diff --git a/packages/gatsby-remark-prismjs/src/load-prism-language-extension.js b/packages/gatsby-remark-prismjs/src/load-prism-language-extension.js index 97fc42e65ee1e..a24dab9c27b23 100644 --- a/packages/gatsby-remark-prismjs/src/load-prism-language-extension.js +++ b/packages/gatsby-remark-prismjs/src/load-prism-language-extension.js @@ -3,7 +3,7 @@ const loadPrismLanguage = require(`./load-prism-language`) const replaceStringWithRegex = require(`./replace-string-with-regexp`) module.exports = languageExtensions => { - //Create array of languageExtensions (if input is object) + // Create array of languageExtensions (if input is object) languageExtensions = [].concat(languageExtensions) languageExtensions.forEach(l => { @@ -11,7 +11,7 @@ module.exports = languageExtensions => { }) } -let loadLanguageExtension = languageExtension => { +const loadLanguageExtension = languageExtension => { if (!isObjectAndNotArray(languageExtension)) { throw new Error( `A languageExtension needs to be defined as an object. Given config is not valid: ${JSON.stringify( @@ -44,7 +44,7 @@ let loadLanguageExtension = languageExtension => { if (!languageExtension.extend) { Prism.languages[languageExtension.language] = languageExtension.definition } else { - //Loads language if not already loaded. + // Loads language if not already loaded. loadPrismLanguage(languageExtension.extend) Prism.languages[languageExtension.language] = Prism.languages.extend( @@ -66,7 +66,7 @@ let loadLanguageExtension = languageExtension => { } const isObjectAndNotArray = extension => - //Array is an Object in javascript + // Array is an Object in javascript !Array.isArray(extension) && typeof extension === `object` const containsMandatoryProperties = languageExtension => { diff --git a/packages/gatsby-remark-prismjs/src/parse-options.js b/packages/gatsby-remark-prismjs/src/parse-options.js index 7f76653b96568..bf12821d42b6b 100644 --- a/packages/gatsby-remark-prismjs/src/parse-options.js +++ b/packages/gatsby-remark-prismjs/src/parse-options.js @@ -5,18 +5,18 @@ module.exports = language => { return `` } if (language.split(`{`).length > 1) { - let [splitLanguage, ...options] = language.split(`{`) - let highlightLines = [], - outputLines = [], - showLineNumbersLocal = false, - numberLinesStartAt, - promptUserLocal, - promptHostLocal + const [splitLanguage, ...options] = language.split(`{`) + let highlightLines = [] + let outputLines = [] + let showLineNumbersLocal = false + let numberLinesStartAt + let promptUserLocal + let promptHostLocal // Options can be given in any order and are optional options.forEach(option => { option = option.slice(0, -1) - let splitOption = option.replace(/ /g, ``).split(`:`) + const splitOption = option.replace(/ /g, ``).split(`:`) // Test if the option is for line highlighting if (splitOption.length === 1 && rangeParser.parse(option).length > 0) { diff --git a/packages/gatsby-remark-prismjs/src/plugins/prism-show-invisibles.js b/packages/gatsby-remark-prismjs/src/plugins/prism-show-invisibles.js index ef6eac63f348c..388a7131e87ed 100644 --- a/packages/gatsby-remark-prismjs/src/plugins/prism-show-invisibles.js +++ b/packages/gatsby-remark-prismjs/src/plugins/prism-show-invisibles.js @@ -29,7 +29,7 @@ module.exports = (language = `javascript`) => { return } - var invisibles = { + const invisibles = { tab: /\t/, crlf: /\r\n/, lf: /\n/, @@ -44,30 +44,32 @@ module.exports = (language = `javascript`) => { * @param {string|number} name The name or index of the token in `tokens`. */ function handleToken(tokens, name) { - var value = tokens[name] + const value = tokens[name] - var type = Prism.util.type(value) + const type = Prism.util.type(value) switch (type) { - case `RegExp`: - var inside = {} + case `RegExp`: { + const inside = {} tokens[name] = { pattern: value, inside: inside, } addInvisibles(inside) break - - case `Array`: - for (var i = 0, l = value.length; i < l; i++) { + } + case `Array`: { + for (let i = 0, l = value.length; i < l; i++) { handleToken(value, i) } break + } - default: + default: { // 'Object' - var inside = value.inside || (value.inside = {}) // eslint-disable-line no-redeclare + const inside = value.inside || (value.inside = {}) // eslint-disable-line no-redeclare addInvisibles(inside) break + } } } @@ -82,14 +84,14 @@ module.exports = (language = `javascript`) => { } // assign invisibles here to "mark" the grammar in case of self references - for (var name in invisibles) { + for (const name in invisibles) { if (invisibles.hasOwnProperty(name)) { grammar[name] = invisibles[name] } } /* eslint-disable no-redeclare */ - for (var name in grammar) { + for (const name in grammar) { /* eslint-enable no-redeclare */ if (grammar.hasOwnProperty(name) && !invisibles[name]) { if (name === `rest`) { diff --git a/packages/gatsby-source-contentful/src/__tests__/gatsby-node.js b/packages/gatsby-source-contentful/src/__tests__/gatsby-node.js index 141bdbd2343d3..809e2c203b943 100644 --- a/packages/gatsby-source-contentful/src/__tests__/gatsby-node.js +++ b/packages/gatsby-source-contentful/src/__tests__/gatsby-node.js @@ -39,8 +39,8 @@ describe(`gatsby-node`, () => { } const createNodeId = jest.fn(value => value) let currentNodeMap - let getNodes = () => Array.from(currentNodeMap.values()) - let getNode = id => currentNodeMap.get(id) + const getNodes = () => Array.from(currentNodeMap.values()) + const getNode = id => currentNodeMap.get(id) const getFieldValue = (value, locale, defaultLocale) => value[locale] ?? value[defaultLocale] @@ -545,7 +545,7 @@ describe(`gatsby-node`, () => { pluginOptions ) - let authorIds = [] + const authorIds = [] // check if blog post exists removedBlogEntryIds.forEach(entryId => { const blogEntry = getNode(entryId) @@ -693,7 +693,7 @@ describe(`gatsby-node`, () => { const initNodes = getNodes() const homeNodes = initNodes.filter( - ({ contentful_id }) => contentful_id === `6KpLS2NZyB3KAvDzWf4Ukh` + ({ contentful_id: id }) => id === `6KpLS2NZyB3KAvDzWf4Ukh` ) homeNodes.forEach(homeNode => { expect(homeNode.content.references___NODE).toStrictEqual([ diff --git a/packages/gatsby-source-contentful/src/__tests__/normalize.js b/packages/gatsby-source-contentful/src/__tests__/normalize.js index edcbbb8db6cca..226fc44d69dc2 100644 --- a/packages/gatsby-source-contentful/src/__tests__/normalize.js +++ b/packages/gatsby-source-contentful/src/__tests__/normalize.js @@ -101,19 +101,19 @@ describe(`Process contentful data (by name)`, () => { describe(`Skip existing nodes in warm build`, () => { it(`creates nodes for each entry`, () => { - let entryList = normalize.buildEntryList({ + const entryList = normalize.buildEntryList({ mergedSyncData: currentSyncData, contentTypeItems, }) - let resolvable = normalize.buildResolvableSet({ + const resolvable = normalize.buildResolvableSet({ assets: currentSyncData.assets, entryList, defaultLocale, locales, }) - let foreignReferenceMap = normalize.buildForeignReferenceMap({ + const foreignReferenceMap = normalize.buildForeignReferenceMap({ contentTypeItems, entryList, resolvable, @@ -184,19 +184,19 @@ describe(`Skip existing nodes in warm build`, () => { describe(`Process existing mutated nodes in warm build`, () => { it(`creates nodes for each entry`, () => { - let entryList = normalize.buildEntryList({ + const entryList = normalize.buildEntryList({ mergedSyncData: currentSyncData, contentTypeItems, }) - let resolvable = normalize.buildResolvableSet({ + const resolvable = normalize.buildResolvableSet({ assets: currentSyncData.assets, entryList, defaultLocale, locales, }) - let foreignReferenceMap = normalize.buildForeignReferenceMap({ + const foreignReferenceMap = normalize.buildForeignReferenceMap({ contentTypeItems, entryList, resolvable, diff --git a/packages/gatsby-source-contentful/src/cache-image.js b/packages/gatsby-source-contentful/src/cache-image.js index 8997006bc6f95..52232679a5eb0 100644 --- a/packages/gatsby-source-contentful/src/cache-image.js +++ b/packages/gatsby-source-contentful/src/cache-image.js @@ -56,17 +56,20 @@ module.exports = async function cacheImage(store, image, options) { await inFlight } else if (!alreadyExists) { // File doesn't exist and is not being download yet - const downloadPromise = new Promise(async (resolve, reject) => { + const downloadPromise = new Promise((resolve, reject) => { const previewUrl = `http:${url}?${params.join(`&`)}` - const response = await downloadWithRetry({ + downloadWithRetry({ url: previewUrl, responseType: `stream`, }) - const file = createWriteStream(absolutePath) - response.data.pipe(file) - file.on(`finish`, resolve) - file.on(`error`, reject) + .then(response => { + const file = createWriteStream(absolutePath) + response.data.pipe(file) + file.on(`finish`, resolve) + file.on(`error`, reject) + }) + .catch(reject) }) inFlightImageCache.set(absolutePath, downloadPromise) await downloadPromise diff --git a/packages/gatsby-source-contentful/src/extend-node-type.js b/packages/gatsby-source-contentful/src/extend-node-type.js index 4cc752b5422f2..41d01fbba5336 100644 --- a/packages/gatsby-source-contentful/src/extend-node-type.js +++ b/packages/gatsby-source-contentful/src/extend-node-type.js @@ -317,7 +317,8 @@ const resolveFixed = (image, options) => { }) .join(`,\n`) - let pickedHeight, pickedWidth + let pickedHeight + let pickedWidth if (options.height) { pickedHeight = options.height pickedWidth = options.height * desiredAspectRatio @@ -449,8 +450,8 @@ const resolveResize = (image, options) => { } } - let pickedHeight = options.height, - pickedWidth = options.width + let pickedHeight = options.height + let pickedWidth = options.width if (pickedWidth === undefined) { pickedWidth = pickedHeight * aspectRatio diff --git a/packages/gatsby-source-contentful/src/fetch.js b/packages/gatsby-source-contentful/src/fetch.js index b66d027ddb61c..67c70ee965988 100644 --- a/packages/gatsby-source-contentful/src/fetch.js +++ b/packages/gatsby-source-contentful/src/fetch.js @@ -153,7 +153,7 @@ ${formatPluginOptionsForCLI(pluginConfig.getOriginalPluginOptions(), errors)}`, ) syncProgress.start() reporter.verbose(`Contentful: Sync ${pageLimit} items per page.`) - let query = syncToken + const query = syncToken ? { nextSyncToken: syncToken, ...basicSyncConfig } : { initial: true, ...basicSyncConfig } currentSyncData = await client.sync(query) @@ -189,7 +189,7 @@ ${formatPluginOptionsForCLI(pluginConfig.getOriginalPluginOptions(), errors)}`, } reporter.verbose(`Content types fetched ${contentTypes.items.length}`) - let contentTypeItems = contentTypes.items + const contentTypeItems = contentTypes.items const result = { currentSyncData, diff --git a/packages/gatsby-source-contentful/src/fragments.js b/packages/gatsby-source-contentful/src/fragments.js index 8ac3da7d7c240..770f9a1d65e26 100644 --- a/packages/gatsby-source-contentful/src/fragments.js +++ b/packages/gatsby-source-contentful/src/fragments.js @@ -1,3 +1,4 @@ +/* eslint-disable camelcase */ import { graphql } from "gatsby" /** diff --git a/packages/gatsby-source-contentful/src/gatsby-node.js b/packages/gatsby-source-contentful/src/gatsby-node.js index 1fbc0c8b0a4e0..0535a66c6115f 100644 --- a/packages/gatsby-source-contentful/src/gatsby-node.js +++ b/packages/gatsby-source-contentful/src/gatsby-node.js @@ -41,7 +41,7 @@ const validateContentfulAccess = async pluginOptions => { .then(res => res.ok) .then(ok => { if (!ok) { - let errorMessage = `Cannot access Contentful space "${maskText( + const errorMessage = `Cannot access Contentful space "${maskText( pluginOptions.spaceId )}" on environment "${ pluginOptions.environment @@ -170,7 +170,11 @@ exports.sourceNodes = async ( ) => { const { createNode, deleteNode, touchNode, createTypes } = actions - let currentSyncData, contentTypeItems, defaultLocale, locales, space + let currentSyncData + let contentTypeItems + let defaultLocale + let locales + let space if (process.env.GATSBY_CONTENTFUL_EXPERIMENTAL_FORCE_CACHE) { reporter.info( `GATSBY_CONTENTFUL_EXPERIMENTAL_FORCE_CACHE: Storing/loading remote data through \`` + @@ -200,12 +204,12 @@ exports.sourceNodes = async ( * with all data from subsequent syncs. Afterwards the references get * resolved via the Contentful JS SDK. */ - let syncToken = await cache.get(CACHE_SYNC_TOKEN) + const syncToken = await cache.get(CACHE_SYNC_TOKEN) let previousSyncData = { assets: [], entries: [], } - let cachedData = await cache.get(CACHE_SYNC_DATA) + const cachedData = await cache.get(CACHE_SYNC_DATA) if (cachedData) { previousSyncData = cachedData diff --git a/packages/gatsby-source-contentful/src/normalize.js b/packages/gatsby-source-contentful/src/normalize.js index 72a6468e341a7..fde42f7507e72 100644 --- a/packages/gatsby-source-contentful/src/normalize.js +++ b/packages/gatsby-source-contentful/src/normalize.js @@ -58,7 +58,7 @@ exports.buildEntryList = ({ contentTypeItems, mergedSyncData }) => { ) // Now fill the buckets. Ignore entries for which there exists no bucket. (Not sure if that ever happens) mergedSyncData.entries.map(entry => { - let arr = map.get(entry.sys.contentType.sys.id) + const arr = map.get(entry.sys.contentType.sys.id) if (arr) { arr.push(entry) } @@ -121,7 +121,7 @@ exports.buildForeignReferenceMap = ({ const entryItemFields = entryItem.fields Object.keys(entryItemFields).forEach(entryItemFieldKey => { if (entryItemFields[entryItemFieldKey]) { - let entryItemFieldValue = + const entryItemFieldValue = entryItemFields[entryItemFieldKey][defaultLocale] // If this is an array of single reference object // add to the reference map, otherwise ignore. @@ -488,7 +488,7 @@ exports.createNodesForContentType = ({ // Locate all Contentful Links within the rich text data const traverse = obj => { - for (let k in obj) { + for (const k in obj) { const v = obj[k] if (v && v.sys && v.sys.type === `Link`) { rawReferences.push(v) diff --git a/packages/gatsby-source-drupal/src/__tests__/index.js b/packages/gatsby-source-drupal/src/__tests__/index.js index 19c6a7e1b6307..75003f07c6bc8 100644 --- a/packages/gatsby-source-drupal/src/__tests__/index.js +++ b/packages/gatsby-source-drupal/src/__tests__/index.js @@ -193,8 +193,8 @@ describe(`gatsby-source-drupal`, () => { `https://files.s3.eu-central-1.amazonaws.com/2020-05/third-image.png`, `/sites/default/files/forth-image.png`, ].map(fileUrl => new URL(fileUrl, baseUrl).href) - //first call without basicAuth (no fileSystem defined) - //(the first call is actually the 5th because sourceNodes was ran at first with no basicAuth) + // first call without basicAuth (no fileSystem defined) + // (the first call is actually the 5th because sourceNodes was ran at first with no basicAuth) expect(createRemoteFileNode).toHaveBeenNthCalledWith( 5, expect.objectContaining({ @@ -202,7 +202,7 @@ describe(`gatsby-source-drupal`, () => { auth: {}, }) ) - //2nd call with basicAuth (public: fileSystem defined) + // 2nd call with basicAuth (public: fileSystem defined) expect(createRemoteFileNode).toHaveBeenNthCalledWith( 6, expect.objectContaining({ @@ -213,7 +213,7 @@ describe(`gatsby-source-drupal`, () => { }, }) ) - //3rd call without basicAuth (s3: fileSystem defined) + // 3rd call without basicAuth (s3: fileSystem defined) expect(createRemoteFileNode).toHaveBeenNthCalledWith( 7, expect.objectContaining({ @@ -221,7 +221,7 @@ describe(`gatsby-source-drupal`, () => { auth: {}, }) ) - //4th call with basicAuth (private: fileSystem defined) + // 4th call with basicAuth (private: fileSystem defined) expect(createRemoteFileNode).toHaveBeenNthCalledWith( 8, expect.objectContaining({ diff --git a/packages/gatsby-source-drupal/src/gatsby-node.js b/packages/gatsby-source-drupal/src/gatsby-node.js index fa237bf84c380..06bc684555489 100644 --- a/packages/gatsby-source-drupal/src/gatsby-node.js +++ b/packages/gatsby-source-drupal/src/gatsby-node.js @@ -108,7 +108,7 @@ exports.sourceNodes = async ( fastBuilds = fastBuilds || false if (fastBuilds) { - let lastFetched = + const lastFetched = store.getState().status.plugins?.[`gatsby-source-drupal`]?.lastFetched ?? 0 @@ -144,7 +144,7 @@ exports.sourceNodes = async ( }) // Process sync data from Drupal. - let nodesToSync = data.data.entities + const nodesToSync = data.data.entities for (const nodeSyncData of nodesToSync) { if (nodeSyncData.action === `delete`) { actions.deleteNode(getNode(createNodeId(nodeSyncData.id))) diff --git a/packages/gatsby-source-drupal/src/normalize.js b/packages/gatsby-source-drupal/src/normalize.js index 61cbb91d29a62..d8fe3c4912825 100644 --- a/packages/gatsby-source-drupal/src/normalize.js +++ b/packages/gatsby-source-drupal/src/normalize.js @@ -2,9 +2,9 @@ const { URL } = require(`url`) const { createRemoteFileNode } = require(`gatsby-source-filesystem`) const nodeFromData = (datum, createNodeId) => { - const { attributes: { id: _attributes_id, ...attributes } = {} } = datum + const { attributes: { id: attributeId, ...attributes } = {} } = datum const preservedId = - typeof _attributes_id !== `undefined` ? { _attributes_id } : {} + typeof attributeId !== `undefined` ? { _attributes_id: attributeId } : {} return { id: createNodeId(datum.id), drupal_id: datum.id, @@ -34,7 +34,6 @@ exports.downloadFile = async ( ) => { // handle file downloads if (isFileNode(node)) { - let fileNode let fileType let fileUrl = node.url @@ -42,8 +41,8 @@ exports.downloadFile = async ( // Support JSON API 2.x file URI format https://www.drupal.org/node/2982209 fileUrl = node.uri.url // get file type from uri prefix ("S3:", "public:", etc.) - const uri_prefix = node.uri.value.match(/^\w*:/) - fileType = uri_prefix ? uri_prefix[0] : null + const uriPrefix = node.uri.value.match(/^\w*:/) + fileType = uriPrefix ? uriPrefix[0] : null } // Resolve w/ baseUrl if node.uri isn't absolute. const url = new URL(fileUrl, baseUrl) @@ -56,7 +55,7 @@ exports.downloadFile = async ( htaccess_pass: basicAuth.password, } : {} - fileNode = await createRemoteFileNode({ + const fileNode = await createRemoteFileNode({ url: url.href, store, cache, diff --git a/packages/gatsby-source-faker/src/__tests__/gatsby-node.js b/packages/gatsby-source-faker/src/__tests__/gatsby-node.js index f0bc191c9fd2a..d408a23ab9bb8 100644 --- a/packages/gatsby-source-faker/src/__tests__/gatsby-node.js +++ b/packages/gatsby-source-faker/src/__tests__/gatsby-node.js @@ -1,7 +1,7 @@ const { sourceNodes } = require(`../gatsby-node`) describe(`gatsby-source-faker`, () => { - let actions = {} + const actions = {} let createNodeId let createContentDigest diff --git a/packages/gatsby-source-faker/src/gatsby-node.js b/packages/gatsby-source-faker/src/gatsby-node.js index a84eadffcbb89..42e532ac9f51e 100644 --- a/packages/gatsby-source-faker/src/gatsby-node.js +++ b/packages/gatsby-source-faker/src/gatsby-node.js @@ -7,7 +7,7 @@ exports.sourceNodes = ( const { createNode } = actions const { schema, count, type } = pluginOptions for (let i = 0; i < count; i++) { - let item = {} + const item = {} Object.keys(schema).map(schemaKey => { const schemaItemList = schema[schemaKey] item[schemaKey] = {} diff --git a/packages/gatsby-source-filesystem/src/gatsby-node.js b/packages/gatsby-source-filesystem/src/gatsby-node.js index 72f6449abcabf..9b319120af77c 100644 --- a/packages/gatsby-source-filesystem/src/gatsby-node.js +++ b/packages/gatsby-source-filesystem/src/gatsby-node.js @@ -45,7 +45,7 @@ const createFSMachine = ( // After 'ready', we handle the 'add' event without putting it into a queue. let pathQueue = [] const flushPathQueue = () => { - let queue = pathQueue.slice() + const queue = pathQueue.slice() pathQueue = null return Promise.all( // eslint-disable-next-line consistent-return diff --git a/packages/gatsby-source-graphql/src/batching/__tests__/merge-queries.js b/packages/gatsby-source-graphql/src/batching/__tests__/merge-queries.js index ffe5c7f5cb40e..ea1d11b061371 100644 --- a/packages/gatsby-source-graphql/src/batching/__tests__/merge-queries.js +++ b/packages/gatsby-source-graphql/src/batching/__tests__/merge-queries.js @@ -64,7 +64,6 @@ describe(`Query merging`, () => { expect(print(query)).toEqual(print(expectedQuery)) expect(variables).toEqual({ - /* eslint-disable @typescript-eslint/camelcase */ gatsby0_id: `1`, gatsby1_id: `2`, gatsby2_id: `3`, @@ -103,7 +102,6 @@ describe(`Query merging`, () => { `) expect(print(query)).toEqual(print(expected)) expect(variables).toEqual({ - /* eslint-disable @typescript-eslint/camelcase */ gatsby0_id: `1`, gatsby1_id: `2`, gatsby2_id: `3`, @@ -158,7 +156,6 @@ describe(`Query merging`, () => { `) expect(print(query)).toEqual(print(expected)) expect(variables).toEqual({ - /* eslint-disable @typescript-eslint/camelcase */ gatsby0_id: `1`, gatsby1_id: `2`, }) diff --git a/packages/gatsby-source-hacker-news/src/gatsby-node.js b/packages/gatsby-source-hacker-news/src/gatsby-node.js index b673a89c65a9b..1339d11d2c1be 100644 --- a/packages/gatsby-source-hacker-news/src/gatsby-node.js +++ b/packages/gatsby-source-hacker-news/src/gatsby-node.js @@ -115,8 +115,7 @@ fragment commentsFragment on HackerNewsItem { } } - let kids - kids = _.pick(story, `kids`) + const kids = _.pick(story, `kids`) if (!kids.kids) { kids.kids = [] } @@ -153,8 +152,8 @@ fragment commentsFragment on HackerNewsItem { if (!comment.kids) { comment.kids = [] } - let commentChildIds = comment.kids.map(k => createNodeId(k.id)) - let commentNode = { + const commentChildIds = comment.kids.map(k => createNodeId(k.id)) + const commentNode = { ..._.omit(comment, `kids`), id: createNodeId(comment.id), children: commentChildIds, diff --git a/packages/gatsby-source-lever/src/fetch.js b/packages/gatsby-source-lever/src/fetch.js index e0d981166c4f5..77cafb31ce891 100644 --- a/packages/gatsby-source-lever/src/fetch.js +++ b/packages/gatsby-source-lever/src/fetch.js @@ -10,7 +10,7 @@ async function fetch({ site, verbose, typePrefix }) { let entities = [] try { - let res = await axios({ + const res = await axios({ method: `get`, url: `https://api.lever.co/v0/postings/${site}?mode=json`, }) diff --git a/packages/gatsby-source-lever/src/normalize.js b/packages/gatsby-source-lever/src/normalize.js index ae13e63f4d352..9ad163377cb7b 100644 --- a/packages/gatsby-source-lever/src/normalize.js +++ b/packages/gatsby-source-lever/src/normalize.js @@ -19,7 +19,7 @@ async function createGraphQLNode( cache, createContentDigest ) { - let id = !ent.id ? (!ent.ID ? 0 : ent.ID) : ent.id + const id = !ent.id ? (!ent.ID ? 0 : ent.ID) : ent.id let node = { id: `${type}_${id.toString()}`, children: [], @@ -43,9 +43,9 @@ exports.createGraphQLNode = createGraphQLNode * @returns the new node */ function recursiveAddFields(ent, newEnt) { - for (let k of Object.keys(ent)) { + for (const k of Object.keys(ent)) { if (!newEnt.hasOwnProperty(k)) { - let key = getValidKey(k) + const key = getValidKey(k) newEnt[key] = ent[k] // Nested Objects & Arrays of Objects if (typeof ent[key] === `object`) { @@ -133,8 +133,8 @@ exports.createNodesFromEntities = ({ createContentDigest, }) => { entities.forEach(e => { - let { ...entity } = e - let node = { + const { ...entity } = e + const node = { ...entity, parent: null, children: [], diff --git a/packages/gatsby-source-mongodb/src/gatsby-node.js b/packages/gatsby-source-mongodb/src/gatsby-node.js index 80912eff57d35..f31a7a599e706 100644 --- a/packages/gatsby-source-mongodb/src/gatsby-node.js +++ b/packages/gatsby-source-mongodb/src/gatsby-node.js @@ -10,16 +10,16 @@ exports.sourceNodes = ( ) => { const { createNode } = actions - let serverOptions = pluginOptions.server || { + const serverOptions = pluginOptions.server || { address: `localhost`, port: 27017, } - let dbName = pluginOptions.dbName || `local`, - authUrlPart = `` + const dbName = pluginOptions.dbName || `local` + let authUrlPart = `` if (pluginOptions.auth) authUrlPart = `${pluginOptions.auth.user}:${pluginOptions.auth.password}@` - let connectionExtraParams = getConnectionExtraParams( + const connectionExtraParams = getConnectionExtraParams( pluginOptions.extraParams ) const clientOptions = pluginOptions.clientOptions || { @@ -82,8 +82,8 @@ function createNodes( ) { const { preserveObjectIds = false, query = {} } = pluginOptions return new Promise((resolve, reject) => { - let collection = db.collection(collectionName) - let cursor = collection.find( + const collection = db.collection(collectionName) + const cursor = collection.find( query[collectionName] ? query[collectionName] : {} ) @@ -98,7 +98,7 @@ function createNodes( // only call recursive function to preserve relations represented by objectids if pluginoption set. if (preserveObjectIds) { - for (let key in item) { + for (const key in item) { item[key] = stringifyObjectIds(item[key]) } } diff --git a/packages/gatsby-source-wikipedia/src/fetch.js b/packages/gatsby-source-wikipedia/src/fetch.js index 21cd26171468b..3e5fac7439bb0 100644 --- a/packages/gatsby-source-wikipedia/src/fetch.js +++ b/packages/gatsby-source-wikipedia/src/fetch.js @@ -34,7 +34,7 @@ const getMetaData = name => ) .then(response => response.json()) .then(data => { - var page = data.query.pages[Object.keys(data.query.pages)[0]] + const page = data.query.pages[Object.keys(data.query.pages)[0]] if (`missing` in page) { return { err: `Not found` } diff --git a/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-remote-file-node/index.js b/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-remote-file-node/index.js index ee0b995c14b02..bc64f7774c80b 100644 --- a/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-remote-file-node/index.js +++ b/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-remote-file-node/index.js @@ -21,7 +21,7 @@ let bar // Keep track of the total number of jobs we push in the queue let totalJobs = 0 -/** ****************** +/******************** * Type Definitions * ********************/ @@ -61,7 +61,7 @@ const STALL_TIMEOUT = 30000 const CONNECTION_RETRY_LIMIT = 5 const CONNECTION_TIMEOUT = 30000 -/** ****************** +/******************** * Queue Management * ********************/ @@ -134,7 +134,7 @@ async function pushToQueue(task, cb) { } } -/** **************** +/****************** * Core Functions * ******************/ @@ -350,7 +350,7 @@ const pushTask = task => }) }) -/** ************* +/*************** * Entry Point * ***************/ diff --git a/packages/gatsby-telemetry/src/__tests__/repository-id.ts b/packages/gatsby-telemetry/src/__tests__/repository-id.ts index fff867d5cdf81..2eceff4ef4532 100644 --- a/packages/gatsby-telemetry/src/__tests__/repository-id.ts +++ b/packages/gatsby-telemetry/src/__tests__/repository-id.ts @@ -65,7 +65,7 @@ describe(`Repository ID Helpers`, () => { process.env.NETLIFY = `1` process.env.REPOSITORY_URL = `https://x-access-token:v1.6a60ab57393b6e8a11baf6435ae6f8097157033d@github.com/user/repo` - //`https://x-access-token:v1.6xxxxxxxxxxxxxxxxx@github.com/user/repo` + // `https://x-access-token:v1.6xxxxxxxxxxxxxxxxx@github.com/user/repo` const id = getRepositoryId() expect(id).toEqual({ repositoryId: `git:${hash(mockGitRemote)}`, diff --git a/packages/gatsby-telemetry/src/store.ts b/packages/gatsby-telemetry/src/store.ts index d1f351901e536..6f48db6897f0d 100644 --- a/packages/gatsby-telemetry/src/store.ts +++ b/packages/gatsby-telemetry/src/store.ts @@ -22,7 +22,7 @@ export class Store { try { appendFileSync(this.bufferFilePath, event, `utf8`) } catch (e) { - //ignore + // ignore } } diff --git a/packages/gatsby-transformer-asciidoc/src/gatsby-node.js b/packages/gatsby-transformer-asciidoc/src/gatsby-node.js index b54d6f559b925..1395eeb1cabbf 100644 --- a/packages/gatsby-transformer-asciidoc/src/gatsby-node.js +++ b/packages/gatsby-transformer-asciidoc/src/gatsby-node.js @@ -44,7 +44,7 @@ async function onCreateNode( // Load Asciidoc file for extracting // https://asciidoctor-docs.netlify.app/asciidoctor.js/processor/extract-api/ // We use a `let` here as a warning: some operations, like .convert() mutate the document - let doc = await asciidoc.load(content, { + const doc = await asciidoc.load(content, { base_dir: node.dir, ...asciidocOptions, }) @@ -76,7 +76,7 @@ async function onCreateNode( } } - let pageAttributes = extractPageAttributes(doc.getAttributes()) + const pageAttributes = extractPageAttributes(doc.getAttributes()) const asciiNode = { id: createNodeId(`${node.id} >>> ASCIIDOC`), diff --git a/packages/gatsby-transformer-csv/src/gatsby-node.js b/packages/gatsby-transformer-csv/src/gatsby-node.js index ca06e2dd78211..92390d737dc2a 100644 --- a/packages/gatsby-transformer-csv/src/gatsby-node.js +++ b/packages/gatsby-transformer-csv/src/gatsby-node.js @@ -32,7 +32,7 @@ async function onCreateNode( const content = await loadNodeContent(node) // Parse - let parsedContent = await convertToJson(content, options) + const parsedContent = await convertToJson(content, options) // Generate the type function getType({ node, object }) { diff --git a/packages/gatsby-transformer-documentationjs/src/__tests__/gatsby-node.js b/packages/gatsby-transformer-documentationjs/src/__tests__/gatsby-node.js index 58a98cd0f862f..bca83651c3af7 100644 --- a/packages/gatsby-transformer-documentationjs/src/__tests__/gatsby-node.js +++ b/packages/gatsby-transformer-documentationjs/src/__tests__/gatsby-node.js @@ -3,7 +3,8 @@ import path from "path" import gatsbyNode from "../gatsby-node" describe(`gatsby-transformer-documentationjs: onCreateNode`, () => { - let createdNodes, updatedNodes + let createdNodes + let updatedNodes const createNodeId = jest.fn(id => id) const createContentDigest = jest.fn().mockReturnValue(`content-digest`) @@ -147,7 +148,8 @@ describe(`gatsby-transformer-documentationjs: onCreateNode`, () => { await run(getFileNode(`complex-example.js`)) }) - let callbackNode, typedefNode + let callbackNode + let typedefNode it(`should create top-level node for callback`, () => { callbackNode = createdNodes.find( @@ -170,7 +172,8 @@ describe(`gatsby-transformer-documentationjs: onCreateNode`, () => { expect(typedefNode).toBeDefined() }) - let readyNode, nestedNode + let readyNode + let nestedNode it(`should have property nodes for typedef`, () => { expect(typedefNode.properties___NODE).toBeDefined() @@ -184,7 +187,9 @@ describe(`gatsby-transformer-documentationjs: onCreateNode`, () => { expect(readyNode).toMatchSnapshot() }) - let nestedFooNode, nestedOptionalNode, nestedCallbackNode + let nestedFooNode + let nestedOptionalNode + let nestedCallbackNode it(`should have second param as nested object`, () => { expect(nestedNode.name).toBe(`nested`) @@ -229,7 +234,8 @@ describe(`gatsby-transformer-documentationjs: onCreateNode`, () => { }) describe(`should handle members`, () => { - let complexNode, memberNode + let complexNode + let memberNode beforeAll(() => { complexNode = createdNodes.find( node => node.name === `complex` && node.parent === `node_1` @@ -349,7 +355,7 @@ describe(`gatsby-transformer-documentationjs: onCreateNode`, () => { describe(`Sanity checks`, () => { it(`should extract create description nodes with markdown types`, () => { - let types = groupBy(createdNodes, `internal.type`) + const types = groupBy(createdNodes, `internal.type`) expect( types.DocumentationJSComponentDescription.every( d => d.internal.mediaType === `text/markdown` diff --git a/packages/gatsby-transformer-excel/src/gatsby-node.js b/packages/gatsby-transformer-excel/src/gatsby-node.js index dfe6fbdaacd9f..451a744e4fd26 100644 --- a/packages/gatsby-transformer-excel/src/gatsby-node.js +++ b/packages/gatsby-transformer-excel/src/gatsby-node.js @@ -66,10 +66,10 @@ async function onCreateNode( delete xlsxOptions.plugins // Parse - let wb = XLSX.read(content, { type: `binary`, cellDates: true }) + const wb = XLSX.read(content, { type: `binary`, cellDates: true }) wb.SheetNames.forEach((n, idx) => { - let ws = wb.Sheets[n] - let parsedContent = XLSX.utils.sheet_to_json(ws, xlsxOptions) + const ws = wb.Sheets[n] + const parsedContent = XLSX.utils.sheet_to_json(ws, xlsxOptions) if (_.isArray(parsedContent)) { const csvArray = parsedContent.map((obj, i) => { diff --git a/packages/gatsby-transformer-javascript-frontmatter/src/gatsby-node.js b/packages/gatsby-transformer-javascript-frontmatter/src/gatsby-node.js index e15a64a2f1f46..dccdacc888936 100644 --- a/packages/gatsby-transformer-javascript-frontmatter/src/gatsby-node.js +++ b/packages/gatsby-transformer-javascript-frontmatter/src/gatsby-node.js @@ -45,7 +45,9 @@ async function onCreateNode({ ], } - let exportsData, frontmatter, error + let exportsData + let frontmatter + let error try { const ast = babylon.parse(code, options) diff --git a/packages/gatsby-transformer-javascript-static-exports/src/gatsby-node.js b/packages/gatsby-transformer-javascript-static-exports/src/gatsby-node.js index efdbdddaf2129..b6476c3cd0b43 100644 --- a/packages/gatsby-transformer-javascript-static-exports/src/gatsby-node.js +++ b/packages/gatsby-transformer-javascript-static-exports/src/gatsby-node.js @@ -56,7 +56,8 @@ async function onCreateNode({ ], } - let exportsData, data + let exportsData + let data try { const ast = babylon.parse(code, options) diff --git a/packages/gatsby-transformer-pdf/src/gatsby-node.js b/packages/gatsby-transformer-pdf/src/gatsby-node.js index 17857a30a4fb1..b4cd70010c69c 100644 --- a/packages/gatsby-transformer-pdf/src/gatsby-node.js +++ b/packages/gatsby-transformer-pdf/src/gatsby-node.js @@ -1,3 +1,4 @@ +/* eslint-disable @babel/no-invalid-this */ const Promise = require(`bluebird`) const PDFParser = require(`pdf2json`) @@ -32,7 +33,7 @@ async function onCreateNode({ const { createNode, createParentChildLink } = actions - let parsedContent = await convertToJson(node.absolutePath) + const parsedContent = await convertToJson(node.absolutePath) const pdfNode = { id: createNodeId(`${node.id} >>> ${node.extension}`), diff --git a/packages/gatsby-transformer-react-docgen/src/__tests__/on-node-create.js b/packages/gatsby-transformer-react-docgen/src/__tests__/on-node-create.js index 09b3db08aefe0..41c2e21b6eb01 100644 --- a/packages/gatsby-transformer-react-docgen/src/__tests__/on-node-create.js +++ b/packages/gatsby-transformer-react-docgen/src/__tests__/on-node-create.js @@ -13,7 +13,11 @@ const readFile = file => }) describe(`transformer-react-doc-gen: onCreateNode`, () => { - let loadNodeContent, actions, node, createdNodes, updatedNodes + let loadNodeContent + let actions + let node + let createdNodes + let updatedNodes const createNodeId = jest.fn() let i @@ -22,7 +26,7 @@ describe(`transformer-react-doc-gen: onCreateNode`, () => { createNodeId.mockImplementation(() => i++) }) - let run = (node, opts = {}) => { + const run = (node, opts = {}) => { const createContentDigest = jest.fn().mockReturnValue(`contentDigest`) return onCreateNode( { @@ -95,14 +99,14 @@ describe(`transformer-react-doc-gen: onCreateNode`, () => { it(`should extract all components in a file`, async () => { await run(node) - let types = groupBy(createdNodes, n => n.internal.type) + const types = groupBy(createdNodes, n => n.internal.type) expect(types.ComponentMetadata).toHaveLength(6) }) it(`should give all components a name`, async () => { await run(node) - let types = groupBy(createdNodes, `internal.type`) + const types = groupBy(createdNodes, `internal.type`) expect(types.ComponentMetadata.map(c => c.displayName)).toEqual([ `Baz`, @@ -117,7 +121,7 @@ describe(`transformer-react-doc-gen: onCreateNode`, () => { it(`should handle duplicate doclet values`, async () => { await run(node) - let Bar = groupBy(createdNodes, `internal.type`).ComponentMetadata.find( + const Bar = groupBy(createdNodes, `internal.type`).ComponentMetadata.find( d => d.displayName === `Bar` ) @@ -147,14 +151,14 @@ describe(`transformer-react-doc-gen: onCreateNode`, () => { it(`should extract all propTypes`, async () => { await run(node) - let types = groupBy(createdNodes, `internal.type`) + const types = groupBy(createdNodes, `internal.type`) expect(types.ComponentProp).toHaveLength(14) }) it(`should delicately remove doclets`, async () => { await run(node) - let types = groupBy(createdNodes, `internal.type`) + const types = groupBy(createdNodes, `internal.type`) const id = types.ComponentProp[0].id @@ -170,7 +174,7 @@ describe(`transformer-react-doc-gen: onCreateNode`, () => { it(`should extract create description nodes with markdown types`, async () => { await run(node) - let types = groupBy(createdNodes, `internal.type`) + const types = groupBy(createdNodes, `internal.type`) expect( types.ComponentDescription.every( d => d.internal.mediaType === `text/markdown` @@ -179,7 +183,7 @@ describe(`transformer-react-doc-gen: onCreateNode`, () => { }) it(`should allow specifying handlers`, async () => { - let handler = jest.fn() + const handler = jest.fn() await run(node, { handlers: [handler], }) diff --git a/packages/gatsby-transformer-react-docgen/src/displayname-handler.js b/packages/gatsby-transformer-react-docgen/src/displayname-handler.js index 448f98607ff27..25b2ed3ff043f 100644 --- a/packages/gatsby-transformer-react-docgen/src/displayname-handler.js +++ b/packages/gatsby-transformer-react-docgen/src/displayname-handler.js @@ -13,7 +13,7 @@ const { const DEFAULT_NAME = `UnknownComponent` function getNameFromPath(path: NodePath): ?string { - var node = path.node + const node = path.node switch (node.type) { case types.Identifier.name: case types.Literal.name: diff --git a/packages/gatsby-transformer-react-docgen/src/doclets.js b/packages/gatsby-transformer-react-docgen/src/doclets.js index 8a302650f8938..f018b389a6e5e 100644 --- a/packages/gatsby-transformer-react-docgen/src/doclets.js +++ b/packages/gatsby-transformer-react-docgen/src/doclets.js @@ -1,19 +1,19 @@ const DOCLET_PATTERN = /^@(\w+)(?:$|\s((?:[^](?!^@\w))*))/gim -let cleanDocletValue = str => { +const cleanDocletValue = str => { str = str.trim() if (str.endsWith(`}`) && str.startsWith(`{`)) str = str.slice(1, -1) return str } -let isLiteral = str => /^('|"|true|false|\d+)/.test(str.trim()) +const isLiteral = str => /^('|"|true|false|\d+)/.test(str.trim()) /** * Remove doclets from string */ export const cleanDoclets = desc => { desc = desc || `` - let idx = desc.search(DOCLET_PATTERN) + const idx = desc.search(DOCLET_PATTERN) return (idx === -1 ? desc : desc.substr(0, idx)).trim() } @@ -25,7 +25,7 @@ export const cleanDoclets = desc => { * Updated to strip \r from the end of doclets */ const getDoclets = str => { - let doclets = [] + const doclets = [] let match = DOCLET_PATTERN.exec(str) let val @@ -43,7 +43,7 @@ const getDoclets = str => { * @param {ComponentMetadata|PropMetadata} obj */ export const parseDoclets = obj => { - let desc = obj.description || `` + const desc = obj.description || `` return getDoclets(desc) || Object.create(null) } diff --git a/packages/gatsby-transformer-react-docgen/src/on-node-create.js b/packages/gatsby-transformer-react-docgen/src/on-node-create.js index 8ecd14e102a32..edd6b8c54461f 100644 --- a/packages/gatsby-transformer-react-docgen/src/on-node-create.js +++ b/packages/gatsby-transformer-react-docgen/src/on-node-create.js @@ -55,11 +55,11 @@ function createPropNodes( createContentDigest ) { const { createNode } = actions - let children = new Array(component.props.length) + const children = new Array(component.props.length) component.props.forEach((prop, i) => { - let propNodeId = propsId(node.id, prop.name) - let content = JSON.stringify(prop) + const propNodeId = propsId(node.id, prop.name) + const content = JSON.stringify(prop) let propNode = { ...prop, diff --git a/packages/gatsby-transformer-remark/src/extend-node-type.js b/packages/gatsby-transformer-remark/src/extend-node-type.js index 3d60a8e61d319..457384ae96523 100644 --- a/packages/gatsby-transformer-remark/src/extend-node-type.js +++ b/packages/gatsby-transformer-remark/src/extend-node-type.js @@ -118,7 +118,7 @@ module.exports = function remarkExtendNodeType( for (const plugin of pluginOptions.plugins) { const requiredPlugin = require(plugin.resolve) if (_.isFunction(requiredPlugin.setParserPlugins)) { - for (let parserPlugin of requiredPlugin.setParserPlugins( + for (const parserPlugin of requiredPlugin.setParserPlugins( plugin.pluginOptions )) { if (_.isArray(parserPlugin)) { @@ -302,7 +302,7 @@ module.exports = function remarkExtendNodeType( async function getTableOfContents(markdownNode, gqlTocOptions) { // fetch defaults - let appliedTocOptions = { ...tocOptions, ...gqlTocOptions } + const appliedTocOptions = { ...tocOptions, ...gqlTocOptions } const tocKey = tableOfContentsCacheKey(markdownNode, appliedTocOptions) @@ -651,7 +651,7 @@ module.exports = function remarkExtendNodeType( wordCount: { type: `MarkdownWordCount`, resolve(markdownNode) { - let counts = {} + const counts = {} unified() .use(parse) diff --git a/packages/gatsby-transformer-remark/src/utils/time-to-read.js b/packages/gatsby-transformer-remark/src/utils/time-to-read.js index d03f15cf8cffe..f57883d8105df 100644 --- a/packages/gatsby-transformer-remark/src/utils/time-to-read.js +++ b/packages/gatsby-transformer-remark/src/utils/time-to-read.js @@ -44,8 +44,8 @@ export const timeToRead = html => { const pureText = sanitizeHTML(html, { allowTags: [] }) const avgWPM = 265 - let latinChars = [] - let cjChars = [] + const latinChars = [] + const cjChars = [] for (const char of pureText) { if (isCjChar(char)) { diff --git a/packages/gatsby-transformer-screenshot/lambda/screenshot.js b/packages/gatsby-transformer-screenshot/lambda/screenshot.js index d3af5e90d866c..3dafb1ed4fcf9 100644 --- a/packages/gatsby-transformer-screenshot/lambda/screenshot.js +++ b/packages/gatsby-transformer-screenshot/lambda/screenshot.js @@ -43,13 +43,9 @@ class FSScreenshot extends Screenshot { } async putFile(fileBuffer) { - try { - await fsPromises.writeFile(this.fileUrl, fileBuffer) - this.expires = undefined - return { url: this.fileUrl, expires: this.expires } - } catch (error) { - throw error - } + await fsPromises.writeFile(this.fileUrl, fileBuffer) + this.expires = undefined + return { url: this.fileUrl, expires: this.expires } } } diff --git a/packages/gatsby-transformer-screenshot/src/gatsby-node.js b/packages/gatsby-transformer-screenshot/src/gatsby-node.js index bbd44efae1329..a9b7a3141147d 100644 --- a/packages/gatsby-transformer-screenshot/src/gatsby-node.js +++ b/packages/gatsby-transformer-screenshot/src/gatsby-node.js @@ -142,7 +142,8 @@ const createScreenshotNode = async ({ reporter, }) => { try { - let fileNode, expires + let fileNode + let expires if (USE_PLACEHOLDER_IMAGE) { const getPlaceholderFileNode = require(`./placeholder-file-node`) fileNode = await getPlaceholderFileNode({ diff --git a/packages/gatsby-transformer-sharp/src/safe-sharp.js b/packages/gatsby-transformer-sharp/src/safe-sharp.js index 6d97dfddd16a0..e92a40063c28c 100644 --- a/packages/gatsby-transformer-sharp/src/safe-sharp.js +++ b/packages/gatsby-transformer-sharp/src/safe-sharp.js @@ -44,7 +44,7 @@ const getDetailedMessage = () => { return dependency.dependencies.sharp.version } - for (let depName of Object.keys(dependency.dependencies)) { + for (const depName of Object.keys(dependency.dependencies)) { const v = findSharpVersion(dependency.dependencies[depName]) if (v) { return v @@ -78,7 +78,7 @@ const getDetailedMessage = () => { } ) - let packagesToUpdate = [] + const packagesToUpdate = [] // list top level dependencies msg = msg.concat([ `List of installed packages that depend on sharp:`, diff --git a/packages/gatsby/cache-dir/navigation.js b/packages/gatsby/cache-dir/navigation.js index 62e1832f2477a..8d7d5354a9743 100644 --- a/packages/gatsby/cache-dir/navigation.js +++ b/packages/gatsby/cache-dir/navigation.js @@ -149,6 +149,8 @@ function shouldUpdateScroll(prevRouterProps, { location }) { routerProps: { location }, getSavedScrollPosition: args => [ 0, + // FIXME this is actually a big code smell, we should fix this + // eslint-disable-next-line @babel/no-invalid-this this._stateStorage.read(args, args.key), ], }) diff --git a/packages/gatsby/cache-dir/ssr-develop-static-entry.js b/packages/gatsby/cache-dir/ssr-develop-static-entry.js index f640fceb72ff1..0966510b944f2 100644 --- a/packages/gatsby/cache-dir/ssr-develop-static-entry.js +++ b/packages/gatsby/cache-dir/ssr-develop-static-entry.js @@ -141,12 +141,14 @@ export default (pagePath, isClientOnlyPage, callback) => { const childAssets = namedChunkGroups[chunkKey].childAssets for (const rel in childAssets) { - chunks = concat( - chunks, - childAssets[rel].map(chunk => { - return { rel, name: chunk } - }) - ) + if (childAssets.hasownProperty(rel)) { + chunks = concat( + chunks, + childAssets[rel].map(chunk => { + return { rel, name: chunk } + }) + ) + } } return chunks diff --git a/packages/gatsby/src/bootstrap/__tests__/requires-writer.js b/packages/gatsby/src/bootstrap/__tests__/requires-writer.js index ececeb9e39dc9..35d95e7c72397 100644 --- a/packages/gatsby/src/bootstrap/__tests__/requires-writer.js +++ b/packages/gatsby/src/bootstrap/__tests__/requires-writer.js @@ -5,7 +5,7 @@ const { match } = require(`@gatsbyjs/reach-router/lib/utils`) const now = Date.now() const generatePagesState = pages => { - let state = new Map() + const state = new Map() pages.forEach(page => { state.set(page.path, { component: ``, diff --git a/packages/gatsby/src/cache/__tests__/cache-fs.js b/packages/gatsby/src/cache/__tests__/cache-fs.js index 95fe91f30b0b4..803ccbc7f819c 100644 --- a/packages/gatsby/src/cache/__tests__/cache-fs.js +++ b/packages/gatsby/src/cache/__tests__/cache-fs.js @@ -70,10 +70,12 @@ describe(`DiskStore`, function () { // this.slow(30) await Promise.all( - Array.apply(null, Array(30)).map(async function (v, i) { - const data = await cache.get(`not existing key` + i) - expect(data).toEqual(undefined) - }) + Array(30) + .fill() + .map(async function (v, i) { + const data = await cache.get(`not existing key` + i) + expect(data).toEqual(undefined) + }) ) }) }) @@ -248,11 +250,11 @@ describe(`DiskStore`, function () { cache2.get(`key`), cache3.get(`key`), ]) - //all caches should be the same + // all caches should be the same expect(values[0]).toEqual(values[1]) expect(values[0]).toEqual(values[2]) - //the cache should be one of the values that was stored to it + // the cache should be one of the values that was stored to it try { expect(values[0]).toEqual(values[1]) } catch (e) { diff --git a/packages/gatsby/src/cache/cache-fs.ts b/packages/gatsby/src/cache/cache-fs.ts index 8f8b936514e0c..b45b93edfc951 100644 --- a/packages/gatsby/src/cache/cache-fs.ts +++ b/packages/gatsby/src/cache/cache-fs.ts @@ -1,5 +1,6 @@ // Initial file from https://github.com/rolandstarke/node-cache-manager-fs-hash @ af52d2d -/*! +/* eslint-disable @babel/no-invalid-this, no-useless-catch */ +/* ! The MIT License (MIT) Copyright (c) 2017 Roland Starke @@ -22,7 +23,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - const fs = require(`fs`) const crypto = require(`crypto`) const path = require(`path`) @@ -67,7 +67,7 @@ function DiskStore(options): void { subdirs: options.subdirs || false, zip: options.zip || false, lockFile: { - //check lock at 0ms 50ms 100ms ... 400ms 1400ms 1450ms... up to 10 seconds, after that just assume the lock is staled + // check lock at 0ms 50ms 100ms ... 400ms 1400ms 1450ms... up to 10 seconds, after that just assume the lock is staled wait: 400, pollPeriod: 50, stale: 10 * 1000, @@ -103,7 +103,7 @@ DiskStore.prototype.set = wrapCallback(async function (key, val, options) { } if (this.options.subdirs) { - //check if subdir exists or create it + // check if subdir exists or create it const dir = path.dirname(filePath) await promisify(fs.access)(dir, fs.constants.W_OK).catch(function () { return promisify(fs.mkdir)(dir).catch(err => { @@ -139,7 +139,7 @@ DiskStore.prototype.get = wrapCallback(async function (key) { if (err.code === `ENOENT`) { throw err } - //maybe the file is currently written to, lets lock it and read again + // maybe the file is currently written to, lets lock it and read again try { await this._lock(filePath) return await jsonFileStore.read(filePath, this.options) @@ -150,17 +150,17 @@ DiskStore.prototype.get = wrapCallback(async function (key) { } }) if (data.expireTime <= Date.now()) { - //cache expired + // cache expired this.del(key).catch(() => 0 /* ignore */) return undefined } if (data.key !== key) { - //hash collision + // hash collision return undefined } return data.val } catch (err) { - //file does not exist lets return a cache miss + // file does not exist lets return a cache miss if (err.code === `ENOENT`) { return undefined } else { @@ -176,7 +176,7 @@ DiskStore.prototype.del = wrapCallback(async function (key) { const filePath = this._getFilePathByKey(key) try { if (this.options.subdirs) { - //check if the folder exists to fail faster + // check if the folder exists to fail faster const dir = path.dirname(filePath) await promisify(fs.access)(dir, fs.constants.W_OK) } @@ -184,7 +184,7 @@ DiskStore.prototype.del = wrapCallback(async function (key) { await this._lock(filePath) await jsonFileStore.delete(filePath, this.options) } catch (err) { - //ignore deleting non existing keys + // ignore deleting non existing keys if (err.code !== `ENOENT`) { throw err } @@ -217,7 +217,7 @@ DiskStore.prototype.reset = wrapCallback(async function (): Promise { stats.isFile() && /[/\\]diskstore-[0-9a-fA-F/\\]+(\.json|-\d\.bin)/.test(fileOrDir) ) { - //delete the file if it is a diskstore file + // delete the file if it is a diskstore file await unlink(fileOrDir) } } @@ -284,7 +284,7 @@ DiskStore.prototype._getFilePathByKey = function (key): string { .update(key + ``) .digest(`hex`) if (this.options.subdirs) { - //create subdirs with the first 3 chars of the hash + // create subdirs with the first 3 chars of the hash return path.join( this.options.path, `diskstore-` + hash.substr(0, 3), diff --git a/packages/gatsby/src/cache/json-file-store.ts b/packages/gatsby/src/cache/json-file-store.ts index d86b195c8814d..dbbf026f12b10 100644 --- a/packages/gatsby/src/cache/json-file-store.ts +++ b/packages/gatsby/src/cache/json-file-store.ts @@ -1,5 +1,5 @@ // Initial file from https://github.com/rolandstarke/node-cache-manager-fs-hash @ af52d2d -/*! +/* ! The MIT License (MIT) Copyright (c) 2017 Roland Starke @@ -30,7 +30,7 @@ const zlib = require(`zlib`) exports.write = async function (path, data, options): Promise { const externalBuffers = [] let dataString = JSON.stringify(data, function replacerFunction(k, value) { - //Buffers searilize to {data: [...], type: "Buffer"} + // Buffers searilize to {data: [...], type: "Buffer"} if ( value && value.type === `Buffer` && @@ -60,14 +60,14 @@ exports.write = async function (path, data, options): Promise { zipExtension = `.gz` dataString = await promisify(zlib.deflate)(dataString) } - //save main json file + // save main json file await promisify(fs.writeFile)( path + `.json` + zipExtension, dataString, `utf8` ) - //save external buffers + // save external buffers await Promise.all( externalBuffers.map(async function (externalBuffer) { let buffer = externalBuffer.buffer @@ -89,7 +89,7 @@ exports.read = async function (path, options): Promise { zipExtension = `.gz` } - //read main json file + // read main json file let dataString if (options.zip) { const compressedData = await promisify(fs.readFile)( @@ -115,7 +115,7 @@ exports.read = async function (path, options): Promise { typeof value.index === `number` && typeof value.size === `number` ) { - //JSON.parse is sync so we need to return a buffer sync, we will fill the buffer later + // JSON.parse is sync so we need to return a buffer sync, we will fill the buffer later const buffer = Buffer.alloc(value.size) externalBuffers.push({ index: +value.index, @@ -139,7 +139,7 @@ exports.read = async function (path, options): Promise { ) } - //read external buffers + // read external buffers await Promise.all( externalBuffers.map(async function (externalBuffer) { if (options.zip) { @@ -175,7 +175,7 @@ exports.delete = async function (path, options): Promise { await promisify(fs.unlink)(path + `.json` + zipExtension) - //delete binary files + // delete binary files try { for (let i = 0; i < Infinity; i++) { await promisify(fs.unlink)(path + `-` + i + `.bin` + zipExtension) diff --git a/packages/gatsby/src/cache/wrap-callback.ts b/packages/gatsby/src/cache/wrap-callback.ts index 09cb2224831c0..d3c892420728b 100644 --- a/packages/gatsby/src/cache/wrap-callback.ts +++ b/packages/gatsby/src/cache/wrap-callback.ts @@ -1,5 +1,5 @@ // Initial file from https://github.com/rolandstarke/node-cache-manager-fs-hash @ af52d2d -/*! +/* ! The MIT License (MIT) Copyright (c) 2017 Roland Starke @@ -37,6 +37,7 @@ module.exports = function wrapCallback( cb = args.pop() } + // eslint-disable-next-line @babel/no-invalid-this const promise = fn.apply(this, args) if (typeof cb === `function`) { diff --git a/packages/gatsby/src/commands/develop.ts b/packages/gatsby/src/commands/develop.ts index dee3dc8be92bf..3cfdb7b630dbf 100644 --- a/packages/gatsby/src/commands/develop.ts +++ b/packages/gatsby/src/commands/develop.ts @@ -71,12 +71,12 @@ const doesConfigChangeRequireRestart = ( const getDebugPort = (port?: number): number => port ?? 9229 export const getDebugInfo = (program: IProgram): IDebugInfo | null => { - if (program.hasOwnProperty(`inspect`)) { + if (Object.prototype.hasOwnProperty.call(program, `inspect`)) { return { port: getDebugPort(program.inspect), break: false, } - } else if (program.hasOwnProperty(`inspectBrk`)) { + } else if (Object.prototype.hasOwnProperty.call(program, `inspectBrk`)) { return { port: getDebugPort(program.inspectBrk), break: true, diff --git a/packages/gatsby/src/commands/serve.ts b/packages/gatsby/src/commands/serve.ts index f5a6aea654687..e10f99eceec06 100644 --- a/packages/gatsby/src/commands/serve.ts +++ b/packages/gatsby/src/commands/serve.ts @@ -101,6 +101,7 @@ module.exports = async (program: IServeProgram): Promise => { const root = path.join(program.directory, `public`) const app = express() + // eslint-disable-next-line new-cap const router = express.Router() app.use(telemetry.expressMiddleware(`SERVE`)) diff --git a/packages/gatsby/src/query/__tests__/__snapshots__/query-compiler.js.snap b/packages/gatsby/src/query/__tests__/__snapshots__/query-compiler.js.snap index 5ebc996d9d692..741d96c62a82a 100644 --- a/packages/gatsby/src/query/__tests__/__snapshots__/query-compiler.js.snap +++ b/packages/gatsby/src/query/__tests__/__snapshots__/query-compiler.js.snap @@ -165,7 +165,7 @@ Array [ 3 | #... 4 | } 5 | } - 6 | + 6 | 7 | query AnotherQuery { 8 | allPostsJson { 9 | #... diff --git a/packages/gatsby/src/query/__tests__/query-compiler.js b/packages/gatsby/src/query/__tests__/query-compiler.js index 6209cd6dcc2ad..815ba880543d5 100644 --- a/packages/gatsby/src/query/__tests__/query-compiler.js +++ b/packages/gatsby/src/query/__tests__/query-compiler.js @@ -614,8 +614,7 @@ describe(`actual compiling`, () => { }, }) - expect(errors).toMatchInlineSnapshot( - ` + expect(errors).toMatchInlineSnapshot(` Array [ Object { "context": Object { @@ -628,9 +627,7 @@ describe(`actual compiling`, () => { 5 | } 6 | } 7 | } - 8 |` + - ` ` + - ` + 8 | 9 | fragment PostsJsonFragment on PostsJson { 10 | id 11 | }", @@ -640,8 +637,7 @@ describe(`actual compiling`, () => { "id": "85908", }, ] - ` - ) + `) expect(result).toEqual(new Map()) }) @@ -727,7 +723,7 @@ describe(`actual compiling`, () => { 5 | } 6 | } 7 | } - 8 | + 8 | 9 | fragment PostsJsonFragment on PostsJson { 10 | id 11 | node @@ -755,7 +751,7 @@ describe(`actual compiling`, () => { 5 | } 6 | } 7 | } - 8 | + 8 | > 9 | fragment PostsJsonFragment on PostsJson { | ^^^^^^^^^^^^^^^^^ 10 | id diff --git a/packages/gatsby/src/query/query-compiler.js b/packages/gatsby/src/query/query-compiler.js index 95f5598606f5d..2221e23437219 100644 --- a/packages/gatsby/src/query/query-compiler.js +++ b/packages/gatsby/src/query/query-compiler.js @@ -351,7 +351,7 @@ const processDefinitions = ({ continue } - let document = { + const document = { kind: Kind.DOCUMENT, definitions: Array.from(usedFragments.values()) .map(name => definitionsByName.get(name).def) diff --git a/packages/gatsby/src/query/query-watcher.ts b/packages/gatsby/src/query/query-watcher.ts index 975448d8fb3ea..e22f383207a39 100644 --- a/packages/gatsby/src/query/query-watcher.ts +++ b/packages/gatsby/src/query/query-watcher.ts @@ -1,4 +1,4 @@ -/** * +/*** * Jobs of this module * - Maintain the list of components in the Redux store. So monitor new components * and add/remove components. diff --git a/packages/gatsby/src/redux/actions/public.js b/packages/gatsby/src/redux/actions/public.js index 113ffd05879a4..4308474ade49c 100644 --- a/packages/gatsby/src/redux/actions/public.js +++ b/packages/gatsby/src/redux/actions/public.js @@ -71,7 +71,7 @@ const findChildren = initialChildren => { const displayedWarnings = new Set() const warnOnce = (message, key) => { - let messageId = key ?? message + const messageId = key ?? message if (!displayedWarnings.has(messageId)) { displayedWarnings.add(messageId) report.warn(message) diff --git a/packages/gatsby/src/schema/__tests__/build-node-connections.js b/packages/gatsby/src/schema/__tests__/build-node-connections.js index 152d09cc1e1a4..5948a0d6bb4d7 100644 --- a/packages/gatsby/src/schema/__tests__/build-node-connections.js +++ b/packages/gatsby/src/schema/__tests__/build-node-connections.js @@ -77,8 +77,8 @@ describe(`build-node-connections`, () => { }) store.dispatch({ type: `SET_SCHEMA`, payload: schema }) - let context = { path: `foo` } - let { data, errors } = await graphql(schema, query, undefined, { + const context = { path: `foo` } + const { data, errors } = await graphql(schema, query, undefined, { ...context, nodeModel: new LocalNodeModel({ schemaComposer, @@ -95,7 +95,7 @@ describe(`build-node-connections`, () => { }) it(`should result in a valid queryable schema`, async () => { - let { allParent, allChild, allRelative } = await runQuery( + const { allParent, allChild, allRelative } = await runQuery( ` { allParent(filter: { id: { eq: "p1" } }) { @@ -128,7 +128,7 @@ describe(`build-node-connections`, () => { }) it(`should link children automatically`, async () => { - let { allParent } = await runQuery( + const { allParent } = await runQuery( ` { allParent(filter: { id: { eq: "p1" } }) { @@ -152,7 +152,7 @@ describe(`build-node-connections`, () => { }) it(`should create typed children fields`, async () => { - let { allParent } = await runQuery( + const { allParent } = await runQuery( ` { allParent(filter: { id: { eq: "p1" } }) { @@ -175,7 +175,7 @@ describe(`build-node-connections`, () => { }) it(`should create typed child field for singular children`, async () => { - let { allParent } = await runQuery( + const { allParent } = await runQuery( ` { allParent(filter: { id: { eq: "p1" } }) { diff --git a/packages/gatsby/src/schema/__tests__/build-node-types.js b/packages/gatsby/src/schema/__tests__/build-node-types.js index d62c96b846a12..dc2d4b10b8790 100644 --- a/packages/gatsby/src/schema/__tests__/build-node-types.js +++ b/packages/gatsby/src/schema/__tests__/build-node-types.js @@ -88,8 +88,8 @@ describe(`build-node-types`, () => { }) store.dispatch({ type: `SET_SCHEMA`, payload: schema }) - let context = { path: `foo` } - let { data, errors } = await graphql(schema, query, undefined, { + const context = { path: `foo` } + const { data, errors } = await graphql(schema, query, undefined, { ...context, nodeModel: new LocalNodeModel({ schemaComposer, @@ -117,7 +117,7 @@ describe(`build-node-types`, () => { }) it(`should result in a valid queryable schema`, async () => { - let { parent, child, relative } = await runQuery( + const { parent, child, relative } = await runQuery( ` { parent(id: { eq: "p1" }) { @@ -138,7 +138,7 @@ describe(`build-node-types`, () => { }) it(`should link children automatically`, async () => { - let { parent } = await runQuery( + const { parent } = await runQuery( ` { parent(id: { eq: "p1" }) { @@ -176,7 +176,7 @@ describe(`build-node-types`, () => { }) it(`should create typed child field for singular children`, async () => { - let { parent } = await runQuery( + const { parent } = await runQuery( ` { parent(id: { eq: "p1" }) { diff --git a/packages/gatsby/src/schema/__tests__/connection-filter-on-linked-nodes.js b/packages/gatsby/src/schema/__tests__/connection-filter-on-linked-nodes.js index ad0dbb893d1cb..f36749329e7cc 100644 --- a/packages/gatsby/src/schema/__tests__/connection-filter-on-linked-nodes.js +++ b/packages/gatsby/src/schema/__tests__/connection-filter-on-linked-nodes.js @@ -62,7 +62,7 @@ async function queryResult(nodes, query) { describe(`filtering on linked nodes`, () => { it(`filters on linked nodes via id`, async () => { - let result = await queryResult( + const result = await queryResult( makeNodes().concat([ { id: `child_2_link`, @@ -94,7 +94,7 @@ describe(`filtering on linked nodes`, () => { }) it(`returns nested linked fields`, async () => { - let result = await queryResult( + const result = await queryResult( [ { id: `child_2`, @@ -129,7 +129,7 @@ describe(`filtering on linked nodes`, () => { }) it(`returns all matching linked nodes`, async () => { - let result = await queryResult( + const result = await queryResult( makeNodes().concat([ { id: `child_2_link`, @@ -161,7 +161,7 @@ describe(`filtering on linked nodes`, () => { }) it(`handles elemMatch operator`, async () => { - let result = await queryResult( + const result = await queryResult( makeNodes().concat([ { id: `1`, diff --git a/packages/gatsby/src/schema/__tests__/connection-input-fields.js b/packages/gatsby/src/schema/__tests__/connection-input-fields.js index 8e195f6cfeb59..85ff017bf9390 100644 --- a/packages/gatsby/src/schema/__tests__/connection-input-fields.js +++ b/packages/gatsby/src/schema/__tests__/connection-input-fields.js @@ -146,7 +146,7 @@ async function queryResult(nodes, query) { }) store.dispatch({ type: `SET_SCHEMA`, payload: schema }) - let context = { path: `foo` } + const context = { path: `foo` } return graphql(schema, query, undefined, { ...context, nodeModel: new LocalNodeModel({ @@ -159,7 +159,7 @@ async function queryResult(nodes, query) { describe(`connection input fields`, () => { it(`returns list of distinct values in a field`, async () => { - let result = await queryResult( + const result = await queryResult( makeNodes(), ` { @@ -196,7 +196,7 @@ describe(`connection input fields`, () => { }) it(`handles the group connection field`, async () => { - let result = await queryResult( + const result = await queryResult( makeNodes(), ` { allTest { @@ -227,7 +227,7 @@ describe(`connection input fields`, () => { }) it(`handles the nested group connection field`, async () => { - let result = await queryResult( + const result = await queryResult( makeNodes(), ` { allTest { @@ -255,7 +255,7 @@ describe(`connection input fields`, () => { }) it(`can query object arrays`, async () => { - let result = await queryResult( + const result = await queryResult( makeNodes(), ` { diff --git a/packages/gatsby/src/schema/__tests__/run-query.js b/packages/gatsby/src/schema/__tests__/run-query.js index 49b79f3d3e676..2953c2deebc39 100644 --- a/packages/gatsby/src/schema/__tests__/run-query.js +++ b/packages/gatsby/src/schema/__tests__/run-query.js @@ -1804,7 +1804,7 @@ describe(`Filter fields`, () => { describe(`collection fields`, () => { it(`orders by given field desc with limit`, async () => { - let result = await runQuery({ + const result = await runQuery({ limit: 10, sort: { fields: [`frontmatter.blue`], @@ -1833,7 +1833,7 @@ describe(`collection fields`, () => { // - not_num_null it(`sorts num_null_not asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`num_null_not`], order: [`asc`], @@ -1847,7 +1847,7 @@ describe(`collection fields`, () => { }) it(`sorts num_null_not desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`num_null_not`], order: [`desc`], @@ -1861,7 +1861,7 @@ describe(`collection fields`, () => { }) it(`sorts num_not_null asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`num_not_null`], order: [`asc`], @@ -1875,7 +1875,7 @@ describe(`collection fields`, () => { }) it(`sorts num_not_null desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`num_not_null`], order: [`desc`], @@ -1889,7 +1889,7 @@ describe(`collection fields`, () => { }) it(`sorts null_num_not asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`null_num_not`], order: [`asc`], @@ -1903,7 +1903,7 @@ describe(`collection fields`, () => { }) it(`sorts null_num_not desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`null_num_not`], order: [`desc`], @@ -1917,7 +1917,7 @@ describe(`collection fields`, () => { }) it(`sorts null_not_num asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`null_not_num`], order: [`asc`], @@ -1931,7 +1931,7 @@ describe(`collection fields`, () => { }) it(`sorts null_not_num desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`null_not_num`], order: [`desc`], @@ -1945,7 +1945,7 @@ describe(`collection fields`, () => { }) it(`sorts not_null_num asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`not_null_num`], order: [`asc`], @@ -1959,7 +1959,7 @@ describe(`collection fields`, () => { }) it(`sorts not_null_num desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`not_null_num`], order: [`desc`], @@ -1973,7 +1973,7 @@ describe(`collection fields`, () => { }) it(`sorts not_num_null asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`not_num_null`], order: [`asc`], @@ -1987,7 +1987,7 @@ describe(`collection fields`, () => { }) it(`sorts not_num_null desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`not_num_null`], order: [`desc`], @@ -2016,7 +2016,7 @@ describe(`collection fields`, () => { // - not_str_null it(`sorts str_null_not asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`str_null_not`], order: [`asc`], @@ -2030,7 +2030,7 @@ describe(`collection fields`, () => { }) it(`sorts str_null_not desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`str_null_not`], order: [`desc`], @@ -2044,7 +2044,7 @@ describe(`collection fields`, () => { }) it(`sorts str_not_null asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`str_not_null`], order: [`asc`], @@ -2058,7 +2058,7 @@ describe(`collection fields`, () => { }) it(`sorts str_not_null desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`str_not_null`], order: [`desc`], @@ -2072,7 +2072,7 @@ describe(`collection fields`, () => { }) it(`sorts null_str_not asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`null_str_not`], order: [`asc`], @@ -2086,7 +2086,7 @@ describe(`collection fields`, () => { }) it(`sorts null_str_not desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`null_str_not`], order: [`desc`], @@ -2100,7 +2100,7 @@ describe(`collection fields`, () => { }) it(`sorts null_not_str asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`null_not_str`], order: [`asc`], @@ -2114,7 +2114,7 @@ describe(`collection fields`, () => { }) it(`sorts null_not_str desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`null_not_str`], order: [`desc`], @@ -2128,7 +2128,7 @@ describe(`collection fields`, () => { }) it(`sorts not_null_str asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`not_null_str`], order: [`asc`], @@ -2142,7 +2142,7 @@ describe(`collection fields`, () => { }) it(`sorts not_null_str desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`not_null_str`], order: [`desc`], @@ -2156,7 +2156,7 @@ describe(`collection fields`, () => { }) it(`sorts not_str_null asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`not_str_null`], order: [`asc`], @@ -2170,7 +2170,7 @@ describe(`collection fields`, () => { }) it(`sorts not_str_null desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`not_str_null`], order: [`desc`], @@ -2199,7 +2199,7 @@ describe(`collection fields`, () => { // - not_obj_null it(`sorts obj_null_not asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`obj_null_not`], order: [`asc`], @@ -2213,7 +2213,7 @@ describe(`collection fields`, () => { }) it(`sorts obj_null_not desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`obj_null_not`], order: [`desc`], @@ -2227,7 +2227,7 @@ describe(`collection fields`, () => { }) it(`sorts obj_not_null asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`obj_not_null`], order: [`asc`], @@ -2241,7 +2241,7 @@ describe(`collection fields`, () => { }) it(`sorts obj_not_null desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`obj_not_null`], order: [`desc`], @@ -2255,7 +2255,7 @@ describe(`collection fields`, () => { }) it(`sorts null_obj_not asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`null_obj_not`], order: [`asc`], @@ -2269,7 +2269,7 @@ describe(`collection fields`, () => { }) it(`sorts null_obj_not desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`null_obj_not`], order: [`desc`], @@ -2283,7 +2283,7 @@ describe(`collection fields`, () => { }) it(`sorts null_not_obj asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`null_not_obj`], order: [`asc`], @@ -2297,7 +2297,7 @@ describe(`collection fields`, () => { }) it(`sorts null_not_obj desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`null_not_obj`], order: [`desc`], @@ -2311,7 +2311,7 @@ describe(`collection fields`, () => { }) it(`sorts not_null_obj asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`not_null_obj`], order: [`asc`], @@ -2325,7 +2325,7 @@ describe(`collection fields`, () => { }) it(`sorts not_null_obj desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`not_null_obj`], order: [`desc`], @@ -2339,7 +2339,7 @@ describe(`collection fields`, () => { }) it(`sorts not_obj_null asc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`not_obj_null`], order: [`asc`], @@ -2353,7 +2353,7 @@ describe(`collection fields`, () => { }) it(`sorts not_obj_null desc`, async () => { - let result = await runQuery({ + const result = await runQuery({ sort: { fields: [`not_obj_null`], order: [`desc`], @@ -2368,7 +2368,7 @@ describe(`collection fields`, () => { }) it(`sorts results with desc has null fields first vs obj second`, async () => { - let result = await runQuery({ + const result = await runQuery({ limit: 10, sort: { fields: [`waxOnly`], @@ -2385,7 +2385,7 @@ describe(`collection fields`, () => { }) it(`sorts results with asc has null fields last vs obj first`, async () => { - let result = await runQuery({ + const result = await runQuery({ limit: 10, sort: { fields: [`waxOnly`], @@ -2402,7 +2402,7 @@ describe(`collection fields`, () => { }) it(`applies specified sort order, and sorts asc by default`, async () => { - let result = await runQuery({ + const result = await runQuery({ limit: 10, sort: { fields: [`frontmatter.blue`, `id`], @@ -2417,7 +2417,7 @@ describe(`collection fields`, () => { }) it(`applies specified sort order per field`, async () => { - let result = await runQuery({ + const result = await runQuery({ limit: 10, sort: { fields: [`frontmatter.blue`, `id`], diff --git a/packages/gatsby/src/schema/types/__tests__/sort-and-filter.js b/packages/gatsby/src/schema/types/__tests__/sort-and-filter.js index 5cb525a92a915..bf399e1f864bf 100644 --- a/packages/gatsby/src/schema/types/__tests__/sort-and-filter.js +++ b/packages/gatsby/src/schema/types/__tests__/sort-and-filter.js @@ -272,11 +272,11 @@ describe(`GraphQL Input args from fields`, () => { const json = inferredFields.scal_json.type isJsonInput(json) - const custom_scalar = inferredFields.scal_odd.type - isCustomScalarInput(custom_scalar, fields.scal_odd.type) + const customScalar = inferredFields.scal_odd.type + isCustomScalarInput(customScalar, fields.scal_odd.type) - const custom_enum = inferredFields.scal_enum.type - isEnumInput(custom_enum, fields.scal_enum.type) + const customEnum = inferredFields.scal_enum.type + isEnumInput(customEnum, fields.scal_enum.type) }) it(`recursively converts object types`, async () => { diff --git a/packages/gatsby/src/utils/api-node-helpers-docs.js b/packages/gatsby/src/utils/api-node-helpers-docs.js index aea2562fa7f90..a38bd963a1649 100644 --- a/packages/gatsby/src/utils/api-node-helpers-docs.js +++ b/packages/gatsby/src/utils/api-node-helpers-docs.js @@ -1,6 +1,6 @@ /* eslint-disable no-unused-vars */ -/** */ +/***/ const GatsbyReporter = { /** * @callback GatsbyReporterFn @@ -60,7 +60,7 @@ const GatsbyReporter = { verbose: true, }; -/** */ +/***/ const GatsbyCache = { /** * Retrieve cached value @@ -82,7 +82,7 @@ const GatsbyCache = { set: true, }; -/** */ +/***/ const GatsbyTracing = { /** * Global tracer instance. Check diff --git a/packages/gatsby/src/utils/api-runner-node.js b/packages/gatsby/src/utils/api-runner-node.js index c0700022823b6..24f10c800b273 100644 --- a/packages/gatsby/src/utils/api-runner-node.js +++ b/packages/gatsby/src/utils/api-runner-node.js @@ -233,7 +233,8 @@ function extendLocalReporterToCatchPluginErrors({ panic, panicOnBuild, activityTimer: (...args) => { - const activity = reporter.activityTimer.apply(reporter, args) + // eslint-disable-next-line prefer-spread + const activity = reporter.activityTimer(reporter, args) const originalStart = activity.start const originalEnd = activity.end @@ -252,6 +253,7 @@ function extendLocalReporterToCatchPluginErrors({ }, createProgress: (...args) => { + // eslint-disable-next-line prefer-spread const activity = reporter.createProgress.apply(reporter, args) const originalStart = activity.start diff --git a/packages/gatsby/src/utils/dev-ssr/render-dev-html.ts b/packages/gatsby/src/utils/dev-ssr/render-dev-html.ts index 28aef6ee541fa..d1e48abc575b9 100644 --- a/packages/gatsby/src/utils/dev-ssr/render-dev-html.ts +++ b/packages/gatsby/src/utils/dev-ssr/render-dev-html.ts @@ -132,6 +132,7 @@ export const renderDevHTML = ({ htmlComponentRendererPath, directory, }): Promise => + // eslint-disable-next-line no-async-promise-executor new Promise(async (resolve, reject) => { startListener() let pageObj diff --git a/packages/gatsby/src/utils/webpack-utils.ts b/packages/gatsby/src/utils/webpack-utils.ts index 47ecafe3f96f6..c3fa306bd40c2 100644 --- a/packages/gatsby/src/utils/webpack-utils.ts +++ b/packages/gatsby/src/utils/webpack-utils.ts @@ -784,7 +784,7 @@ export const createWebpackUtils = ( ], ...eslintConfig(schema, jsxRuntimeExists), } - //@ts-ignore + // @ts-ignore return new ESLintPlugin(options) } @@ -798,7 +798,7 @@ export const createWebpackUtils = ( ], ...eslintRequiredConfig, } - //@ts-ignore + // @ts-ignore return new ESLintPlugin(options) } diff --git a/scripts/add-npm-owner/index.js b/scripts/add-npm-owner/index.js index 7ecf3d0bcb561..45325dc19f20b 100644 --- a/scripts/add-npm-owner/index.js +++ b/scripts/add-npm-owner/index.js @@ -19,7 +19,7 @@ getUnownedPackages({ user }).then(async ({ packages }) => { }) } - for (let pkg of packages) { + for (const pkg of packages) { const cmd = `npm owner add ${user} ${pkg.name}` try { const { stderr } = await exec(cmd) diff --git a/scripts/check-repo-fields.js b/scripts/check-repo-fields.js index a132835b0d9e3..c53b9d5d67832 100644 --- a/scripts/check-repo-fields.js +++ b/scripts/check-repo-fields.js @@ -1,4 +1,4 @@ -//@ts-check +// @ts-check const path = require(`path`) const fs = require(`fs`) const { getPackages } = require(`@lerna/project`) @@ -19,18 +19,20 @@ function insertKeyAvoidMergeConflict(pkgJson, key, value) { const newPkgJson = {} let inserted = false for (const pkgKey in pkgJson) { - if (!inserted && /depend/i.test(pkgKey)) { - inserted = true - newPkgJson[key] = value + if (pkgJson.hasOwnProperty(pkgKey)) { + if (!inserted && /depend/i.test(pkgKey)) { + inserted = true + newPkgJson[key] = value + } + newPkgJson[pkgKey] = pkgJson[pkgKey] } - newPkgJson[pkgKey] = pkgJson[pkgKey] } return newPkgJson } } async function main() { - let argv = yargs.option(`fix`, { + const argv = yargs.option(`fix`, { default: false, describe: `Fixes outdated dependencies`, }).argv diff --git a/scripts/check-versions.js b/scripts/check-versions.js index 59a1b07f33834..608ea3ee220d9 100644 --- a/scripts/check-versions.js +++ b/scripts/check-versions.js @@ -5,7 +5,7 @@ const PackageGraph = require(`@lerna/package-graph`) const semver = require(`semver`) let warned = false -let argv = yargs +const argv = yargs .option(`fix`, { default: false, describe: `Fixes outdated dependencies`, diff --git a/scripts/clear-package-dir.js b/scripts/clear-package-dir.js index f8fec2e95ef77..99b46885b2f0f 100644 --- a/scripts/clear-package-dir.js +++ b/scripts/clear-package-dir.js @@ -11,7 +11,7 @@ const path = require(`path`) const packlist = require(`npm-packlist`) const { execSync } = require(`child_process`) -let argv = yargs +const argv = yargs .command( `* `, `Clear previously built and potentially stale files in packages`, diff --git a/scripts/gatsby-plugin-checker/index.js b/scripts/gatsby-plugin-checker/index.js index 7d8eea3310762..4193f073b56de 100644 --- a/scripts/gatsby-plugin-checker/index.js +++ b/scripts/gatsby-plugin-checker/index.js @@ -8,13 +8,7 @@ require(`dotenv`).config() const keywords = [`gatsby-plugin`, `gatsby-source`, `gatsby-transformer`] const pluginsFile = path.join(__dirname, `plugins.json`) -const loadPlugins = async () => { - try { - return require(pluginsFile) - } catch (err) { - throw err - } -} +const loadPlugins = async () => require(pluginsFile) const savePlugins = plugins => new Promise((resolve, reject) => { @@ -97,7 +91,7 @@ const hasReadMe = pkg => { } const updatePlugins = (updates, plugins) => { - let res = plugins.map(p => Object.assign({}, p)) + const res = plugins.map(p => Object.assign({}, p)) updates.forEach(u => { const idx = res.findIndex(r => r.name === u.name) if (idx >= 0) { diff --git a/scripts/i18n/run-all.js b/scripts/i18n/run-all.js index 3cac7e235ac4a..192a8bb6e21b8 100644 --- a/scripts/i18n/run-all.js +++ b/scripts/i18n/run-all.js @@ -2,7 +2,7 @@ const fs = require(`fs`) const log4js = require(`log4js`) const shell = require(`shelljs`) -let logger = log4js.getLogger(`run-all`) +const logger = log4js.getLogger(`run-all`) require(`dotenv`).config() diff --git a/scripts/i18n/update-source.js b/scripts/i18n/update-source.js index 43006e0bb2cb8..9f438695b499d 100644 --- a/scripts/i18n/update-source.js +++ b/scripts/i18n/update-source.js @@ -4,7 +4,7 @@ const path = require(`path`) require(`dotenv`).config() -let logger = log4js.getLogger(`update-source`) +const logger = log4js.getLogger(`update-source`) logger.level = `info` const protocol = `https://` diff --git a/yarn.lock b/yarn.lock index 307f76a6aeff9..21fc5890edafc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -190,10 +190,10 @@ dependencies: "@babel/highlight" "^7.12.13" -"@babel/compat-data@^7.11.0", "@babel/compat-data@^7.13.0": - version "7.13.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.13.0.tgz#7889eb7ee6518e2afa5d312b15fd7fd1fe9f3744" - integrity sha512-mKgFbYQ+23pjwNGBNPNWrBfa3g/EcmrPnwQpjWoNxq9xYf+M8wcLhMlz/wkWimLjzNzGnl3D+C2186gMzk0VuA== +"@babel/compat-data@^7.11.0", "@babel/compat-data@^7.13.0", "@babel/compat-data@^7.13.8": + version "7.13.8" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.13.8.tgz#5b783b9808f15cef71547f1b691f34f8ff6003a6" + integrity sha512-EaI33z19T4qN3xLXsGf48M2cDqa6ei9tPZlfLdb2HC+e/cFtREiRd8hdSqDbwdLB0/+gLwqJmCYASH0z2bUdog== "@babel/core@7.10.5": version "7.10.5" @@ -261,17 +261,17 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@^7.1.0", "@babel/core@^7.1.6", "@babel/core@^7.12.10", "@babel/core@^7.12.17", "@babel/core@^7.12.3", "@babel/core@^7.6.4", "@babel/core@^7.7.5": - version "7.13.1" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.13.1.tgz#7ddd027176debe40f13bb88bac0c21218c5b1ecf" - integrity sha512-FzeKfFBG2rmFtGiiMdXZPFt/5R5DXubVi82uYhjGX4Msf+pgYQMCFIqFXZWs5vbIYbf14VeBIgdGI03CDOOM1w== +"@babel/core@^7.1.0", "@babel/core@^7.1.6", "@babel/core@^7.12.10", "@babel/core@^7.12.17", "@babel/core@^7.12.3", "@babel/core@^7.13.8", "@babel/core@^7.6.4", "@babel/core@^7.7.5": + version "7.13.8" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.13.8.tgz#c191d9c5871788a591d69ea1dc03e5843a3680fb" + integrity sha512-oYapIySGw1zGhEFRd6lzWNLWFX2s5dA/jm+Pw/+59ZdXtjyIuwlXbrId22Md0rgZVop+aVoqow2riXhBLNyuQg== dependencies: "@babel/code-frame" "^7.12.13" "@babel/generator" "^7.13.0" - "@babel/helper-compilation-targets" "^7.13.0" + "@babel/helper-compilation-targets" "^7.13.8" "@babel/helper-module-transforms" "^7.13.0" "@babel/helpers" "^7.13.0" - "@babel/parser" "^7.13.0" + "@babel/parser" "^7.13.4" "@babel/template" "^7.12.13" "@babel/traverse" "^7.13.0" "@babel/types" "^7.13.0" @@ -280,17 +280,24 @@ gensync "^1.0.0-beta.2" json5 "^2.1.2" lodash "^4.17.19" - semver "7.0.0" + semver "^6.3.0" source-map "^0.5.0" -"@babel/eslint-parser@^7.13.4": - version "7.13.4" - resolved "https://registry.yarnpkg.com/@babel/eslint-parser/-/eslint-parser-7.13.4.tgz#dd9df3c70f44d2fb5a6519e8e10ca06c67dca43a" - integrity sha512-WfFEd89SzqmtYox8crTLJuEXyJolZY6Uu6iJpJmw4aMu50zHbYnxzxwuVkCt2cWygw+gLkUPTtAuox7eSnrL8g== +"@babel/eslint-parser@^7.13.4", "@babel/eslint-parser@^7.13.8": + version "7.13.8" + resolved "https://registry.yarnpkg.com/@babel/eslint-parser/-/eslint-parser-7.13.8.tgz#6f2bde6b0690fcc0598b4869fc7c8e8b55b17687" + integrity sha512-XewKkiyukrGzMeqToXJQk6hjg2veI9SNQElGzAoAjKxYCLbgcVX4KA2WhoyqMon9N4RMdCZhNTJNOBcp9spsiw== dependencies: eslint-scope "5.1.0" eslint-visitor-keys "^1.3.0" - semver "7.0.0" + semver "^6.3.0" + +"@babel/eslint-plugin@^7.13.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@babel/eslint-plugin/-/eslint-plugin-7.13.0.tgz#e6d99efcd6b8551adf479e382a47218726179b1b" + integrity sha512-YGwCLc/u/uc3bU+q/fvgRQ62+TkxuyVvdmybK6ElzE49vODp+RnRe16eJzMM7EwvcRPQfQvcOSuGmzfcbZE2+w== + dependencies: + eslint-rule-composer "^0.3.0" "@babel/generator@7.12.1": version "7.12.1" @@ -325,15 +332,15 @@ "@babel/helper-explode-assignable-expression" "^7.12.13" "@babel/types" "^7.12.13" -"@babel/helper-compilation-targets@^7.10.4", "@babel/helper-compilation-targets@^7.13.0": - version "7.13.0" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.0.tgz#c9cf29b82a76fd637f0faa35544c4ace60a155a1" - integrity sha512-SOWD0JK9+MMIhTQiUVd4ng8f3NXhPVQvTv7D3UN4wbp/6cAHnB2EmMaU1zZA2Hh1gwme+THBrVSqTFxHczTh0Q== +"@babel/helper-compilation-targets@^7.10.4", "@babel/helper-compilation-targets@^7.13.0", "@babel/helper-compilation-targets@^7.13.8": + version "7.13.8" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.8.tgz#02bdb22783439afb11b2f009814bdd88384bd468" + integrity sha512-pBljUGC1y3xKLn1nrx2eAhurLMA8OqBtBP/JwG4U8skN7kf8/aqwwxpV1N6T0e7r6+7uNitIa/fUxPFagSXp3A== dependencies: - "@babel/compat-data" "^7.13.0" + "@babel/compat-data" "^7.13.8" "@babel/helper-validator-option" "^7.12.17" browserslist "^4.14.5" - semver "7.0.0" + semver "^6.3.0" "@babel/helper-create-class-features-plugin@^7.12.1", "@babel/helper-create-class-features-plugin@^7.13.0": version "7.13.0" @@ -523,18 +530,17 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/node@^7.12.6": - version "7.12.6" - resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.12.6.tgz#28d40382d50d4dd9c6e712780c0443c6bf7be5c2" - integrity sha512-A1TpW2X05ZkI5+WV7Aa24QX4LyGwrGUQPflG1CyBdr84jUuH0mhkE2BQWSQAlfRnp4bMLjeveMJIhS20JaOfVQ== +"@babel/node@^7.13.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.13.0.tgz#300ea0f4d516a7586c76797404b951c709bfa821" + integrity sha512-WJcD7YMnTs7qFo45lstvAOR7Sa370sydddnF8JNpD5xen3BwMlhHd0XVVDIB0crYIlSav/W/+dVw+D1wJQUZBQ== dependencies: - "@babel/register" "^7.12.1" + "@babel/register" "^7.13.0" commander "^4.0.1" core-js "^3.2.1" lodash "^4.17.19" node-environment-flags "^1.0.5" regenerator-runtime "^0.13.4" - resolve "^1.13.1" v8flags "^3.1.1" "@babel/parser@7.12.3": @@ -542,10 +548,10 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.3.tgz#a305415ebe7a6c7023b40b5122a0662d928334cd" integrity sha512-kFsOS0IbsuhO5ojF8Hc8z/8vEIOkylVBrjiZUbLTE3XFe0Qi+uu6HjzQixkFaqr0ZPAMZcBVxEwmsnsLPZ2Xsw== -"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.1.6", "@babel/parser@^7.10.5", "@babel/parser@^7.11.5", "@babel/parser@^7.12.13", "@babel/parser@^7.12.3", "@babel/parser@^7.12.5", "@babel/parser@^7.13.0", "@babel/parser@^7.3.3", "@babel/parser@^7.7.0": - version "7.13.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.0.tgz#49b9b6ee213e5634fa80361dae139effef893f78" - integrity sha512-w80kxEMFhE3wjMOQkfdTvv0CSdRSJZptIlLhU4eU/coNJeWjduspUFz+IRnBbAq6m5XYBFMoT1TNkk9K9yf10g== +"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.1.6", "@babel/parser@^7.10.5", "@babel/parser@^7.11.5", "@babel/parser@^7.12.13", "@babel/parser@^7.12.3", "@babel/parser@^7.12.5", "@babel/parser@^7.13.0", "@babel/parser@^7.13.4", "@babel/parser@^7.3.3": + version "7.13.9" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.9.tgz#ca34cb95e1c2dd126863a84465ae8ef66114be99" + integrity sha512-nEUfRiARCcaVo3ny3ZQjURjHQZUo/JkEw7rLlSZy/psWGnvwXFtPcr6jb7Yb41DVW5LTe6KRq9LGleRNsg1Frw== "@babel/plugin-proposal-async-generator-functions@^7.13.0": version "7.13.0" @@ -899,12 +905,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.12.13" -"@babel/plugin-syntax-typescript@^7.12.1": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.12.1.tgz#460ba9d77077653803c3dd2e673f76d66b4029e5" - integrity sha512-UZNEcCY+4Dp9yYRCAHrHDU+9ZXLYaY9MgBXSRLkB9WjYFRR6quJBumfVrEkUxrePPBwFcpWfNKXqVRQQtm7mMA== +"@babel/plugin-syntax-typescript@^7.12.1", "@babel/plugin-syntax-typescript@^7.12.13": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.12.13.tgz#9dff111ca64154cef0f4dc52cf843d9f12ce4474" + integrity sha512-cHP3u1JiUiG2LFDKbXnwVad81GvfyIOmCD6HIEId6ojrY0Drfy2q1jw7BwN7dE84+kTnBjLkXoL3IEy/3JPu2w== dependencies: - "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-plugin-utils" "^7.12.13" "@babel/plugin-transform-arrow-functions@^7.13.0": version "7.13.0" @@ -1190,14 +1196,14 @@ dependencies: "@babel/helper-plugin-utils" "^7.12.13" -"@babel/plugin-transform-typescript@^7.12.1": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.12.1.tgz#d92cc0af504d510e26a754a7dbc2e5c8cd9c7ab4" - integrity sha512-VrsBByqAIntM+EYMqSm59SiMEf7qkmI9dqMt6RbD/wlwueWmYcI0FFK5Fj47pP6DRZm+3teXjosKlwcZJ5lIMw== +"@babel/plugin-transform-typescript@^7.12.1", "@babel/plugin-transform-typescript@^7.13.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.13.0.tgz#4a498e1f3600342d2a9e61f60131018f55774853" + integrity sha512-elQEwluzaU8R8dbVuW2Q2Y8Nznf7hnjM7+DSCd14Lo5fF63C9qNLbwZYbmZrtV9/ySpSUpkRpQXvJb6xyu4hCQ== dependencies: - "@babel/helper-create-class-features-plugin" "^7.12.1" - "@babel/helper-plugin-utils" "^7.10.4" - "@babel/plugin-syntax-typescript" "^7.12.1" + "@babel/helper-create-class-features-plugin" "^7.13.0" + "@babel/helper-plugin-utils" "^7.13.0" + "@babel/plugin-syntax-typescript" "^7.12.13" "@babel/plugin-transform-unicode-escapes@^7.12.13": version "7.12.13" @@ -1339,10 +1345,10 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-transform-typescript" "^7.12.1" -"@babel/register@^7.0.0", "@babel/register@^7.12.1": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.12.1.tgz#cdb087bdfc4f7241c03231f22e15d211acf21438" - integrity sha512-XWcmseMIncOjoydKZnWvWi0/5CUCD+ZYKhRwgYlWOrA8fGZ/FjuLRpqtIhLOVD/fvR1b9DQHtZPn68VvhpYf+Q== +"@babel/register@^7.0.0", "@babel/register@^7.13.0": + version "7.13.8" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.13.8.tgz#d9051dc6820cb4e86375cc0e2d55a4862b31184f" + integrity sha512-yCVtABcmvQjRsX2elcZFUV5Q5kDDpHdtXKKku22hNDma60lYuhKmtp1ykZ/okRCPLT2bR5S+cA1kvtBdAFlDTQ== dependencies: find-cache-dir "^2.0.0" lodash "^4.17.19" @@ -1358,10 +1364,10 @@ core-js-pure "^3.0.0" regenerator-runtime "^0.13.4" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.3.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": - version "7.12.5" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e" - integrity sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg== +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.9", "@babel/runtime@^7.3.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": + version "7.13.9" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.9.tgz#97dbe2116e2630c489f22e0656decd60aaa1fcee" + integrity sha512-aY2kU+xgJ3dJ1eU6FMB9EH8dIe8dmusF1xEku52joLvw6eAFN0AI+WxCLDnpev2LEejWBAy2sBvBOBAjI3zmvA== dependencies: regenerator-runtime "^0.13.4" @@ -1379,7 +1385,7 @@ "@babel/parser" "^7.12.13" "@babel/types" "^7.12.13" -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.10.5", "@babel/traverse@^7.11.5", "@babel/traverse@^7.12.1", "@babel/traverse@^7.12.5", "@babel/traverse@^7.13.0", "@babel/traverse@^7.7.0": +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.10.5", "@babel/traverse@^7.11.5", "@babel/traverse@^7.12.1", "@babel/traverse@^7.12.5", "@babel/traverse@^7.13.0": version "7.13.0" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.13.0.tgz#6d95752475f86ee7ded06536de309a65fc8966cc" integrity sha512-xys5xi5JEhzC3RzEmSGrs/b3pJW/o87SypZ+G/PhaE7uqVQNv/jlmVIBXuoh5atqQ434LfXV+sf23Oxj0bchJQ== @@ -1394,7 +1400,7 @@ globals "^11.1.0" lodash "^4.17.19" -"@babel/types@^7.0.0", "@babel/types@^7.0.0-beta.49", "@babel/types@^7.10.5", "@babel/types@^7.11.5", "@babel/types@^7.12.1", "@babel/types@^7.12.13", "@babel/types@^7.12.17", "@babel/types@^7.12.6", "@babel/types@^7.13.0", "@babel/types@^7.3.0", "@babel/types@^7.4.4", "@babel/types@^7.7.0": +"@babel/types@^7.0.0", "@babel/types@^7.0.0-beta.49", "@babel/types@^7.10.5", "@babel/types@^7.11.5", "@babel/types@^7.12.1", "@babel/types@^7.12.13", "@babel/types@^7.12.17", "@babel/types@^7.12.6", "@babel/types@^7.13.0", "@babel/types@^7.3.0", "@babel/types@^7.4.4": version "7.13.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.13.0.tgz#74424d2816f0171b4100f0ab34e9a374efdf7f80" integrity sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA== @@ -1628,10 +1634,10 @@ resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz#8eed982e2ee6f7f4e44c253e12962980791efd46" integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA== -"@eslint/eslintrc@^0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.3.0.tgz#d736d6963d7003b6514e6324bec9c602ac340318" - integrity sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg== +"@eslint/eslintrc@^0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.0.tgz#99cc0a0584d72f1df38b900fb062ba995f395547" + integrity sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog== dependencies: ajv "^6.12.4" debug "^4.1.1" @@ -1640,7 +1646,6 @@ ignore "^4.0.6" import-fresh "^3.2.1" js-yaml "^3.13.1" - lodash "^4.17.20" minimatch "^3.0.4" strip-json-comments "^3.1.1" @@ -5223,7 +5228,7 @@ acorn-globals@^4.1.0, acorn-globals@^4.3.0, acorn-globals@^4.3.2: acorn "^6.0.1" acorn-walk "^6.0.1" -acorn-jsx@^5.0.0, acorn-jsx@^5.0.1, acorn-jsx@^5.1.0, acorn-jsx@^5.3.1: +acorn-jsx@^5.0.1, acorn-jsx@^5.1.0, acorn-jsx@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== @@ -5251,7 +5256,7 @@ acorn@^5.0.0, acorn@^5.5.3: resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e" integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg== -acorn@^6.0.1, acorn@^6.0.4, acorn@^6.0.7, acorn@^6.1.1, acorn@^6.4.1: +acorn@^6.0.1, acorn@^6.0.4, acorn@^6.1.1, acorn@^6.4.1: version "6.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474" integrity sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA== @@ -5349,7 +5354,7 @@ ajv-keywords@^3.1.0, ajv-keywords@^3.2.0, ajv-keywords@^3.4.1, ajv-keywords@^3.5 resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== -ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.4, ajv@^6.12.5, ajv@^6.5.0, ajv@^6.5.5, ajv@^6.9.1: +ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.4, ajv@^6.12.5, ajv@^6.5.0, ajv@^6.5.5: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -6088,18 +6093,6 @@ babel-core@^7.0.0-bridge.0: version "7.0.0-bridge.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" -babel-eslint@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232" - integrity sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.7.0" - "@babel/traverse" "^7.7.0" - "@babel/types" "^7.7.0" - eslint-visitor-keys "^1.0.0" - resolve "^1.12.0" - babel-extract-comments@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/babel-extract-comments/-/babel-extract-comments-1.0.0.tgz#0a2aedf81417ed391b85e18b4614e693a0351a21" @@ -10512,12 +10505,10 @@ eslint-config-google@^0.14.0: resolved "https://registry.yarnpkg.com/eslint-config-google/-/eslint-config-google-0.14.0.tgz#4f5f8759ba6e11b424294a219dbfa18c508bcc1a" integrity sha512-WsbX4WbjuMvTdeVL6+J3rK1RGhCTqjsFjX7UMSMgZiyxxaNLkoJENbrGExzERFeoTpGw3F3FypTiWAP9ZXzkEw== -eslint-config-prettier@^6.15.0: - version "6.15.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz#7f93f6cb7d45a92f1537a70ecc06366e1ac6fed9" - integrity sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw== - dependencies: - get-stdin "^6.0.0" +eslint-config-prettier@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.1.0.tgz#4ef1eaf97afe5176e6a75ddfb57c335121abc5a6" + integrity sha512-oKMhGv3ihGbCIimCAjqkdzx2Q+jthoqnXSP+d86M9tptwugycmTFdVR4IpLgq2c4SHifbwO90z2fQ8/Aio73yw== eslint-config-react-app@^6.0.0: version "6.0.0" @@ -10551,13 +10542,6 @@ eslint-plugin-filenames@^1.3.2: lodash.snakecase "4.1.1" lodash.upperfirst "4.3.1" -eslint-plugin-flowtype@^3.13.0: - version "3.13.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.13.0.tgz#e241ebd39c0ce519345a3f074ec1ebde4cf80f2c" - integrity sha512-bhewp36P+t7cEV0b6OdmoRWJCBYRiHFlqPZAG1oS3SF+Y0LQkeDvFSM4oxoxvczD1OdONCXMlJfQFiWLcV9urw== - dependencies: - lodash "^4.17.15" - eslint-plugin-flowtype@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-5.3.1.tgz#df6227e28c61d967b825c1327a27818bbb2ad325" @@ -10641,6 +10625,11 @@ eslint-plugin-react@^7.22.0: resolve "^1.18.1" string.prototype.matchall "^4.0.2" +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" + integrity sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg== + eslint-scope@5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.0.tgz#d0f971dfe59c69e0cada684b23d49dbf82600ce5" @@ -10664,7 +10653,7 @@ eslint-scope@^5.0.0, eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-utils@^1.3.1, eslint-utils@^1.4.3: +eslint-utils@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== @@ -10678,7 +10667,7 @@ eslint-utils@^2.0.0, eslint-utils@^2.1.0: dependencies: eslint-visitor-keys "^1.1.0" -eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: +eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.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== @@ -10699,47 +10688,6 @@ eslint-webpack-plugin@^2.5.2: micromatch "^4.0.2" schema-utils "^3.0.0" -eslint@^5.16.0: - version "5.16.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea" - dependencies: - "@babel/code-frame" "^7.0.0" - ajv "^6.9.1" - chalk "^2.1.0" - cross-spawn "^6.0.5" - debug "^4.0.1" - doctrine "^3.0.0" - eslint-scope "^4.0.3" - eslint-utils "^1.3.1" - eslint-visitor-keys "^1.0.0" - espree "^5.0.1" - esquery "^1.0.1" - esutils "^2.0.2" - file-entry-cache "^5.0.1" - functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.7.0" - ignore "^4.0.6" - import-fresh "^3.0.0" - imurmurhash "^0.1.4" - inquirer "^6.2.2" - js-yaml "^3.13.0" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.11" - minimatch "^3.0.4" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" - progress "^2.0.0" - regexpp "^2.0.1" - semver "^5.5.1" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" - table "^5.2.3" - text-table "^0.2.0" - eslint@^6.8.0: version "6.8.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" @@ -10783,13 +10731,13 @@ eslint@^6.8.0: text-table "^0.2.0" v8-compile-cache "^2.0.3" -eslint@^7.18.0, eslint@^7.20.0: - version "7.20.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.20.0.tgz#db07c4ca4eda2e2316e7aa57ac7fc91ec550bdc7" - integrity sha512-qGi0CTcOGP2OtCQBgWZlQjcTuP0XkIpYFj25XtRTQSHC+umNnp7UMshr2G8SLsRFYDdAPFeHOsiteadmMH02Yw== +eslint@^7.18.0, eslint@^7.20.0, eslint@^7.21.0: + version "7.21.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.21.0.tgz#4ecd5b8c5b44f5dedc9b8a110b01bbfeb15d1c83" + integrity sha512-W2aJbXpMNofUp0ztQaF40fveSsJBjlSCSWpy//gzfTvwC+USs/nceBrKmlJOiM8r1bLwP2EuYkCqArn/6QTIgg== dependencies: "@babel/code-frame" "7.12.11" - "@eslint/eslintrc" "^0.3.0" + "@eslint/eslintrc" "^0.4.0" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" @@ -10802,7 +10750,7 @@ eslint@^7.18.0, eslint@^7.20.0: espree "^7.3.1" esquery "^1.4.0" esutils "^2.0.2" - file-entry-cache "^6.0.0" + file-entry-cache "^6.0.1" functional-red-black-tree "^1.0.1" glob-parent "^5.0.0" globals "^12.1.0" @@ -10826,14 +10774,6 @@ eslint@^7.18.0, eslint@^7.20.0: text-table "^0.2.0" v8-compile-cache "^2.0.3" -espree@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.1.tgz#5d6526fa4fc7f0788a5cf75b15f30323e2f81f7a" - dependencies: - acorn "^6.0.7" - acorn-jsx "^5.0.0" - eslint-visitor-keys "^1.0.0" - espree@^6.1.2: version "6.1.2" resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.2.tgz#6c272650932b4f91c3714e5e7b5f5e2ecf47262d" @@ -11465,10 +11405,10 @@ file-entry-cache@^5.0.1: dependencies: flat-cache "^2.0.1" -file-entry-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.0.tgz#7921a89c391c6d93efec2169ac6bf300c527ea0a" - integrity sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA== +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: flat-cache "^3.0.4" @@ -12537,7 +12477,7 @@ globals-docs@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/globals-docs/-/globals-docs-2.4.0.tgz#f2c647544eb6161c7c38452808e16e693c2dafbb" -globals@^11.1.0, globals@^11.7.0: +globals@^11.1.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== @@ -14067,7 +14007,7 @@ inquirer@^3.3.0: strip-ansi "^4.0.0" through "^2.3.6" -inquirer@^6.2.0, inquirer@^6.2.2, inquirer@^6.5.2: +inquirer@^6.2.0, inquirer@^6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== @@ -15529,7 +15469,7 @@ js-yaml@3.14.0: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^3.10.0, js-yaml@^3.11.0, js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.14.1, js-yaml@^3.6.1, js-yaml@^3.8.1: +js-yaml@^3.10.0, js-yaml@^3.11.0, js-yaml@^3.13.1, js-yaml@^3.14.1, js-yaml@^3.6.1, js-yaml@^3.8.1: version "3.14.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== @@ -18742,7 +18682,7 @@ optimist@^0.6.1: minimist "~0.0.1" wordwrap "~0.0.2" -optionator@^0.8.1, optionator@^0.8.2, optionator@^0.8.3: +optionator@^0.8.1, optionator@^0.8.3: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==