Skip to content

Commit

Permalink
Normalize renderedByLocation casing
Browse files Browse the repository at this point in the history
Co-authored-by: Lennart <lekoarts@gmail.com>
  • Loading branch information
pieh and LekoArts committed Oct 20, 2022
1 parent 49c8087 commit c42dadd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/gatsby/cache-dir/slice.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function Slice(props) {
slicesContext.renderEnvironment === `browser`,
internalProps.sliceName,
propErrors,
props.__renderedBylocation
props.__renderedByLocation
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ObjectProperty } from "@babel/types"
import { store } from "../../redux"

/**
* This is a plugin that finds <Slice> placeholder components and injects the __renderedBylocation prop
* This is a plugin that finds <Slice> placeholder components and injects the __renderedByLocation prop
* with filename and location in the file where the placeholder was found. This is later used to provide
* more useful error messages when the user props are invalid showing codeframe where user tries to render it
* instead of codeframe of the Slice component itself (internals of gatsby) that is not useful for the user.
Expand All @@ -27,7 +27,7 @@ export default function addSlicePlaceholderLocation(
}

if (this.file.opts.filename) {
const __renderedBylocationProperties: Array<ObjectProperty> = [
const __renderedByLocationProperties: Array<ObjectProperty> = [
t.objectProperty(
t.identifier(`fileName`),
t.stringLiteral(
Expand All @@ -40,15 +40,15 @@ export default function addSlicePlaceholderLocation(
]

if (nodePath.node.loc?.start.line) {
__renderedBylocationProperties.push(
__renderedByLocationProperties.push(
t.objectProperty(
t.identifier(`lineNumber`),
t.numericLiteral(nodePath.node.loc.start.line)
)
)

if (nodePath.node.loc?.start.column) {
__renderedBylocationProperties.push(
__renderedByLocationProperties.push(
t.objectProperty(
t.identifier(`columnNumber`),
t.numericLiteral(nodePath.node.loc.start.column + 1)
Expand All @@ -57,15 +57,15 @@ export default function addSlicePlaceholderLocation(
}

if (nodePath.node.loc?.end.line) {
__renderedBylocationProperties.push(
__renderedByLocationProperties.push(
t.objectProperty(
t.identifier(`endLineNumber`),
t.numericLiteral(nodePath.node.loc.end.line)
)
)

if (nodePath.node.loc?.end.column) {
__renderedBylocationProperties.push(
__renderedByLocationProperties.push(
t.objectProperty(
t.identifier(`endColumnNumber`),
t.numericLiteral(nodePath.node.loc.end.column + 1)
Expand All @@ -76,9 +76,9 @@ export default function addSlicePlaceholderLocation(
}

const newProp = t.jsxAttribute(
t.jsxIdentifier(`__renderedBylocation`),
t.jsxIdentifier(`__renderedByLocation`),
t.jsxExpressionContainer(
t.objectExpression(__renderedBylocationProperties)
t.objectExpression(__renderedByLocationProperties)
)
)

Expand Down

0 comments on commit c42dadd

Please sign in to comment.