@@ -97,24 +97,84 @@ jobs:
9797 git clean -fdX # Remove untracked files and directories
9898 git gc --prune=now # Garbage collect and prune unreachable objects
9999
100- # Remove unused imports and missing file references
100+ # echo "Installing ESLint dependencies..."
101+ npm install --save-dev eslint @eslint/js globals
102+
103+
104+ # if [ ! -f "eslint.config.cjs" ]; then
105+ # echo "Creating default ESLint config..."
106+ # cat <<EOL > eslint.config.cjs
107+ # const js = require("@eslint/js");
108+ # const globals = require("globals");
109+
110+ # module.exports = [
111+ # js.configs.recommended,
112+ # {
113+ # languageOptions: {
114+ # ecmaVersion: "latest",
115+ # sourceType: "module",
116+ # globals: globals.node,
117+ # },
118+ # rules: {
119+ # "no-unused-vars": "warn",
120+ # "no-console": "off"
121+ # }
122+ # }
123+ # ];
124+ # EOL
125+ # fi
126+
127+ # # Remove unused imports and missing file references
101128 # echo "Running ESLint to remove unused imports..."
102129 # npm install eslint -g
103130 # eslint . --fix
104131
105- echo "Running autoflake to remove unused imports..."
106- pip install autoflake
107- autoflake --remove-all-unused-imports --recursive --in-place .
132+ # echo "Running autoflake to remove unused imports..."
133+ # pip install autoflake
134+ # autoflake --remove-all-unused-imports --recursive --in-place .
108135
109- echo "Running ts-prune to remove unused file references..."
110- npm install -g ts-prune
111- ts-prune | awk '{print $1}' | xargs rm -f
136+ # echo "Running ts-prune to remove unused file references..."
137+ # npm install -g ts-prune
138+ # ts-prune | awk '{print $1}' | xargs rm -f
112139
113140 rsync -av --delete ${{ env.RSYNC_SITECORE_API_SRC_SERVICES_EXCLUDES }} ../api/ ./api/
114141 rsync -av --delete ../cli/ ./cli/
115142 rsync -av --delete ../ui/ ./ui/
116143 rsync -av --delete ${{ env.RSYNC_SITECORE_UPLOAD_API_SRC_EXCLUDES }} ../upload-api/src/ ./upload-api/src/
117144 rsync -av --delete ../upload-api/migration-sitecore/ ./upload-api/migration-sitecore/
145+
146+ # Ensure tsconfig.json exists, create a default one if missing
147+ # if [ ! -f "tsconfig.json" ]; then
148+ # echo "Creating default tsconfig.json..."
149+ # cat <<EOL > tsconfig.json
150+ # {
151+ # "compilerOptions": {
152+ # "target": "ES6",
153+ # "module": "CommonJS",
154+ # "strict": true,
155+ # "esModuleInterop": true,
156+ # "skipLibCheck": true,
157+ # "forceConsistentCasingInFileNames": true
158+ # },
159+ # "include": ["src/**/*"],
160+ # "exclude": ["node_modules", "dist"]
161+ # }
162+ # EOL
163+ # fi
164+
165+ # Remove unused imports
166+ # npx ts-remove-unused-imports api/
167+ # npx ts-remove-unused-imports ui/
168+ # npx ts-remove-unused-imports upload-api/
169+
170+ # Remove missing imports
171+ # npx ts-prune | grep -E '^(api/|ui/|upload-api/)/' | awk '{print $1}' | xargs -I {} sed -i '/import/d' {}
172+
173+ # # Format code
174+ # npx prettier --write .
175+
176+ # eslint api/ ui/ upload-api/ --rule 'import/no-unresolved: error' --format compact | awk -F ':' '{print $1}' | sort -u | xargs -I {} sed -i '/import/d' {}
177+
118178 git add .
119179 git commit -m "Sync changes from migration-v2 PR #${{ github.event.pull_request.number }}"
120180 git push origin sync-from-migration-v2-${{ github.event.pull_request.number }}
@@ -163,10 +223,37 @@ jobs:
163223 git clean -fdX # Remove untracked files and directories
164224 git gc --prune=now # Garbage collect and prune unreachable objects
165225
226+ echo "Installing ESLint dependencies..."
227+ npm install --save-dev eslint @eslint/js globals
228+
229+ if [ ! -f "eslint.config.cjs" ]; then
230+ echo "Creating default ESLint config..."
231+ cat <<EOL > eslint.config.cjs
232+ const js = require("@eslint/js");
233+ const globals = require("globals");
234+
235+ module.exports = [
236+ js.configs.recommended,
237+ {
238+ languageOptions: {
239+ ecmaVersion: "latest",
240+ sourceType: "module",
241+ globals: globals.node,
242+ },
243+ rules: {
244+ "no-unused-vars": "warn",
245+ "no-console": "off"
246+ }
247+ }
248+ ];
249+ EOL
250+ fi
251+
252+
166253 # Remove unused imports and missing file references
167- # echo "Running ESLint to remove unused imports..."
168- # npm install eslint -g
169- # eslint . --fix
254+ echo "Running ESLint to remove unused imports..."
255+ npm install eslint -g
256+ eslint . --fix
170257
171258 echo "Running autoflake to remove unused imports..."
172259 pip install autoflake
@@ -229,10 +316,37 @@ jobs:
229316 git clean -fdX # Remove untracked files and directories
230317 git gc --prune=now # Garbage collect and prune unreachable objects
231318
319+ echo "Installing ESLint dependencies..."
320+ npm install --save-dev eslint @eslint/js globals
321+
322+ if [ ! -f "eslint.config.cjs" ]; then
323+ echo "Creating default ESLint config..."
324+ cat <<EOL > eslint.config.cjs
325+ const js = require("@eslint/js");
326+ const globals = require("globals");
327+
328+ module.exports = [
329+ js.configs.recommended,
330+ {
331+ languageOptions: {
332+ ecmaVersion: "latest",
333+ sourceType: "module",
334+ globals: globals.node,
335+ },
336+ rules: {
337+ "no-unused-vars": "warn",
338+ "no-console": "off"
339+ }
340+ }
341+ ];
342+ EOL
343+ fi
344+
345+
232346 # Remove unused imports and missing file references
233- # echo "Running ESLint to remove unused imports..."
234- # npm install eslint -g
235- # eslint . --fix
347+ echo "Running ESLint to remove unused imports..."
348+ npm install eslint -g
349+ eslint . --fix
236350
237351 echo "Running autoflake to remove unused imports..."
238352 pip install autoflake
0 commit comments