Skip to content

Commit bb6999a

Browse files
Update .prettierignore (#37)
1 parent b9d1cbf commit bb6999a

File tree

16 files changed

+124
-372
lines changed

16 files changed

+124
-372
lines changed

.appends/.github/labels.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,38 @@
33
# https://github.com/exercism/org-wide-files/blob/main/global-files/.github/labels.yml. #
44
# ----------------------------------------------------------------------------------------- #
55

6-
- name: "bug"
6+
- name: 'bug'
77
description: "Something isn't working"
8-
color: "d73a4a"
8+
color: 'd73a4a'
99

10-
- name: "dependencies"
11-
description: "Pull requests that update a dependency file"
12-
color: "0366d6"
10+
- name: 'dependencies'
11+
description: 'Pull requests that update a dependency file'
12+
color: '0366d6'
1313

14-
- name: "duplicate"
15-
description: "This issue or pull request already exists"
16-
color: "cfd3d7"
14+
- name: 'duplicate'
15+
description: 'This issue or pull request already exists'
16+
color: 'cfd3d7'
1717

18-
- name: "enhancement"
19-
description: "New feature or request"
20-
color: "a2eeef"
18+
- name: 'enhancement'
19+
description: 'New feature or request'
20+
color: 'a2eeef'
2121

22-
- name: "good first issue"
23-
description: "Good for newcomers"
24-
color: "7057ff"
22+
- name: 'good first issue'
23+
description: 'Good for newcomers'
24+
color: '7057ff'
2525

26-
- name: "help wanted"
27-
description: "Extra attention is needed"
28-
color: "008672"
26+
- name: 'help wanted'
27+
description: 'Extra attention is needed'
28+
color: '008672'
2929

30-
- name: "invalid"
30+
- name: 'invalid'
3131
description: "This doesn't seem right"
32-
color: "e4e669"
32+
color: 'e4e669'
3333

34-
- name: "question"
35-
description: "Further information is requested"
36-
color: "d876e3"
34+
- name: 'question'
35+
description: 'Further information is requested'
36+
color: 'd876e3'
3737

38-
- name: "wontfix"
39-
description: "This will not be worked on"
40-
color: "ffffff"
38+
- name: 'wontfix'
39+
description: 'This will not be worked on'
40+
color: 'ffffff'

.github/workflows/format-code.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ jobs:
6262
6363
- name: 'Format code'
6464
run: ./bin/format.sh
65-
env:
66-
EXERCISM_PRETTIER_VERSION: '2.2.1'
6765

6866
- name: 'Commit formatted code'
6967
run: |

.github/workflows/verify-code-formatting.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,3 @@ jobs:
1414

1515
- name: 'Verify formatting of all files'
1616
run: ./bin/check-formatting.sh
17-
env:
18-
EXERCISM_PRETTIER_VERSION: '2.2.1'

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.vscode
22
/.github/labels.yml
3+
/.github/workflows/deploy.yml
34
/.github/workflows/sync-labels.yml
45
/dist
56
/node_modules

bin/check-formatting.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
11
#!/bin/bash
22

3+
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then
4+
echo "Pulling prettier version from package.json"
5+
EXERCISM_PRETTIER_VERSION=$(npm list prettier | grep -Po '.*\sprettier@\K.*')
6+
fi
7+
8+
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then
9+
echo "---------------------------------------------------"
10+
echo "This script requires the EXERCISM_PRETTIER_VERSION variable to work."
11+
echo "Please see https://exercism.org/docs/building/markdown/style-guide for guidance."
12+
echo "---------------------------------------------------"
13+
echo "This is what npm list reports:"
14+
echo "$(npm list prettier)"
15+
echo ""
16+
echo "This is the version that can be extracted:"
17+
echo "$(npm list prettier | grep -Po '.*\sprettier@\K.*')"
18+
echo ""
19+
echo "These files are found in the repo root:"
20+
echo "$(ls -p | grep -v /)"
21+
echo "---------------------------------------------------"
22+
exit 1
23+
else
24+
echo "Running format with prettier@$EXERCISM_PRETTIER_VERSION"
25+
fi
26+
327
npx "prettier@$EXERCISM_PRETTIER_VERSION" --check "**/*.{js,jsx,ts,tsx,css,sass,scss,html,json,md,yml}"

bin/format.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
#!/usr/bin/env bash
22

33
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then
4-
echo "This script requires the EXERCISM_PRETTIER_VERSION variable to work."
5-
echo "Please see https://github.com/exercism/v3/blob/master/docs/maintainers/style-guide.md for guidance."
6-
exit 1
4+
echo "Pulling prettier version from package.json"
5+
EXERCISM_PRETTIER_VERSION=$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*')
6+
fi
7+
8+
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then
9+
echo "---------------------------------------------------"
10+
echo "This script requires the EXERCISM_PRETTIER_VERSION variable to work."
11+
echo "Please see https://exercism.org/docs/building/markdown/style-guide for guidance."
12+
echo "---------------------------------------------------"
13+
echo "This is what yarn list reports:"
14+
echo "$(yarn list --pattern prettier)"
15+
echo ""
16+
echo "This is the version that can be extracted:"
17+
echo "$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*')"
18+
echo ""
19+
echo "These files are found in the repo root:"
20+
echo "$(ls -p | grep -v /)"
21+
echo "---------------------------------------------------"
22+
exit 1
23+
else
24+
echo "Running format with prettier@$EXERCISM_PRETTIER_VERSION"
725
fi
826

927
npx "prettier@$EXERCISM_PRETTIER_VERSION" --write "**/*.{js,jsx,ts,tsx,css,sass,scss,html,json,md,yml}"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"eslint-plugin-import": "^2.22.1",
5151
"eslint-plugin-jest": "^24.3.4",
5252
"jest": "^26.6.3",
53+
"prettier": "^2.5.1",
5354
"rimraf": "^3.0.2",
5455
"shelljs": "^0.8.4"
5556
},

src/analyzers/practice/two-fer/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,11 @@ export class TwoFerAnalyzer extends AnalyzerImpl {
237237
}
238238
}
239239

240-
const { returnType } = (this.mainMethod.node.type ===
241-
AST_NODE_TYPES.MethodDefinition
242-
? this.mainMethod.node.value
243-
: this.mainMethod.node) as {
240+
const { returnType } = (
241+
this.mainMethod.node.type === AST_NODE_TYPES.MethodDefinition
242+
? this.mainMethod.node.value
243+
: this.mainMethod.node
244+
) as {
244245
returnType?: TSESTree.TSTypeAnnotation
245246
}
246247

src/batch.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ readDir(FIXTURES_ROOT)
150150
)
151151
})
152152
.then((grouped) => {
153-
const aggregatedGroups = (Object.keys(
154-
grouped
155-
) as Output['status'][]).reduce((aggregated, status) => {
153+
const aggregatedGroups = (
154+
Object.keys(grouped) as Output['status'][]
155+
).reduce((aggregated, status) => {
156156
const { count, comments, runtimes, fixtures } = grouped[status]
157157

158158
const sortedRuntimes = runtimes.sort()

src/comments/comment.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,11 @@ function combineValues<R extends string>({
188188
positionalValues: string[]
189189
}): CommentVariables {
190190
if (positionalValues.length === 0) {
191-
return (Object.freeze(dictionary) as unknown) as CommentVariables
191+
return Object.freeze(dictionary) as unknown as CommentVariables
192192
}
193193

194194
// Assigns the positional variables as keys
195-
return (Object.freeze(
195+
return Object.freeze(
196196
Object.assign({}, dictionary, positionalValues)
197-
) as unknown) as CommentVariables
197+
) as unknown as CommentVariables
198198
}

src/comments/shared.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ Now, if you accidentally change your function to return a different type,
5353
compilation fails and you have successfully guarded against a source of bugs.
5454
`('typescript.general.prefer_explicit_return_type', CommentType.Actionable)
5555

56-
export const PREFER_UNPREFIXED_UNDERSCORE_PARAMETERS = factory<'parameter.name'>`
56+
export const PREFER_UNPREFIXED_UNDERSCORE_PARAMETERS =
57+
factory<'parameter.name'>`
5758
Unlike other languages, \`_parameter\` does not signify a *private* variable.
5859
TypeScript has its own constructs for marking variables private (such as the
5960
\`private\` keyword for class members).
@@ -63,9 +64,9 @@ most IDEs from highlighting that parameter if it's unused, which is actually a
6364
tool you probably want to keep in this case. Remove the underscore \`_\` from
6465
${'parameter.name'} in order to fix this.
6566
`(
66-
'typescript.general.prefer_unprefixed_underscore_parameters',
67-
CommentType.Actionable
68-
)
67+
'typescript.general.prefer_unprefixed_underscore_parameters',
68+
CommentType.Actionable
69+
)
6970

7071
export const NO_METHOD = factory<'method.name'>`
7172
No method called \`${'method.name'}\`. The tests won't pass without it.

src/output/IsolatedAnalyzerOutput.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export class EarlyFinalization extends Error {
1111

1212
export class IsolatedAnalyzerOutput
1313
extends AnalyzerOutput
14-
implements WritableOutput {
14+
implements WritableOutput
15+
{
1516
/**
1617
* Mark the solution as approved
1718
* @deprecated add a {celebratory} or {informative} comment instead

test/__mocks__/fs.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@ const fs = jest.genMockFromModule('fs') as Omit<
2727
// This is a custom function that our tests can use during setup to specify
2828
// what the files on the "mock" filesystem should look like when any of the
2929
// `fs` APIs are used.
30-
let mockFiles: { [dir: string]: { [file: string]: string } } = Object.create(
31-
null
32-
)
33-
let writtenFiles: { [dir: string]: { [file: string]: string } } = Object.create(
34-
null
35-
)
30+
let mockFiles: { [dir: string]: { [file: string]: string } } =
31+
Object.create(null)
32+
let writtenFiles: { [dir: string]: { [file: string]: string } } =
33+
Object.create(null)
3634

3735
class NotMocked extends Error {
3836
public readonly code: string

0 commit comments

Comments
 (0)