File tree Expand file tree Collapse file tree 6 files changed +85
-22
lines changed Expand file tree Collapse file tree 6 files changed +85
-22
lines changed Original file line number Diff line number Diff line change
1
+ FROM alpine:latest
2
+
3
+ # Add jq and bash
4
+ RUN apk add --no-cache bash jq fd
5
+
6
+ COPY scripts/read.sh /read.sh
7
+
8
+ RUN chmod +x /read.sh
9
+
10
+ ENTRYPOINT ["/read.sh" ]
Original file line number Diff line number Diff line change
1
+
2
+ ``` sh
3
+ docker build . -t vonwig/read_files
4
+ docker run --mount type=bind,source=$PWD ,target=/project --workdir /project vonwig/read_files ' {"files":["Dockerfile"]}'
5
+ ```
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ JSON_ARGS=$1
3
+
4
+ # Read file paths array
5
+ FILE_PATHS=$( echo $JSON_ARGS | jq -r ' .files[]' )
6
+
7
+ for FILE_PATH in $FILE_PATHS ; do
8
+ echo -e " Content for \` $FILE_PATH \` :\n\n\`\`\` \n"
9
+ # If file doesn't exist
10
+ if [ ! -f $FILE_PATH ]; then
11
+ echo " File $FILE_PATH does not exist"
12
+ else
13
+ # Print file content
14
+ cat $FILE_PATH
15
+ fi
16
+ echo -e " \n\`\`\` \n\n"
17
+ done
Original file line number Diff line number Diff line change 1
- You are an assistant who specializes in linting projects.
1
+ You are an assistant who specializes in linting JS/TS projects with ESLint and git. Follow the steps below .
2
2
3
3
The following is a report of the project's usage of ESLint and Typescript:
4
4
5
5
{{project.eslint}}
6
6
7
- If there are no ESLint configuration files found, use StandardJS to lint the project with a consistent config.
8
-
9
- When using StandardJS, use typescript only if tsconfigs are reported.
7
+ ## Pick Linter
8
+ If there are no ESLint configuration files found, use StandardJS to lint the project.
10
9
10
+ ## Linter Args
11
+ When using StandardJS, use typescript arg only if tsconfigs are reported.
11
12
If there is an ESLint config, lint the project using the right version of ESLint.
12
13
13
- Once you have your report, determine total number of violations. For more than 10 violations, create a branch.
14
+ ## Lint Steps
15
+
16
+ Do the following to lint a JS/TS project:
17
+
18
+ 1 . Create a new branch with git.
19
+
20
+ 2 . Run the linter chosen, fixing violations.
21
+
22
+ 3 . Determine total number of remaining violations after autofix.
14
23
15
- For less than 10 violations, complain about them.
24
+ 4 . Fix the remaining violations
25
+ You must fix files with the following steps:
26
+ - For less than 10 violations, use ` complain ` .
27
+ - For more than 10 violations, use ` read_files ` to read violating files, and use ` write_files ` to fix them.
28
+
Original file line number Diff line number Diff line change 1
- Lint my project's JS/TS files.
1
+ Lint my project's JS/TS files. Use branch linting-eslint or a different one if it exists.
2
+
3
+ Report what you did, broken down by each tool.
Original file line number Diff line number Diff line change @@ -54,23 +54,40 @@ functions:
54
54
- command
55
55
- args
56
56
container :
57
- image : vonwig/git:latest
58
- - name : git-files
59
- description : Handles git files
57
+ image : vonwig/git:local
58
+ - name : write_files
59
+ description : Write a set of files to my project
60
60
parameters :
61
61
type : object
62
62
properties :
63
- command :
64
- type : string
65
- description : The git command to use `add`, `rm`, or `mv`.
66
- args :
67
- type : string
68
- description : The args to use after the command
69
- required :
70
- - command
71
- - args
63
+ files :
64
+ type : array
65
+ items :
66
+ type : object
67
+ properties :
68
+ path :
69
+ type : string
70
+ description : the relative path to the file that should be written
71
+ content :
72
+ type : string
73
+ description : the content that should be written to a file
74
+ executable :
75
+ type : boolean
76
+ description : whether to make the file executable
77
+ container :
78
+ image : vonwig/function_write_files:latest
79
+ - name : read_files
80
+ description : Reads a set of files back
81
+ parameters :
82
+ type : object
83
+ properties :
84
+ files :
85
+ type : array
86
+ items :
87
+ type : string
88
+ description : Relative path to a file to read.
72
89
container :
73
- image : vonwig/git :latest
90
+ image : vonwig/read_files :latest
74
91
- name : complain
75
92
description : Complain about a file
76
93
parameters :
@@ -90,11 +107,10 @@ functions:
90
107
description : The row or column
91
108
edit :
92
109
type : string
93
- description : The edit to make
110
+ description : Code to insert between start_location and end_location which will resolve the violation. Do not include ignore comments.
94
111
required :
95
112
- start_location
96
113
- end_location
97
- - edit
98
114
container :
99
115
image : alpine:latest
100
116
entrypoint :
You can’t perform that action at this time.
0 commit comments