Skip to content

Commit

Permalink
Adjusted eslint usage for eslint9 with cds8
Browse files Browse the repository at this point in the history
  • Loading branch information
danjoa committed Jul 15, 2024
1 parent bb26b86 commit 9261f82
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 36 deletions.
10 changes: 1 addition & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,5 @@
"**/cds/lib/req/cds-context.js",
"**/odata-v4/okra/**"
]
},
"eslint.probe": [
"cds",
"csn",
"csv",
"csv (semicolon)",
"tsv",
"tab"
]
}
}
2 changes: 1 addition & 1 deletion bookshop/app/vue/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function csrfToken (request) {
document.csrfToken = token
request.headers['x-csrf-token'] = document.csrfToken
return request
}).catch(_ => {
}).catch(() => {
document.csrfToken = null // set mark to not try again
return request
})
Expand Down
2 changes: 2 additions & 0 deletions bookshop/db/init.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const cds = require('@sap/cds')

/**
* In order to keep basic bookshop sample as simple as possible, we don't add
* reuse dependencies. This db/init.js ensures we still have a minimum set of
Expand Down
6 changes: 3 additions & 3 deletions bookstore/srv/mashup.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = async()=>{ // called by server.js
// Note: prepend is neccessary to intercept generic default handler
//
CatalogService.prepend (srv => srv.on ('READ', 'Books/reviews', (req) => {
console.debug ('> delegating request to ReviewsService')
console.debug ('> delegating request to ReviewsService') // eslint-disable-line no-console
const [id] = req.params, { columns, limit } = req.query.SELECT
return ReviewsService.read ('Reviews',columns).limit(limit).where({subject:String(id)})
}))
Expand All @@ -40,7 +40,7 @@ module.exports = async()=>{ // called by server.js
// Update Books' average ratings when ReviewsService signals updated reviews
//
ReviewsService.on ('reviewed', (msg) => {
console.debug ('> received:', msg.event, msg.data)
console.debug ('> received:', msg.event, msg.data) // eslint-disable-line no-console
const { subject, count, rating } = msg.data
return UPDATE(Books,subject).with({ numberOfReviews:count, rating })
})
Expand All @@ -49,7 +49,7 @@ module.exports = async()=>{ // called by server.js
// Reduce stock of ordered books for orders are created from Orders admin UI
//
OrdersService.on ('OrderChanged', (msg) => {
console.debug ('> received:', msg.event, msg.data)
console.debug ('> received:', msg.event, msg.data) // eslint-disable-line no-console
const { product, deltaQuantity } = msg.data
return UPDATE (Books) .where ('ID =', product)
.and ('stock >=', deltaQuantity)
Expand Down
2 changes: 1 addition & 1 deletion data-viewer/srv/data-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DataService extends cds.ApplicationService { init(){
.sort((e1, e2) => e1.name.localeCompare(e2.name))
.map(e => {
const columns = Object.entries(e.elements)
.filter(([_, el]) => !(el instanceof cds.Association)) // exclude assocs+compositions
.filter(([,el]) => !(el instanceof cds.Association)) // exclude assocs+compositions
.map(([name, el]) => { return { name, type: el.type, isKey:!!el.key }})
return { name: e.name, columns }
})
Expand Down
2 changes: 1 addition & 1 deletion orders/srv/orders-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class OrdersService extends cds.ApplicationService {
/** order changed -> broadcast event */
orderChanged (product, deltaQuantity) {
// Emit events to inform subscribers about changes in orders
console.log ('> emitting:', 'OrderChanged', { product, deltaQuantity })
console.log ('> emitting:', 'OrderChanged', { product, deltaQuantity }) // eslint-disable-line no-console
return this.emit ('OrderChanged', { product, deltaQuantity })
}

Expand Down
18 changes: 0 additions & 18 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
],
"devDependencies": {
"@cap-js/sqlite": "^1",
"@sap/eslint-plugin-cds": "^3",
"axios": "^1",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
Expand Down
1 change: 0 additions & 1 deletion reviews/app/vue/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const reviews = Vue.createApp ({
const res = await POST(`/Reviews`,review)
reviews.ID = res.data.ID
} else {
console.trace()
await PUT(`/Reviews/${review.ID}`,review)
}
reviews.message = { succeeded: 'Your review was submitted successfully. Thanks.' }
Expand Down
2 changes: 1 addition & 1 deletion reviews/srv/reviews-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = cds.service.impl (function(){
const { count, rating } = await cds.tx(req) .run (
SELECT.one `round(avg(rating),2) as rating, count(*) as count` .from (Reviews) .where ({subject})
)
global.it || console.log ('< emitting:', 'reviewed', { subject, count, rating })
global.it || console.log ('< emitting:', 'reviewed', { subject, count, rating }) // eslint-disable-line no-console
await this.emit ('reviewed', { subject, count, rating })
})

Expand Down

0 comments on commit 9261f82

Please sign in to comment.