Merged in feat/sw-3596-console (pull request #3100)
feat(SW-3596): added lint rule for no console.log. Use logger instead. * feat(SW-3596): added lint rule for no console.log. Use logger instead. Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -46,6 +46,7 @@ export default defineConfig([
|
||||
},
|
||||
|
||||
rules: {
|
||||
"no-console": "warn",
|
||||
"no-unused-vars": "off",
|
||||
"react/function-component-definition": "error",
|
||||
"import/no-relative-packages": "error",
|
||||
|
||||
@@ -14,6 +14,7 @@ export function DebugButton() {
|
||||
const handleClick = () => {
|
||||
const allRoomAvailability = getAllRoomAvailability(context)
|
||||
const allRoomPackages = getAllRoomPackages(context)
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("%c SelectRateContext: ", "background: #AD0015; color: #FFF", {
|
||||
...context,
|
||||
...allRoomAvailability,
|
||||
|
||||
@@ -214,7 +214,7 @@ export function SelectRateProvider({
|
||||
})
|
||||
|
||||
if (selectedRatesPerRoom && selectedRatesPerRoom.length > 1) {
|
||||
console.error(`Multiple selected rates found for room index ${ix}:`)
|
||||
logger.error(`Multiple selected rates found for room index ${ix}:`)
|
||||
}
|
||||
|
||||
const selectedRate = selectedRatesPerRoom?.at(0)
|
||||
@@ -234,7 +234,7 @@ export function SelectRateProvider({
|
||||
const getPriceForRoom = useCallback(
|
||||
(roomIndex: number): Price | null => {
|
||||
if (roomIndex < 0 || roomIndex >= selectedRates.length) {
|
||||
console.warn("Room index out of bounds:", roomIndex)
|
||||
logger.warn("Room index out of bounds:", roomIndex)
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ export function SelectRateProvider({
|
||||
selectPackages: ({ roomIndex, packages }) => {
|
||||
const updatedRoom = selectRateBooking?.rooms?.[roomIndex]
|
||||
if (!updatedRoom) {
|
||||
console.error("No room found at index", roomIndex)
|
||||
logger.error("No room found at index", roomIndex)
|
||||
// TODO: What to do here?
|
||||
return
|
||||
}
|
||||
@@ -443,7 +443,7 @@ export function SelectRateProvider({
|
||||
}) => {
|
||||
const updatedRoom = selectRateBooking?.rooms?.[roomIndex]
|
||||
if (!updatedRoom) {
|
||||
console.error("No room found at index", roomIndex)
|
||||
logger.error("No room found at index", roomIndex)
|
||||
// TODO: What to do here?
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user