Skip to content

Commit

Permalink
chore: upgrade contentful's eslint to 6.x
Browse files Browse the repository at this point in the history
move dev dependencies to root folder
  • Loading branch information
dpinol committed Feb 19, 2020
1 parent 647b5a0 commit 7b8777e
Show file tree
Hide file tree
Showing 11 changed files with 1,706 additions and 9,178 deletions.
5 changes: 1 addition & 4 deletions packages/botonic-plugin-contentful/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ module.exports = {
// special for TYPESCRIPT
"@typescript-eslint/explicit-function-return-type": "off", // annoying for tests
"@typescript-eslint/explicit-member-accessibility": "off", //we think defaulting to public is a good default
"@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/no-namespace": ["error", { allowDeclarations: true }], // to encapsulate types in namespace with same name as Class
"@typescript-eslint/no-non-null-assertion" : "warn", // specially useful in tests, and "when you know what you're doing"
"@typescript-eslint/no-object-literal-type-assertion" : [ "error", {allowAsParameter: false}], //useful to pass options to plugins
"@typescript-eslint/no-parameter-properties": "off", // opinionated: parameter properties make data classes shorter
// allow public functions/classes to call private functions/classes declared below.
// otoh, variables (typically constants) should be declared at the top
Expand All @@ -63,9 +63,6 @@ module.exports = {
"files": [
"tests/**/*.ts" // to be able to skip required fields when not used in a particular test
],
"rules": {
"@typescript-eslint/no-object-literal-type-assertion" : "off",
}
}
],
env: {
Expand Down
10,824 changes: 1,684 additions & 9,140 deletions packages/botonic-plugin-contentful/package-lock.json

Large diffs are not rendered by default.

24 changes: 4 additions & 20 deletions packages/botonic-plugin-contentful/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"scripts": {
"build": "rm -rf lib && tsc",
"build_with_tests": "tsc -b tests/tsconfig.json",
"test": "jest",
"test": "../../node_modules/.bin/jest",
"lint": "npm run lint_core -- --fix",
"lint_ci": "npm run lint_core -- -c .eslintrc_slow.js",
"lint_core": "node_modules/.bin/eslint_d --cache --quiet 'src/**/*.ts*' 'tests/**/*.ts*'",
"prepare": "npm run build",
"prepare": "node ../../preinstall.js",
"prepublishOnly": "npm test && npm run lint",
"preversion": "npm run lint",
"version": "git add -A src tests",
Expand All @@ -32,27 +32,11 @@
"node-nlp": "^4.0.2"
},
"devDependencies": {
"@types/jest": "^25.1.0",
"@types/jest-each": "^24.3.0",
"@types/memoizee": "^0.4.3",
"@types/moment-timezone": "^0.5.12",
"@types/node": "^13.1.6",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0",
"eslint": "^5.16.0",
"eslint-config-prettier": "^5.1.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-jest": "^23.1.1",
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-prettier": "^3.1.1",
"eslint_d": "^8.0.0",
"@types/node": "^13.7.2",
"identity-obj-proxy": "^3.0.0",
"jest": "^25.1.0",
"jest-extended": "^0.11.4",
"prettier": "^1.19.1",
"ts-jest": "^25.0.0",
"ts-mockito": "^2.5.0",
"typescript": "^3.7.5"
"jest-extended": "^0.11.4"
},
"engines": {
"node": ">=12.0.0"
Expand Down
6 changes: 2 additions & 4 deletions packages/botonic-plugin-contentful/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ export default class BotonicPluginContentful {
}
}

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

// @ts-ignore
post({ input, session, lastRoutePath, response }) {}
post(r: { input: any; session: any; lastRoutePath: any; response: any }) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ export interface BotonicText extends BotonicMsg {
export class BotonicMsgConverter {
constructor(readonly options = new RenderOptions()) {}

carousel(carousel: cms.Carousel, delayS: number = 0): BotonicMsgs {
// eslint-disable-next-line @typescript-eslint/no-object-literal-type-assertion
carousel(carousel: cms.Carousel, delayS = 0): BotonicMsgs {
return {
type: 'carousel',
delay: delayS,
Expand Down Expand Up @@ -69,7 +68,7 @@ export class BotonicMsgConverter {
})
}

text(text: cms.Text, delayS: number = 0): BotonicMsgs {
text(text: cms.Text, delayS = 0): BotonicMsgs {
const msg: any = {
type: 'text',
delay: delayS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class SearchByKeywords {
const results = kws.findCandidatesWithKeywordsAt(inputText)
return results.map(res => {
const candidate = res.candidate as SearchResult
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
candidate.match = res.match
return candidate
Expand Down
2 changes: 1 addition & 1 deletion packages/botonic-plugin-contentful/src/time/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class Schedule {
this.zone = zone
}

createHourAndMinute(hour: number, minute: number = 0): HourAndMinute {
createHourAndMinute(hour: number, minute = 0): HourAndMinute {
return new HourAndMinute(this.zone, hour, minute)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ function europeDate(
year: number,
month: number,
day: number,
hour: number = 0,
minute: number = 0
hour = 0,
minute = 0
): Date {
const date = new Date(Date.UTC(year, month, day, hour, minute, 0))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ function europeDate(
year: number,
month: number,
day: number,
hour: number = 0,
minute: number = 0
hour = 0,
minute = 0
): Date {
const date = new Date(Date.UTC(year, month, day, hour, minute, 0))

Expand Down
8 changes: 7 additions & 1 deletion packages/botonic-plugin-contentful/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noUnusedLocals": true
}
},
// test options
"types": [
// @types/node must be a direct dependency. If only defined in a parent package.json, we get TSC errors for
// symbols from these libs: "ES2016.Array.Include", "ES2017.object"
"@types/jest"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ test('TEST: ErrorReportingCMS write rejected', async (done: DoneCallback) => {
expect(trackException.reason).toBe(error)
done()
})

})

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

0 comments on commit 7b8777e

Please sign in to comment.