Skip to content

Commit f4793cb

Browse files
committed
chore: upgrade contentful's eslint to 6.x
move dev dependencies to root folder
1 parent 647b5a0 commit f4793cb

File tree

11 files changed

+1705
-9177
lines changed

11 files changed

+1705
-9177
lines changed

packages/botonic-plugin-contentful/.eslintrc.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ module.exports = {
4343
// special for TYPESCRIPT
4444
"@typescript-eslint/explicit-function-return-type": "off", // annoying for tests
4545
"@typescript-eslint/explicit-member-accessibility": "off", //we think defaulting to public is a good default
46+
"@typescript-eslint/no-empty-function": "warn",
4647
"@typescript-eslint/no-namespace": ["error", { allowDeclarations: true }], // to encapsulate types in namespace with same name as Class
4748
"@typescript-eslint/no-non-null-assertion" : "warn", // specially useful in tests, and "when you know what you're doing"
48-
"@typescript-eslint/no-object-literal-type-assertion" : [ "error", {allowAsParameter: false}], //useful to pass options to plugins
4949
"@typescript-eslint/no-parameter-properties": "off", // opinionated: parameter properties make data classes shorter
5050
// allow public functions/classes to call private functions/classes declared below.
5151
// otoh, variables (typically constants) should be declared at the top
@@ -63,9 +63,6 @@ module.exports = {
6363
"files": [
6464
"tests/**/*.ts" // to be able to skip required fields when not used in a particular test
6565
],
66-
"rules": {
67-
"@typescript-eslint/no-object-literal-type-assertion" : "off",
68-
}
6966
}
7067
],
7168
env: {

packages/botonic-plugin-contentful/package-lock.json

Lines changed: 1684 additions & 9140 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/botonic-plugin-contentful/package.json

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"scripts": {
33
"build": "rm -rf lib && tsc",
44
"build_with_tests": "tsc -b tests/tsconfig.json",
5-
"test": "jest",
5+
"test": "../../node_modules/.bin/jest",
66
"lint": "npm run lint_core -- --fix",
77
"lint_ci": "npm run lint_core -- -c .eslintrc_slow.js",
88
"lint_core": "node_modules/.bin/eslint_d --cache --quiet 'src/**/*.ts*' 'tests/**/*.ts*'",
@@ -32,27 +32,11 @@
3232
"node-nlp": "^4.0.2"
3333
},
3434
"devDependencies": {
35-
"@types/jest": "^25.1.0",
36-
"@types/jest-each": "^24.3.0",
3735
"@types/memoizee": "^0.4.3",
3836
"@types/moment-timezone": "^0.5.12",
39-
"@types/node": "^13.1.6",
40-
"@typescript-eslint/eslint-plugin": "^1.13.0",
41-
"@typescript-eslint/parser": "^1.13.0",
42-
"eslint": "^5.16.0",
43-
"eslint-config-prettier": "^5.1.0",
44-
"eslint-plugin-filenames": "^1.3.2",
45-
"eslint-plugin-jest": "^23.1.1",
46-
"eslint-plugin-no-null": "^1.0.2",
47-
"eslint-plugin-prettier": "^3.1.1",
48-
"eslint_d": "^8.0.0",
37+
"@types/node": "^13.7.2",
4938
"identity-obj-proxy": "^3.0.0",
50-
"jest": "^25.1.0",
51-
"jest-extended": "^0.11.4",
52-
"prettier": "^1.19.1",
53-
"ts-jest": "^25.0.0",
54-
"ts-mockito": "^2.5.0",
55-
"typescript": "^3.7.5"
39+
"jest-extended": "^0.11.4"
5640
},
5741
"engines": {
5842
"node": ">=12.0.0"

packages/botonic-plugin-contentful/src/plugin.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ export default class BotonicPluginContentful {
6666
}
6767
}
6868

69-
// @ts-ignore
70-
pre({ input, session, lastRoutePath }) {}
69+
pre(r: { input: any; session: any; lastRoutePath: any }) {}
7170

72-
// @ts-ignore
73-
post({ input, session, lastRoutePath, response }) {}
71+
post(r: { input: any; session: any; lastRoutePath: any; response: any }) {}
7472
}

packages/botonic-plugin-contentful/src/render/botonic-converter.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ export interface BotonicText extends BotonicMsg {
2626
export class BotonicMsgConverter {
2727
constructor(readonly options = new RenderOptions()) {}
2828

29-
carousel(carousel: cms.Carousel, delayS: number = 0): BotonicMsgs {
30-
// eslint-disable-next-line @typescript-eslint/no-object-literal-type-assertion
29+
carousel(carousel: cms.Carousel, delayS = 0): BotonicMsgs {
3130
return {
3231
type: 'carousel',
3332
delay: delayS,
@@ -69,7 +68,7 @@ export class BotonicMsgConverter {
6968
})
7069
}
7170

72-
text(text: cms.Text, delayS: number = 0): BotonicMsgs {
71+
text(text: cms.Text, delayS = 0): BotonicMsgs {
7372
const msg: any = {
7473
type: 'text',
7574
delay: delayS,

packages/botonic-plugin-contentful/src/search/search-by-keywords.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export class SearchByKeywords {
3636
const results = kws.findCandidatesWithKeywordsAt(inputText)
3737
return results.map(res => {
3838
const candidate = res.candidate as SearchResult
39+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
3940
// @ts-ignore
4041
candidate.match = res.match
4142
return candidate

packages/botonic-plugin-contentful/src/time/schedule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class Schedule {
2121
this.zone = zone
2222
}
2323

24-
createHourAndMinute(hour: number, minute: number = 0): HourAndMinute {
24+
createHourAndMinute(hour: number, minute = 0): HourAndMinute {
2525
return new HourAndMinute(this.zone, hour, minute)
2626
}
2727

packages/botonic-plugin-contentful/tests/contentful/date-range.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ function europeDate(
66
year: number,
77
month: number,
88
day: number,
9-
hour: number = 0,
10-
minute: number = 0
9+
hour = 0,
10+
minute = 0
1111
): Date {
1212
const date = new Date(Date.UTC(year, month, day, hour, minute, 0))
1313

packages/botonic-plugin-contentful/tests/time/schedule.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ function europeDate(
2121
year: number,
2222
month: number,
2323
day: number,
24-
hour: number = 0,
25-
minute: number = 0
24+
hour = 0,
25+
minute = 0
2626
): Date {
2727
const date = new Date(Date.UTC(year, month, day, hour, minute, 0))
2828

packages/botonic-plugin-contentful/tsconfig.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,11 @@
3232
"forceConsistentCasingInFileNames": true,
3333
"noImplicitReturns": true,
3434
"noUnusedLocals": true
35-
}
35+
},
36+
// test options
37+
"types": [
38+
// @types/node must be a direct dependency. If only defined in a parent package.json, we get TSC errors for
39+
// symbols from these libs: "ES2016.Array.Include", "ES2017.object"
40+
"@types/jest"
41+
]
3642
}

packages/botonic-plugin-dynamodb/tests/domain/track.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ test('TEST: ErrorReportingCMS write rejected', async (done: DoneCallback) => {
2727
expect(trackException.reason).toBe(error)
2828
done()
2929
})
30-
3130
})
3231

3332
test('TEST: ErrorReportingCMS write success', async () => {

0 commit comments

Comments
 (0)