Skip to content

Commit bc614e7

Browse files
committed
upgrade prettier + misc dangling TS issues
1 parent 3cee6a0 commit bc614e7

File tree

7 files changed

+22
-26
lines changed

7 files changed

+22
-26
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"git add"
3535
],
3636
"*.@(ts|tsx)": [
37-
"eslint --fix",
37+
"yarn lint:fix",
3838
"yarn prettier --write",
3939
"git add"
4040
]
@@ -131,7 +131,7 @@
131131
"madge": "^3.2.0",
132132
"nock": "^10.0.6",
133133
"pkg": "^4.4.2",
134-
"prettier": "^1.14.2",
134+
"prettier": "^2.5.1",
135135
"release-it": "^13.5.2",
136136
"shx": "^0.3.2",
137137
"ts-jest": "^24.0.2",

scripts/create-danger-dts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if (allDiagnostics.length) {
2424
console.log(
2525
"\nIf you've added something new to the DSL, and the errors are about something missing, you may need to add an interface in `source/dsl/*`."
2626
)
27-
allDiagnostics.forEach(diagnostic => {
27+
allDiagnostics.forEach((diagnostic) => {
2828
if (diagnostic.file) {
2929
let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!)
3030
let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")

scripts/danger-dts.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import * as fs from "fs"
22
import * as prettier from "prettier"
33

4-
const mapLines = (s: string, func: (s: string) => string) =>
5-
s
6-
.split("\n")
7-
.map(func)
8-
.join("\n")
4+
const mapLines = (s: string, func: (s: string) => string) => s.split("\n").map(func).join("\n")
95

106
const createDTS = () => {
117
const header = `//
@@ -23,10 +19,10 @@ import { File } from "parse-diff"
2319

2420
const dslFiles = fs
2521
.readdirSync("source/dsl")
26-
.filter(f => !f.startsWith("_tests"))
27-
.map(f => `source/dsl/${f}`)
22+
.filter((f) => !f.startsWith("_tests"))
23+
.map((f) => `source/dsl/${f}`)
2824

29-
dslFiles.forEach(file => {
25+
dslFiles.forEach((file) => {
3026
// Sometimes they have more stuff, in those cases
3127
// offer a way to crop the file.
3228
const content = fs.readFileSync(file).toString()
@@ -72,7 +68,7 @@ import { File } from "parse-diff"
7268
const chainDefs = fs.readFileSync("distribution/commands/utils/chainsmoker.d.ts", "utf8")
7369
const chainDefsMinusDefaultExport = chainDefs
7470
.split("\n")
75-
.filter(line => {
71+
.filter((line) => {
7672
return !line.startsWith("export default function")
7773
})
7874
.join("\n")
@@ -82,10 +78,10 @@ import { File } from "parse-diff"
8278
// Remove all JS-y bits
8379
fileOutput = fileOutput
8480
.split("\n")
85-
.filter(line => {
81+
.filter((line) => {
8682
return !line.startsWith("import") && !line.includes("* @type ")
8783
})
88-
.filter(line => {
84+
.filter((line) => {
8985
return !line.includes("Please don't have")
9086
})
9187
.join("\n")
@@ -94,7 +90,7 @@ import { File } from "parse-diff"
9490
const noRedundantExports = trimmedWhitespaceLines
9591
.replace(/export interface/g, "interface")
9692
.replace(/export type/g, "type")
97-
const indentedBody = mapLines(noRedundantExports, line => (line.length ? line : ""))
93+
const indentedBody = mapLines(noRedundantExports, (line) => (line.length ? line : ""))
9894

9995
const def = header + indentedBody + footer
10096

source/platforms/git/localLogGitCommits.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const fieldMap = {
1717
export type GitLogOptions = {
1818
number: number
1919
branch: string
20-
fields: Array<Partial<keyof typeof fieldMap>>
20+
fields: ReadonlyArray<Partial<keyof typeof fieldMap>>
2121
}
2222

2323
export type GitLogCommit = {
@@ -44,7 +44,7 @@ const createCommandArguments = (options: GitLogOptions) => {
4444

4545
// Iterating through the fields and adding them to the custom format
4646
if (options.fields) {
47-
options.fields.forEach(field => {
47+
options.fields.forEach((field) => {
4848
prettyArgument += delimiter + fieldMap[field]
4949
})
5050
}
@@ -61,8 +61,8 @@ const createCommandArguments = (options: GitLogOptions) => {
6161
return command
6262
}
6363

64-
const parseCommits = (commits: string[], fields: string[]) =>
65-
commits.map(rawCommit => {
64+
const parseCommits = (commits: readonly string[], fields: readonly string[]) =>
65+
commits.map((rawCommit) => {
6666
const parts = rawCommit.split("@end@")
6767
const commit = parts[0].split(delimiter)
6868

source/platforms/gitlab/GitLabAPI.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ class GitLabAPI {
161161
const api = this.api.MergeRequestDiscussions
162162

163163
try {
164-
const result: string = await api.create(this.repoMetadata.repoSlug, this.repoMetadata.pullRequestID, content, {
164+
const result = await api.create(this.repoMetadata.repoSlug, this.repoMetadata.pullRequestID, content, {
165165
position: position,
166166
})
167167
this.d("createMergeRequestDiscussion", result)
168-
return result
168+
return result as unknown as string // not sure why?
169169
} catch (e) {
170170
this.d("createMergeRequestDiscussion", e)
171171
throw e

tsconfig.spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "./tsconfig.json",
3-
"exclude": ["scripts", "node_modules", "distribution", "types"]
3+
"exclude": ["node_modules", "distribution", "types"]
44
}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7538,10 +7538,10 @@ prepend-http@^2.0.0:
75387538
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
75397539
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=
75407540

7541-
prettier@^1.14.2:
7542-
version "1.14.3"
7543-
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895"
7544-
integrity sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg==
7541+
prettier@^2.5.1:
7542+
version "2.5.1"
7543+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.5.1.tgz#fff75fa9d519c54cf0fce328c1017d94546bc56a"
7544+
integrity sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==
75457545

75467546
pretty-format@^23.6.0:
75477547
version "23.6.0"

0 commit comments

Comments
 (0)