mirror of
https://github.com/hanzoai/agency.git
synced 2026-11-02 19:13:28 +00:00
27 lines
846 B
Plaintext
27 lines
846 B
Plaintext
class AlreadyHasPlaceholderDataProperty extends Error {
|
|
/**
|
|
* @param {import('jscodeshift').CallExpression} callExpression
|
|
* @param {string} filePath
|
|
*/
|
|
constructor(callExpression, filePath) {
|
|
super('')
|
|
this.message = this.buildMessage(callExpression, filePath)
|
|
this.name = 'AlreadyHasPlaceholderDataProperty'
|
|
}
|
|
|
|
/**
|
|
* @param {import('jscodeshift').CallExpression} callExpression
|
|
* @param {string} filePath
|
|
* @returns {string}
|
|
*/
|
|
buildMessage(callExpression, filePath) {
|
|
const location = callExpression.callee.loc
|
|
const start = location.start.line
|
|
const end = location.end.line
|
|
|
|
return `The usage in file "${filePath}" at line ${start}:${end} already contains a a "placeholderData" property. Please migrate this usage manually.`
|
|
}
|
|
}
|
|
|
|
module.exports = AlreadyHasPlaceholderDataProperty
|