Skip to content

Commit 30af3ef

Browse files
committed
chore: use @kth/eslint-config-kth linting
1 parent 22b52ae commit 30af3ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+424
-448
lines changed

.eslintrc

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
11
{
2-
"parser": "babel-eslint",
3-
"env": {
4-
"node": true,
5-
"browser": true,
6-
"jest/globals": true,
7-
"cypress/globals": true
8-
},
9-
"extends": ["@kth/eslint-config-kth", "prettier", "plugin:cypress/recommended"],
10-
"plugins": ["prettier", "jest"],
11-
"rules": {
12-
"import/newline-after-import": ["error", { "count": 1 }],
13-
"semi": ["error", "never"],
14-
"import/order": "off",
15-
"quotes": [1, "single", "avoid-escape"],
16-
"array-callback-return": "off",
17-
"react/no-access-state-in-setstate": "off"
18-
}
2+
"extends": ["@kth/eslint-config-kth", "plugin:cypress/recommended"]
193
}

app.js

+32-32
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
'use strict'
2-
3-
require('dotenv').config()
4-
5-
const config = require('./server/configuration').server
6-
const server = require('./server/server')
7-
const log = require('kth-node-log')
8-
9-
const packageFile = require('./package.json')
10-
11-
// catches uncaught exceptions
12-
process.on('uncaughtException', err => {
13-
log.error('APPLICATION EXIT - uncaught exception in ', packageFile.name)
14-
log.error('Uncaught Exception', { err })
15-
process.exit(1)
16-
})
17-
18-
/* ****************************
19-
* ******* SERVER START *******
20-
* ****************************
21-
*/
22-
// Exports a promise to use in integration tests
23-
module.exports = server.start({
24-
useSsl: config.useSsl,
25-
pfx: config.ssl.pfx,
26-
passphrase: config.ssl.passphrase,
27-
key: config.ssl.key,
28-
ca: config.ssl.ca,
29-
cert: config.ssl.cert,
30-
port: config.port,
31-
logger: log
32-
})
1+
'use strict'
2+
3+
require('dotenv').config()
4+
5+
const log = require('kth-node-log')
6+
const config = require('./server/configuration').server
7+
const server = require('./server/server')
8+
9+
const packageFile = require('./package.json')
10+
11+
// catches uncaught exceptions
12+
process.on('uncaughtException', err => {
13+
log.error('APPLICATION EXIT - uncaught exception in ', packageFile.name)
14+
log.error('Uncaught Exception', { err })
15+
process.exit(1)
16+
})
17+
18+
/* ****************************
19+
* ******* SERVER START *******
20+
* ****************************
21+
*/
22+
// Exports a promise to use in integration tests
23+
module.exports = server.start({
24+
useSsl: config.useSsl,
25+
pfx: config.ssl.pfx,
26+
passphrase: config.ssl.passphrase,
27+
key: config.ssl.key,
28+
ca: config.ssl.ca,
29+
cert: config.ssl.cert,
30+
port: config.port,
31+
logger: log,
32+
})

babel.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
module.exports = {
33
env: {
44
test: {
5-
presets: ['@babel/preset-env']
6-
}
7-
}
5+
presets: ['@babel/preset-env'],
6+
},
7+
},
88
}

config/commonSettings.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ const devMemoStorageUri = 'https://kursinfostoragestage.blob.core.windows.net/me
1616
module.exports = {
1717
// The proxy prefix path if the application is proxied. E.g /places
1818
proxyPrefixPath: {
19-
uri: getEnv('SERVICE_PUBLISH', devPrefixPath)
19+
uri: getEnv('SERVICE_PUBLISH', devPrefixPath),
2020
},
2121
imageStorageUri: getEnv('IMAGE_STORAGE_URI', devImageStorageUri),
22-
memoStorageUri: getEnv('MEMO_STORAGE_URI', devMemoStorageUri)
22+
memoStorageUri: getEnv('MEMO_STORAGE_URI', devMemoStorageUri),
2323
}

config/serverSettings.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const {
1212
devDefaults,
1313
unpackRedisConfig,
1414
unpackNodeApiConfig,
15-
unpackKOPPSConfig
15+
unpackKOPPSConfig,
1616
} = require('kth-node-configuration')
1717

1818
// DEFAULT SETTINGS used for dev, if you want to override these for you local environment, use env-vars in .env
@@ -35,46 +35,46 @@ module.exports = {
3535
ssl: {
3636
// In development we don't have SSL feature enabled
3737
pfx: getEnv('SERVER_CERT_FILE', ''),
38-
passphrase: getEnv('SERVER_CERT_PASSPHRASE', '')
38+
passphrase: getEnv('SERVER_CERT_PASSPHRASE', ''),
3939
},
4040

4141
// API keys
4242
apiKey: {
4343
kursPmDataApi: getEnv('KURS_PM_DATA_API_KEY', devDefaults('1234')),
4444
kursInfoApi: getEnv('KURS_INFO_API_KEY', devDefaults('1234')),
45-
kursplanApi: getEnv('KURSPLAN_API_KEY', devDefaults('5678'))
45+
kursplanApi: getEnv('KURSPLAN_API_KEY', devDefaults('5678')),
4646
},
4747

4848
// Service API's
4949
nodeApi: {
5050
kursPmDataApi: unpackNodeApiConfig('KURS_PM_DATA_API_URI', devKursPmDataApi),
5151
kursInfoApi: unpackNodeApiConfig('KURS_INFO_API_URI', devKursInfoApi),
52-
kursplanApi: unpackNodeApiConfig('KURSPLAN_API_URI', devKursplanApi)
52+
kursplanApi: unpackNodeApiConfig('KURSPLAN_API_URI', devKursplanApi),
5353
},
5454

5555
koppsApi: unpackKOPPSConfig('KOPPS_URI', devKoppsApi),
5656

5757
// Cortina
5858
blockApi: {
59-
blockUrl: getEnv('CM_HOST_URL', devDefaults('https://www-r.referens.sys.kth.se/cm/')) // Block API base URL
59+
blockUrl: getEnv('CM_HOST_URL', devDefaults('https://www-r.referens.sys.kth.se/cm/')), // Block API base URL
6060
},
6161

6262
// Logging
6363
logging: {
6464
log: {
65-
level: getEnv('LOGGING_LEVEL', 'debug')
65+
level: getEnv('LOGGING_LEVEL', 'debug'),
6666
},
6767
accessLog: {
68-
useAccessLog: getEnv('LOGGING_ACCESS_LOG', true)
69-
}
68+
useAccessLog: getEnv('LOGGING_ACCESS_LOG', true),
69+
},
7070
},
7171
clientLogging: {
72-
level: 'debug'
72+
level: 'debug',
7373
},
7474
cache: {
7575
cortinaBlock: {
76-
redis: unpackRedisConfig('REDIS_URI', devRedis)
77-
}
76+
redis: unpackRedisConfig('REDIS_URI', devRedis),
77+
},
7878
},
7979

8080
// Session
@@ -87,15 +87,15 @@ module.exports = {
8787
cookie: {
8888
secure: String(getEnv('SESSION_SECURE_COOKIE', false)).toLowerCase() === 'true',
8989
path: getEnv('SERVICE_PUBLISH', '/kurs-pm'),
90-
sameSite: getEnv('SESSION_SAME_SITE_COOKIE', 'Lax')
90+
sameSite: getEnv('SESSION_SAME_SITE_COOKIE', 'Lax'),
9191
},
92-
proxy: String(getEnv('SESSION_TRUST_PROXY', true)).toLowerCase() === 'true'
92+
proxy: String(getEnv('SESSION_TRUST_PROXY', true)).toLowerCase() === 'true',
9393
},
94-
redisOptions: unpackRedisConfig('REDIS_URI', devRedis)
94+
redisOptions: unpackRedisConfig('REDIS_URI', devRedis),
9595
},
9696

9797
// APPLICATION INSIGHTS IN AZURE
9898
appInsights: {
99-
instrumentationKey: getEnv('APPINSIGHTS_INSTRUMENTATIONKEY', '')
100-
}
99+
instrumentationKey: getEnv('APPINSIGHTS_INSTRUMENTATIONKEY', ''),
100+
},
101101
}

config/version.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ module.exports = {
99
jenkinsBuild: 'NOT SET BY JENKINS',
1010
jenkinsBuildDate: 'NOT SET BY JENKINS',
1111
dockerName: 'NOT SET BY JENKINS',
12-
dockerVersion: 'NOT SET BY JENKINS'
12+
dockerVersion: 'NOT SET BY JENKINS',
1313
}

i18n/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict'
2+
23
/**
34
* Extension of the i18n module that depends on the server configuration
45
* and is therefore not consumable by the server.

i18n/messages.en.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ module.exports = {
7676
Technology: 'Teknik',
7777
'Engineering and Management': 'Teknik och management',
7878
'Technology and Learning': 'Teknik och lärande',
79-
default: 'default'
79+
default: 'default',
8080
},
8181

8282
courseImage: {
@@ -105,13 +105,13 @@ module.exports = {
105105
Technology: 'Picture_by_MainFieldOfStudy_23_Technology.jpg',
106106
'Engineering and Management': 'Picture_by_MainFieldOfStudy_24_Engineering_Management.jpg',
107107
'Technology and Learning': 'Picture_by_MainFieldOfStudy_25_Technology_Learning.jpg',
108-
default: 'Picture_by_MainFieldOfStudy_26_Default_picture.jpg'
108+
default: 'Picture_by_MainFieldOfStudy_26_Default_picture.jpg',
109109
},
110110

111111
courseHeaderTitle: 'Course Memo',
112112
courseInformationTitle: 'Information',
113113

114-
adminLinkLabel: 'Administrate About course'
114+
adminLinkLabel: 'Administrate About course',
115115
},
116116
sideMenuLabels: {
117117
directory: 'Course and programme directory',
@@ -122,13 +122,13 @@ module.exports = {
122122
finishCourse: 'Finish course',
123123
courseDevelopment: 'Course development',
124124
archive: 'Archive',
125-
subMenuAriaLabel: 'Sub menu'
125+
subMenuAriaLabel: 'Sub menu',
126126
},
127127
courseLinksLabels: {
128128
linkHeaderTitle: 'Student at KTH',
129129
beforeAndDuringACourse: 'Before and during a course',
130130
contactPersonsAndStudentCounselling: 'Contact persons and student counselling',
131-
rightsAndResponsibilities: 'Rights and responsibilities'
131+
rightsAndResponsibilities: 'Rights and responsibilities',
132132
},
133133
coverPageLabels: {
134134
roundsTitle: 'Course offering',
@@ -138,14 +138,14 @@ module.exports = {
138138
syllabusLinkStart: 'Syllabus ',
139139
syllabusLinkMiddle: '(',
140140
syllabusLinkEnd: ')',
141-
memoSource: 'Printed from page'
141+
memoSource: 'Printed from page',
142142
},
143143
courseFactsLabels: {
144144
roundFacts: 'Round Facts',
145145
offeredByTitle: 'Offered By',
146146
languageOfInstructionTitle: 'Language Of Instruction',
147147
roundsTitle: 'Course offering',
148-
mandatoryFieldMissing: 'Missing mandatory information'
148+
mandatoryFieldMissing: 'Missing mandatory information',
149149
},
150150
courseMemoLinksLabels: {
151151
documents: 'Documents',
@@ -161,7 +161,7 @@ module.exports = {
161161
mandatoryFieldMissing: 'Missing mandatory information',
162162
inDevelopment: 'In development',
163163
printDialog: 'Print or save course memo',
164-
version: 'Ver'
164+
version: 'Ver',
165165
},
166166
courseContactsLabels: {
167167
courseContactsTitle: 'Contacts',
@@ -171,24 +171,24 @@ module.exports = {
171171
teacherAssistantsTitle: 'Teacher Assistants',
172172
examinerTitle: 'Examiner',
173173
otherContactsTitle: 'Other Contacts',
174-
infoContactName: 'Course Contact'
174+
infoContactName: 'Course Contact',
175175
},
176176
extraInfo: {
177177
season: {
178178
1: 'Spring ',
179-
2: 'Autumn '
180-
}
179+
2: 'Autumn ',
180+
},
181181
},
182182
sourceInfo: {
183183
noInfoYet: 'No information inserted',
184-
insertedSubSection: '(Section below is not part of the syllabus)'
184+
insertedSubSection: '(Section below is not part of the syllabus)',
185185
},
186186
sectionsLabels: {
187187
contentAndOutcomes: 'Content and learning outcomes',
188188
prep: 'Preparations before course start',
189189
reqToFinal: 'Examination and completion',
190190
extra: 'Further information',
191-
contacts: 'Contact'
191+
contacts: 'Contact',
192192
},
193193
memoTitlesByMemoLang: {
194194
additionalRegulations: 'Additional regulations',
@@ -224,7 +224,7 @@ module.exports = {
224224
scheduleDetails: 'Detailed plan',
225225
software: 'Software',
226226
teacher: 'Teacher',
227-
teacherAssistants: 'Teacher assistants'
227+
teacherAssistants: 'Teacher assistants',
228228
},
229229
courseHeaderLabels: {
230230
adminLinkLabel: 'Administrate About course',
@@ -234,12 +234,12 @@ module.exports = {
234234
latestVersionLabel: '(latest version)',
235235
aboutCourseMemo: 'Course memo',
236236
linkOpensInNewTab: 'Link will open in new tab',
237-
mandatoryFieldMissing: 'Missing mandatory information'
237+
mandatoryFieldMissing: 'Missing mandatory information',
238238
},
239239
aboutHeaderLabels: {
240240
memoLabel: 'Course memo',
241241
adminLinkLabel: 'Administrate About course',
242-
linkOpensInNewTab: 'Link will open in new tab'
242+
linkOpensInNewTab: 'Link will open in new tab',
243243
},
244244
aboutMemoLabels: {
245245
notPublished: 'hasn’t been published',
@@ -257,9 +257,9 @@ module.exports = {
257257
onPage: 'is available on',
258258
syllabusLink: 'Before choosing course (syllabus)',
259259
currentOfferings: 'Course offerings starting',
260-
previousOfferings: 'Previous course offerings'
260+
previousOfferings: 'Previous course offerings',
261261
},
262262
coursePresentationLabels: {
263-
coursePresentation: 'Course presentation'
264-
}
263+
coursePresentation: 'Course presentation',
264+
},
265265
}

0 commit comments

Comments
 (0)