Skip to content

Commit

Permalink
fix all eslint warn that isnt about any
Browse files Browse the repository at this point in the history
  • Loading branch information
momentiris committed Sep 18, 2024
1 parent 38e174e commit a0ba78a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 150 deletions.
64 changes: 0 additions & 64 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import nodePlugin from 'eslint-plugin-n'
export default [
{ plugins: { n: nodePlugin } },
{ files: ['**/*.{js,mjs,cjs,ts}'] },
{ files: ['**/*.js'], languageOptions: { sourceType: 'commonjs' } },
{ languageOptions: { globals: globals.node } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
Expand Down Expand Up @@ -43,66 +42,3 @@ export default [
},
},
]

// export default [
// ...fixupConfigRules(
// compat.extends(
// 'eslint:recommended',
// 'plugin:@typescript-eslint/recommended',
// 'prettier',
// 'plugin:node/recommended'
// )
// ),
// {
// plugins: {
// '@typescript-eslint': fixupPluginRules(typescriptEslint),
// node: fixupPluginRules(node),
// },
// languageOptions: {
// globals: {
// ...globals.node,
// },
// parser: tsParser,
// ecmaVersion: 2020,
// sourceType: 'commonjs',
// parserOptions: {
// project: '**/tsconfig.json',
// },
// },
// settings: {
// node: {
// tryExtensions: ['.js', '.ts'],
// },
// },
// rules: {
// '@typescript-eslint/no-explicit-any': 'warn',
// 'node/no-unsupported-features/es-syntax': [
// 'error',
// {
// ignores: ['modules'],
// },
// ],
// '@typescript-eslint/no-unused-vars': [
// 'warn',
// {
// argsIgnorePattern: '^_',
// varsIgnorePattern: '^_',
// caughtErrorsIgnorePattern: '^_',
// },
// ],
// 'node/no-unpublished-import': [
// 'error',
// {
// allowModules: ['onecore-types'],
// },
// ],
// },
// },
// {
// files: ['src/**/*.test.ts'],
// rules: {
// 'node/no-unpublished-import': 0,
// },
// },
// ]

31 changes: 18 additions & 13 deletions src/scripts/expire-listings.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
/* eslint-disable no-process-exit */
import { getExpiredListings, updateListingStatuses } from '../services/lease-service/adapters/listing-adapter'
import {
getExpiredListings,
updateListingStatuses,
} from '../services/lease-service/adapters/listing-adapter'
import { ListingStatus } from 'onecore-types'

async function updateExpiredListings() {
const expiredListings = await getExpiredListings();
console.log('Expired listings: ', expiredListings);
if (expiredListings.length > 0) {
const expiredListingsIds = expiredListings.map(l => l.Id);
console.log(`Found ${expiredListingsIds} expired listings`);
const updateCount = await updateListingStatuses(expiredListingsIds, ListingStatus.Expired);
console.log(`Updated ${updateCount} expired listings`);
}
console.log('Expired listings updated successfully')
process.exit(0);
const expiredListings = await getExpiredListings()
console.log('Expired listings: ', expiredListings)
if (expiredListings.length > 0) {
const expiredListingsIds = expiredListings.map((l) => l.Id)
console.log(`Found ${expiredListingsIds} expired listings`)
const updateCount = await updateListingStatuses(
expiredListingsIds,
ListingStatus.Expired
)
console.log(`Updated ${updateCount} expired listings`)
}
console.log('Expired listings updated successfully')
process.exit(0)
}

updateExpiredListings();
updateExpiredListings()
1 change: 0 additions & 1 deletion src/services/lease-service/priority-list-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Sorting applicants based on rental rules
*/

const ok = 'ok'
import { logger } from 'onecore-utilities'
import {
DetailedApplicant,
Expand Down
56 changes: 1 addition & 55 deletions src/services/lease-service/tests/priority-list-service.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
jest.mock('onecore-utilities', () => {
return {
logger: {
info: () => {
return
},
error: () => {
return
},
},
}
})

import { Contact, Lease, LeaseStatus, WaitingList } from 'onecore-types'
import { Lease, LeaseStatus, WaitingList } from 'onecore-types'
import {
addPriorityToApplicantsBasedOnRentalRules,
assignPriorityToApplicantBasedOnRentalRules,
Expand All @@ -21,8 +8,6 @@ import {
parseWaitingListForInternalParkingSpace,
sortApplicantsBasedOnRentalRules,
} from '../priority-list-service'
import * as tenantLeaseAdapter from '../adapters/xpand/tenant-lease-adapter'
import * as xpandSoapAdapter from '../adapters/xpand/xpand-soap-adapter'
import * as factory from './factories'
import { leaseTypes } from '../../../constants/leaseTypes'

Expand Down Expand Up @@ -66,45 +51,6 @@ const thirtyDaysInTheFutureDate = new Date()
thirtyDaysInThePastDate.setDate(currentDate.getDate() + 30)
thirtyDaysInTheFutureDate.setDate(currentDate.getDate() + 30)

const contactCodeForApplicantInxpand = 'P145241'

const mockedApplicantFromXpand: Contact = {
contactCode: contactCodeForApplicantInxpand,
contactKey: '_5YI0VPRJ5GARYV',
firstName: 'Fiktiv',
lastName: 'Sökande',
fullName: 'Sökande Fiktiv',
leaseIds: [
'000-000-00-0001/03M2',
'209-004-02-0201/12M',
'105-001-17-0102/03M2',
'105-002-07-0202/10M2',
'306-001-01-0101/07',
],
nationalRegistrationNumber: '198912157982',
birthDate: new Date('1989-12-15T00:00:00.000Z'),
address: {
number: '',
street: 'Fiktiggatan 1',
postalCode: '72222',
city: 'VÄSTERÅS',
},
phoneNumbers: [
{
phoneNumber: '0704657064',
type: 'mobil',
isMainNumber: true,
},
{
phoneNumber: '021-13333 ',
type: 'telarbete ',
isMainNumber: false,
},
],
emailAddress: 'redacted',
isTenant: true,
}

describe('parseWaitingList', () => {
it('should return waitingList for internal parking space', async () => {
const result = parseWaitingListForInternalParkingSpace(
Expand Down
17 changes: 0 additions & 17 deletions src/services/lease-service/tests/routes/offers.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
import { DetailedOfferFactory } from '../factories/offer'

jest.mock('onecore-utilities', () => {
return {
logger: {
info: () => {
return
},
error: () => {
return
},
},
generateRouteMetadata: jest.fn(() => ({})),
}
})

import request from 'supertest'
import Koa from 'koa'
import KoaRouter from '@koa/router'
Expand All @@ -23,7 +7,6 @@ import { OfferStatus } from 'onecore-types'
import { routes } from '../../routes/offers'
import * as offerAdapter from '../../adapters/offer-adapter'
import * as factory from '../factories'
import { detailedOffer } from '../factories'

const app = new Koa()
const router = new KoaRouter()
Expand Down

0 comments on commit a0ba78a

Please sign in to comment.