lint @typescript-eslint/recommended (#8406)

Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>
This commit is contained in:
Ulf Gebhardt 2025-04-21 12:01:53 +02:00 committed by GitHub
parent f9368112de
commit 53f3a4e2e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
51 changed files with 126 additions and 89 deletions

View File

@ -16,6 +16,7 @@ module.exports = {
'plugin:promise/recommended',
'plugin:security/recommended-legacy',
'plugin:@eslint-community/eslint-comments/recommended',
'prettier',
],
settings: {
'import/parsers': {
@ -178,9 +179,10 @@ module.exports = {
{
files: ['*.ts', '*.tsx'],
extends: [
// 'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended',
// 'plugin:@typescript-eslint/recommended-requiring-type-checking',
// 'plugin:@typescript-eslint/strict',
'prettier',
],
rules: {
// allow explicitly defined dangling promises
@ -192,6 +194,11 @@ module.exports = {
'import/unambiguous': 'off',
// this is not compatible with typeorm, due to joined tables can be null, but are not defined as nullable
'@typescript-eslint/no-unnecessary-condition': 'off',
// respect underscore as acceptable unused variable
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
},
parserOptions: {
tsconfigRootDir: __dirname,

View File

@ -19,6 +19,7 @@ if (require.resolve) {
}
// Use Cypress env or process.env
// eslint-disable-next-line @typescript-eslint/no-explicit-any
declare let Cypress: any | undefined
const env = typeof Cypress !== 'undefined' ? Cypress.env() : process.env // eslint-disable-line no-undef

View File

@ -1,5 +1,5 @@
/* eslint-disable import/no-commonjs */
// eslint-disable-next-line n/no-unpublished-require
// eslint-disable-next-line n/no-unpublished-require, @typescript-eslint/no-var-requires
const tsNode = require('ts-node')
// eslint-disable-next-line import/no-unassigned-import, import/no-extraneous-dependencies, n/no-unpublished-require
require('tsconfig-paths/register')

View File

@ -40,14 +40,14 @@ Factory.define('category')
.attr('id', uuid)
.attr('icon', 'globe')
.attr('name', 'Global Peace & Nonviolence')
.after((buildObject, options) => {
.after((buildObject, _options) => {
return neode.create('Category', buildObject)
})
Factory.define('badge')
.attr('type', 'crowdfunding')
.attr('status', 'permanent')
.after((buildObject, options) => {
.after((buildObject, _options) => {
return neode.create('Badge', buildObject)
})
@ -56,7 +56,7 @@ Factory.define('image')
.attr('aspectRatio', 1.3333333333333333)
.attr('alt', faker.lorem.sentence)
.attr('type', 'image/jpeg')
.after((buildObject, options) => {
.after((buildObject, _options) => {
const { url: imageUrl } = buildObject
if (imageUrl) buildObject.url = uniqueImageUrl(imageUrl)
return neode.create('Image', buildObject)
@ -85,21 +85,21 @@ Factory.define('basicUser')
Factory.define('userWithoutEmailAddress')
.extend('basicUser')
.option('about', faker.lorem.paragraph)
.after(async (buildObject, options) => {
.after(async (buildObject, _options) => {
return neode.create('User', buildObject)
})
Factory.define('userWithAboutNull')
.extend('basicUser')
.option('about', null)
.after(async (buildObject, options) => {
.after(async (buildObject, _options) => {
return neode.create('User', buildObject)
})
Factory.define('userWithAboutEmpty')
.extend('basicUser')
.option('about', '')
.after(async (buildObject, options) => {
.after(async (buildObject, _options) => {
return neode.create('User', buildObject)
})
@ -224,7 +224,7 @@ Factory.define('donations')
.attr('showDonations', true)
.attr('goal', 15000)
.attr('progress', 7000)
.after((buildObject, options) => {
.after((buildObject, _options) => {
return neode.create('Donations', buildObject)
})
@ -235,13 +235,13 @@ const emailDefaults = {
Factory.define('emailAddress')
.attrs(emailDefaults)
.after((buildObject, options) => {
.after((buildObject, _options) => {
return neode.create('EmailAddress', buildObject)
})
Factory.define('unverifiedEmailAddress')
.attr(emailDefaults)
.after((buildObject, options) => {
.after((buildObject, _options) => {
return neode.create('UnverifiedEmailAddress', buildObject)
})
@ -281,11 +281,11 @@ Factory.define('location')
id: 'country.10743216036480410',
type: 'country',
})
.after((buildObject, options) => {
.after((buildObject, _options) => {
return neode.create('Location', buildObject)
})
Factory.define('report').after((buildObject, options) => {
Factory.define('report').after((buildObject, _options) => {
return neode.create('Report', buildObject)
})
@ -293,7 +293,7 @@ Factory.define('tag')
.attrs({
name: '#human-connection',
})
.after((buildObject, options) => {
.after((buildObject, _options) => {
return neode.create('Tag', buildObject)
})
@ -301,7 +301,7 @@ Factory.define('socialMedia')
.attrs({
url: 'https://mastodon.social/@Gargron',
})
.after((buildObject, options) => {
.after((buildObject, _options) => {
return neode.create('SocialMedia', buildObject)
})

View File

@ -2,7 +2,7 @@ import { getDriver } from '@db/neo4j'
export const description = ''
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -23,7 +23,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -21,12 +21,14 @@ export function up(next) {
rxSession
.beginTransaction()
.pipe(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
flatMap((txc: any) =>
concat(
txc
.run('MATCH (email:EmailAddress) RETURN email {.email}')
.records()
.pipe(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
map((record: any) => {
const { email } = record.get('email')
const normalizedEmail = normalizeEmail(email)
@ -48,6 +50,7 @@ export function up(next) {
)
.records()
.pipe(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
map((r: any) => ({
oldEmail: email,
email: r.get('email'),
@ -61,7 +64,7 @@ export function up(next) {
),
)
.subscribe({
next: ({ user, email, oldUser, oldEmail }) =>
next: ({ user, email, _oldUser, oldEmail }) =>
// eslint-disable-next-line no-console
console.log(`
Merged:

View File

@ -15,6 +15,7 @@ export function up(next) {
rxSession
.beginTransaction()
.pipe(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
flatMap((transaction: any) =>
concat(
transaction
@ -26,6 +27,7 @@ export function up(next) {
)
.records()
.pipe(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
map((record: any) => {
const { id: locationId } = record.get('location')
return { locationId }
@ -43,6 +45,7 @@ export function up(next) {
)
.records()
.pipe(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
map((record: any) => ({
location: record.get('location'),
updatedLocation: record.get('updatedLocation'),

View File

@ -8,7 +8,7 @@ export const description = `
A blocked user will still be able to see your contributions, but will not be able to interact with them and vice versa.
`
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-empty-function */
'use strict'
export async function up(next) {}
export async function up(_next) {}
export async function down(next) {}
export async function down(_next) {}

View File

@ -4,7 +4,7 @@ export const description = `
This migration adds the clickedCount property to all posts, setting it to 0.
`
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -27,7 +27,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -4,7 +4,7 @@ export const description = `
This migration adds the viewedTeaserCount property to all posts, setting it to 0.
`
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -27,7 +27,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -5,7 +5,7 @@ import { getDriver } from '@db/neo4j'
export const description =
'This migration adds a Donations node with default settings to the database.'
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -39,7 +39,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -2,7 +2,7 @@ import { getDriver } from '@db/neo4j'
export const description = ''
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -29,7 +29,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -5,7 +5,7 @@ export const description = `
Additional we like to have fulltext indices the keys 'name', 'slug', 'about', and 'description'.
`
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -38,7 +38,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -2,7 +2,7 @@ import { getDriver } from '@db/neo4j'
export const description = ''
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -46,7 +46,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -2,7 +2,7 @@ import { getDriver } from '@db/neo4j'
export const description = 'Add to all existing posts the Article label'
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -26,7 +26,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -2,7 +2,7 @@ import { getDriver } from '@db/neo4j'
export const description = 'Add postType property Article to all posts'
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -26,7 +26,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -5,7 +5,7 @@ Transform event start and end date of format 'YYYY-MM-DD HH:MM:SS' in CEST
to ISOString in UTC.
`
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -46,7 +46,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -4,7 +4,7 @@ export const description = `
All authors observe their posts.
`
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -33,7 +33,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -4,7 +4,7 @@ export const description = `
All users commenting a post observe the post.
`
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -33,7 +33,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -3,7 +3,7 @@ import { getDriver } from '@db/neo4j'
export const description =
'Transforms the `sendNotificationEmails` property on User to a multi value system'
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -34,7 +34,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -53,7 +53,6 @@ export async function down(next) {
REMOVE user.emailNotificationsGroupMemberRoleChanged
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)

View File

@ -2,7 +2,7 @@ import { getDriver } from '@db/neo4j'
export const description = ''
export async function up(next) {
export async function up(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -26,7 +26,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()

View File

@ -911,6 +911,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
authenticatedUser = null
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const comments: any[] = []
comments.push(
await Factory.build(
@ -1085,6 +1086,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
await huey.relateTo(p9, 'shouted')
await louie.relateTo(p10, 'shouted')
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const reports: any[] = []
reports.push(
await Factory.build('report'),
@ -1192,6 +1194,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
closed: true,
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const additionalUsers: any[] = []
for (let i = 0; i < 30; i++) {
const user = await Factory.build('user')

View File

@ -19,6 +19,7 @@ export default function (content?) {
return $(el).attr('data-hashtag-id')
})
.get()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const hashtags: any = []
ids.forEach((id) => {
const match = exec(id, regX)

View File

@ -28,6 +28,7 @@ const transporter = nodemailer.createTransport({
},
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-function
let sendMailCallback: any = async () => {}
if (!hasEmailConfig) {
if (!CONFIG.TEST) {
@ -51,6 +52,7 @@ if (!hasEmailConfig) {
cleanHtml(templateArgs.html, 'dummyKey', {
allowedTags: ['a'],
allowedAttributes: { a: ['href'] },
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any).replace(/&amp;/g, '&'),
)
}

View File

@ -15,23 +15,23 @@ const isAuthenticated = rule({
return !!(ctx && ctx.user && ctx.user.id)
})
const isModerator = rule()(async (parent, args, { user }, info) => {
const isModerator = rule()(async (_parent, _args, { user }, _info) => {
return user && (user.role === 'moderator' || user.role === 'admin')
})
const isAdmin = rule()(async (parent, args, { user }, info) => {
const isAdmin = rule()(async (_parent, _args, { user }, _info) => {
return user && user.role === 'admin'
})
const onlyYourself = rule({
cache: 'no_cache',
})(async (parent, args, context, info) => {
})(async (_parent, args, context, _info) => {
return context.user.id === args.id
})
const isMyOwn = rule({
cache: 'no_cache',
})(async (parent, args, { user }, info) => {
})(async (parent, _args, { user }, _info) => {
return user && user.id === parent.id
})
@ -350,7 +350,7 @@ const isAuthor = rule({
const isDeletingOwnAccount = rule({
cache: 'no_cache',
})(async (parent, args, context, _info) => {
})(async (_parent, args, context, _info) => {
return context.user.id === args.id
})
@ -362,7 +362,7 @@ const noEmailFilter = rule({
const publicRegistration = rule()(() => CONFIG.PUBLIC_REGISTRATION)
const inviteRegistration = rule()(async (_parent, args, { user, driver }) => {
const inviteRegistration = rule()(async (_parent, args, { _user, driver }) => {
if (!CONFIG.INVITE_REGISTRATION) return false
const { inviteCode } = args
const session = driver.session()

View File

@ -2,7 +2,7 @@ import { sentry } from 'graphql-middleware-sentry'
import CONFIG from '@config/index'
// eslint-disable-next-line import/no-mutable-exports
// eslint-disable-next-line import/no-mutable-exports, @typescript-eslint/no-explicit-any
let sentryMiddleware: any = (resolve, root, args, context, resolveInfo) =>
resolve(root, args, context, resolveInfo)
@ -14,6 +14,7 @@ if (CONFIG.SENTRY_DSN_BACKEND) {
release: CONFIG.COMMIT,
environment: CONFIG.NODE_ENV,
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
withScope: (scope, error, context: any) => {
scope.setUser({
id: context.user && context.user.id,

View File

@ -1,7 +1,9 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable n/no-missing-require */
/* eslint-disable n/global-require */
// NOTE: We cannot use `fs` here to clean up the code. Cypress breaks on any npm
// module that is not browser-compatible. Node's `fs` module is server-side only
// eslint-disable-next-line @typescript-eslint/no-explicit-any
declare let Cypress: any | undefined
export default {
Image: typeof Cypress !== 'undefined' ? require('./Image') : require('./Image').default,

View File

@ -4,7 +4,7 @@ import Resolver from './helpers/Resolver'
export default {
Mutation: {
CreateComment: async (object, params, context, resolveInfo) => {
CreateComment: async (_object, params, context, _resolveInfo) => {
const { postId } = params
const { user, driver } = context
// Adding relationship from comment to post by passing in the postId,

View File

@ -55,6 +55,7 @@ describe('Query', () => {
beforeEach(() => {
embedAction = async (variables) => {
const { server } = createServer({
// eslint-disable-next-line @typescript-eslint/no-empty-function
context: () => {},
})
const { query } = createTestClient(server)

View File

@ -3,7 +3,7 @@ import { undefinedToNullResolver } from './helpers/Resolver'
export default {
Query: {
embed: async (object, { url }, context, resolveInfo) => {
embed: async (_object, { url }, _context, _resolveInfo) => {
return scrape(url)
},
},
@ -22,7 +22,7 @@ export default {
'lang',
'html',
]),
sources: async (parent, params, context, resolveInfo) => {
sources: async (parent, _params, _context, _resolveInfo) => {
return typeof parent.sources === 'undefined' ? [] : parent.sources
},
},

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable n/no-extraneous-require */
/* eslint-disable n/global-require */
/* eslint-disable import/no-commonjs */

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { createTestClient } from 'apollo-server-testing'
import CONFIG from '@config/index'

View File

@ -11,6 +11,7 @@ export const undefinedToNullResolver = (list) => {
return resolvers
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export default function Resolver(type, options: any = {}) {
const {
idAttribute = 'id',
@ -21,8 +22,8 @@ export default function Resolver(type, options: any = {}) {
hasMany = {},
} = options
const _hasResolver = (resolvers, { key, connection }, { returnType }) => {
return async (parent, params, { driver, cypherParams }, resolveInfo) => {
const _hasResolver = (_resolvers, { key, connection }, { returnType }) => {
return async (parent, _params, { driver, cypherParams }, _resolveInfo) => {
if (typeof parent[key] !== 'undefined') return parent[key]
const id = parent[idAttribute]
const session = driver.session()
@ -45,10 +46,11 @@ export default function Resolver(type, options: any = {}) {
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const booleanResolver = (obj: any[]) => {
const resolvers = {}
for (const [key, condition] of Object.entries(obj)) {
resolvers[key] = async (parent, params, { cypherParams, driver }, resolveInfo) => {
resolvers[key] = async (parent, _params, { cypherParams, driver }, _resolveInfo) => {
if (typeof parent[key] !== 'undefined') return parent[key]
const id = parent[idAttribute]
const session = driver.session()
@ -73,7 +75,7 @@ export default function Resolver(type, options: any = {}) {
const countResolver = (obj) => {
const resolvers = {}
for (const [key, connection] of Object.entries(obj)) {
resolvers[key] = async (parent, params, { driver, cypherParams }, resolveInfo) => {
resolvers[key] = async (parent, _params, { driver, cypherParams }, _resolveInfo) => {
if (typeof parent[key] !== 'undefined') return parent[key]
const session = driver.session()
const readTxResultPromise = session.readTransaction(async (txc) => {

View File

@ -14,6 +14,7 @@ import { getDriver } from '@db/neo4j'
// const widths = [34, 160, 320, 640, 1024]
const { AWS_ENDPOINT: endpoint, AWS_REGION: region, AWS_BUCKET: Bucket, S3_CONFIGURED } = CONFIG
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export async function deleteImage(resource, relationshipType, opts: any = {}) {
sanitizeRelationshipType(relationshipType)
const { transaction, deleteCallback } = opts
@ -36,6 +37,7 @@ export async function deleteImage(resource, relationshipType, opts: any = {}) {
return image
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export async function mergeImage(resource, relationshipType, imageInput, opts: any = {}) {
if (typeof imageInput === 'undefined') return
if (imageInput === null) return deleteImage(resource, relationshipType, opts)

View File

@ -20,7 +20,7 @@ export default {
}),
},
Query: {
queryLocations: async (object, args, context, resolveInfo) => {
queryLocations: async (_object, args, _context, _resolveInfo) => {
try {
return queryLocations(args)
} catch (e) {

View File

@ -82,7 +82,7 @@ export default {
},
},
Mutation: {
markAsRead: async (parent, args, context, resolveInfo) => {
markAsRead: async (_parent, args, context, _resolveInfo) => {
const { user: currentUser } = context
const session = context.driver.session()
const writeTxResultPromise = session.writeTransaction(async (transaction) => {
@ -112,7 +112,7 @@ export default {
session.close()
}
},
markAllAsRead: async (parent, args, context, resolveInfo) => {
markAllAsRead: async (parent, args, context, _resolveInfo) => {
const { user: currentUser } = context
const session = context.driver.session()
const writeTxResultPromise = session.writeTransaction(async (transaction) => {

View File

@ -121,6 +121,7 @@ describe('passwordReset', () => {
})
describe('resetPassword', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const setup = async (options: any = {}) => {
const { email = 'user@example.org', issuedAt = new Date(), nonce = '12345' } = options
await createPasswordReset({ driver, email, issuedAt, nonce })

View File

@ -48,7 +48,7 @@ export default {
params = await filterForMutedUsers(params, context)
return neo4jgraphql(object, params, context, resolveInfo)
},
PostsEmotionsCountByEmotion: async (object, params, context, resolveInfo) => {
PostsEmotionsCountByEmotion: async (_object, params, context, _resolveInfo) => {
const { postId, data } = params
const session = context.driver.session()
const readTxResultPromise = session.readTransaction(async (transaction) => {
@ -70,7 +70,7 @@ export default {
session.close()
}
},
PostsEmotionsByCurrentUser: async (object, params, context, resolveInfo) => {
PostsEmotionsByCurrentUser: async (_object, params, context, _resolveInfo) => {
const { postId } = params
const session = context.driver.session()
const readTxResultPromise = session.readTransaction(async (transaction) => {
@ -242,7 +242,7 @@ export default {
}
},
DeletePost: async (object, args, context, resolveInfo) => {
DeletePost: async (_object, args, context, _resolveInfo) => {
const session = context.driver.session()
const writeTxResultPromise = session.writeTransaction(async (transaction) => {
const deletePostTransactionResponse = await transaction.run(
@ -269,7 +269,7 @@ export default {
session.close()
}
},
AddPostEmotions: async (object, params, context, resolveInfo) => {
AddPostEmotions: async (_object, params, context, _resolveInfo) => {
const { to, data } = params
const { user } = context
const session = context.driver.session()
@ -296,7 +296,7 @@ export default {
session.close()
}
},
RemovePostEmotions: async (object, params, context, resolveInfo) => {
RemovePostEmotions: async (_object, params, context, _resolveInfo) => {
const { to, data } = params
const { id: from } = context.user
const session = context.driver.session()
@ -499,7 +499,7 @@ export default {
'MATCH (this)<-[obs:OBSERVES]-(related:User {id: $cypherParams.currentUserId}) WHERE obs.active = true RETURN COUNT(related) >= 1',
},
}),
relatedContributions: async (parent, params, context, resolveInfo) => {
relatedContributions: async (parent, _params, context, _resolveInfo) => {
if (typeof parent.relatedContributions !== 'undefined') return parent.relatedContributions
const { id } = parent
const session = context.driver.session()

View File

@ -1,6 +1,6 @@
export default {
Query: {
availableRoles: async (_parent, args, context, _resolveInfo) => {
availableRoles: async (_parent, _args, _context, _resolveInfo) => {
return ['admin', 'moderator', 'user']
},
},

View File

@ -586,6 +586,7 @@ describe('Room', () => {
})
describe('query single room', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let result: any = null
beforeAll(async () => {

View File

@ -39,7 +39,7 @@ export default {
}
return neo4jgraphql(object, params, context, resolveInfo)
},
UnreadRooms: async (object, params, context, resolveInfo) => {
UnreadRooms: async (_object, _params, context, _resolveInfo) => {
const {
user: { id: currentUserId },
} = context

View File

@ -250,6 +250,7 @@ export default {
]
params.limit = 15
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const type: any = multiSearchMap.find((obj) => obj.symbol === searchType)
return getSearchResults(context, type.setup, params)
},

View File

@ -6,7 +6,7 @@ const neode = getNeode()
export default {
Mutation: {
CreateSocialMedia: async (object, params, context, resolveInfo) => {
CreateSocialMedia: async (_object, params, context, _resolveInfo) => {
const [user, socialMedia] = await Promise.all([
neode.find('User', context.user.id),
neode.create('SocialMedia', params),
@ -16,14 +16,14 @@ export default {
return response
},
UpdateSocialMedia: async (object, params, context, resolveInfo) => {
UpdateSocialMedia: async (_object, params, _context, _resolveInfo) => {
const socialMedia = await neode.find('SocialMedia', params.id)
await socialMedia.update({ url: params.url })
const response = await socialMedia.toJson()
return response
},
DeleteSocialMedia: async (object, { id }, context, resolveInfo) => {
DeleteSocialMedia: async (_object, { id }, _context, _resolveInfo) => {
const socialMedia = await neode.find('SocialMedia', id)
if (!socialMedia) return null
await socialMedia.delete()

View File

@ -5,6 +5,7 @@ export default {
Query: {
statistics: async (_parent, _args, { driver }) => {
const session = driver.session()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const counts: any = {}
try {
const mapping = {

View File

@ -1,6 +1,6 @@
export default {
Query: {
userData: async (object, args, context, resolveInfo) => {
userData: async (_object, _args, context, _resolveInfo) => {
const id = context.user.id
const cypher = `
MATCH (user:User { id: $id })

View File

@ -16,7 +16,7 @@ export default {
neo4jgraphql(object, { id: context.user.id }, context, resolveInfo),
},
Mutation: {
login: async (_, { email, password }, { driver, req, user }) => {
login: async (_, { email, password }, { driver }) => {
// if (user && user.id) {
// throw new Error('Already logged in.')
// }
@ -51,7 +51,7 @@ export default {
session.close()
}
},
changePassword: async (_, { oldPassword, newPassword }, { driver, user }) => {
changePassword: async (_, { oldPassword, newPassword }, { user }) => {
const currentUser = await neode.find('User', user.id)
const encryptedPassword = currentUser.get('encryptedPassword')

View File

@ -43,14 +43,14 @@ export const getBlockedUsers = async (context) => {
export default {
Query: {
mutedUsers: async (object, args, context, resolveInfo) => {
mutedUsers: async (_object, _args, context, _resolveInfo) => {
try {
return getMutedUsers(context)
} catch (e) {
throw new UserInputError(e.message)
}
},
blockedUsers: async (object, args, context, resolveInfo) => {
blockedUsers: async (_object, _args, context, _resolveInfo) => {
try {
return getBlockedUsers(context)
} catch (e) {
@ -111,7 +111,7 @@ export default {
const unmutedUser = await neode.find('User', params.id)
return unmutedUser.toJson()
},
blockUser: async (object, args, context, resolveInfo) => {
blockUser: async (_object, args, context, _resolveInfo) => {
const { user: currentUser } = context
if (currentUser.id === args.id) return null
@ -138,7 +138,7 @@ export default {
session.close()
}
},
unblockUser: async (object, args, context, resolveInfo) => {
unblockUser: async (_object, args, context, _resolveInfo) => {
const { user: currentUser } = context
if (currentUser.id === args.id) return null
@ -216,7 +216,7 @@ export default {
session.close()
}
},
DeleteUser: async (object, params, context, resolveInfo) => {
DeleteUser: async (_object, params, context, _resolveInfo) => {
const { resource, id: userId } = params
const session = context.driver.session()
@ -283,7 +283,7 @@ export default {
session.close()
}
},
switchUserRole: async (object, args, context, resolveInfo) => {
switchUserRole: async (_object, args, context, _resolveInfo) => {
const { role, id } = args
if (context.user.id === id) throw new Error('you-cannot-change-your-own-role')
@ -308,7 +308,7 @@ export default {
session.close()
}
},
saveCategorySettings: async (object, args, context, resolveInfo) => {
saveCategorySettings: async (_object, args, context, _resolveInfo) => {
const { activeCategories } = args
const {
user: { id },
@ -351,7 +351,7 @@ export default {
session.close()
}
},
updateOnlineStatus: async (object, args, context, resolveInfo) => {
updateOnlineStatus: async (_object, args, context, _resolveInfo) => {
const { status } = args
const {
user: { id },
@ -451,7 +451,7 @@ export default {
},
},
User: {
emailNotificationSettings: async (parent, params, context, resolveInfo) => {
emailNotificationSettings: async (parent, _params, _context, _resolveInfo) => {
return [
{
type: 'post',

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable promise/avoid-new */
/* eslint-disable promise/prefer-await-to-callbacks */
/* eslint-disable import/no-named-as-default */

View File

@ -60,6 +60,7 @@ describe('mutedUsers', () => {
it('throws permission error', async () => {
const { query } = createTestClient(server)
const result = await query({ query: mutedUserQuery })
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
expect(result.errors![0]).toHaveProperty('message', 'Not Authorized!')
})

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable import/no-named-as-default-member */
import http from 'node:http'
@ -68,7 +69,7 @@ const createServer = (options?) => {
context,
schema: middleware(schema),
subscriptions: {
onConnect: (connectionParams, webSocket) => {
onConnect: (connectionParams, _webSocket) => {
return getContext(connectionParams)
},
},