Skip to content

Commit

Permalink
Lodash: Refactor away from _.snakeCase() (#42427)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla authored Jul 15, 2022
1 parent 87cdeb3 commit 52138ca
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 2 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ module.exports = {
'repeat',
'reverse',
'size',
'snakeCase',
'stubFalse',
'stubTrue',
'sum',
Expand Down
103 changes: 103 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion packages/create-block/lib/scaffold.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
const { snakeCase, camelCase, upperFirst } = require( 'lodash' );
const { camelCase, snakeCase } = require( 'change-case' );

/**
* Internal dependencies
Expand All @@ -13,6 +13,10 @@ const initWPEnv = require( './init-wp-env' );
const { code, info, success } = require( './log' );
const { writeOutputAsset, writeOutputTemplate } = require( './output' );

function upperFirst( str ) {
return str.charAt( 0 ).toUpperCase() + str.substr( 1 );
}

module.exports = async (
{ blockOutputTemplates, pluginOutputTemplates, outputAssets },
{
Expand Down
1 change: 1 addition & 0 deletions packages/create-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"dependencies": {
"@wordpress/lazy-import": "file:../lazy-import",
"chalk": "^4.0.0",
"change-case": "^4.1.2",
"check-node-version": "^4.1.0",
"commander": "^9.2.0",
"execa": "^4.0.2",
Expand Down
1 change: 1 addition & 0 deletions packages/e2e-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@wordpress/api-fetch": "file:../api-fetch",
"@wordpress/keycodes": "file:../keycodes",
"@wordpress/url": "file:../url",
"change-case": "^4.1.2",
"form-data": "^4.0.0",
"lodash": "^4.17.21",
"node-fetch": "^2.6.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/src/create-user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { snakeCase } from 'lodash';
import { snakeCase } from 'change-case';

/**
* Internal dependencies
Expand Down

0 comments on commit 52138ca

Please sign in to comment.