Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
gatsby-codemods
Advanced tools
A collection of codemod scripts for use with JSCodeshift that help migrate to newer versions of Gatsby.
Note: Codemods are designed to rewrite your project's files. Ensure you have a backup before going any further.
npm install --global jscodeshift
npm install gatsby-codemods@next
jscodeshift -t node_modules/gatsby-codemods/transforms/global-graphql-calls.js my-project
Note that jscodeshift tries to match the formatting of your existing code, but you may need to use a tool like prettier to ensure consistency after running these codemods.
Structure of a jscodeshift call:
jscodeshift -t <codemod-script> <path>
codemod-script
- path to the transform file, see available scripts belowpath
- files or directory to transform, typically the path to your Gatsby project-d
option for a dry-run and use -p
to print the output for comparison--extensions
option if your files have different extensions than .js
(for example, --extensions js,jsx
)global-graphql-calls
Add import { graphql } from "gatsby"
to files that have graphql queries in them. See the [Gatsby v2 migration guide for more details].(https://next.gatsbyjs.org/docs/migrating-from-v1-to-v2/#import-graphql-from-gatsby)
jscodeshift -t node_modules/gatsby-codemods/dist/transforms/global-graphql-calls.js <path>
Check out issue 5038 in the Gatsby repo for additional codemod ideas.
We'd love your help with writing these!
FAQs
A collection of codemod scripts for use with JSCodeshift that help migrate to newer versions of Gatsby.
The npm package gatsby-codemods receives a total of 1,234 weekly downloads. As such, gatsby-codemods popularity was classified as popular.
We found that gatsby-codemods demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.