Skip to content

Commit e7fe0cc

Browse files
authored
Merge pull request #534 from contentstack/feature/workflow
workflow changes
2 parents fd83bc4 + 8d7b1e2 commit e7fe0cc

File tree

1 file changed

+63
-9
lines changed

1 file changed

+63
-9
lines changed

.github/workflows/repo-sync.yml

Lines changed: 63 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,30 @@ jobs:
9797
git clean -fdX # Remove untracked files and directories
9898
git gc --prune=now # Garbage collect and prune unreachable objects
9999
100-
if [ ! -f "eslint.config.js" ]; then
100+
if [ ! -f "eslint.config.cjs" ]; then
101101
echo "Creating default ESLint config..."
102-
echo "import js from '@eslint/js';" > eslint.config.js
103-
echo "export default [js.configs.recommended];" >> eslint.config.js
102+
cat <<EOL > eslint.config.cjs
103+
const js = require("@eslint/js");
104+
const globals = require("globals");
105+
106+
module.exports = [
107+
js.configs.recommended,
108+
{
109+
languageOptions: {
110+
ecmaVersion: "latest",
111+
sourceType: "module",
112+
globals: globals.node,
113+
},
114+
rules: {
115+
"no-unused-vars": "warn",
116+
"no-console": "off"
117+
}
118+
}
119+
];
120+
EOL
104121
fi
105122
123+
106124
# Remove unused imports and missing file references
107125
echo "Running ESLint to remove unused imports..."
108126
npm install eslint -g
@@ -169,12 +187,30 @@ jobs:
169187
git clean -fdX # Remove untracked files and directories
170188
git gc --prune=now # Garbage collect and prune unreachable objects
171189
172-
if [ ! -f "eslint.config.js" ]; then
190+
if [ ! -f "eslint.config.cjs" ]; then
173191
echo "Creating default ESLint config..."
174-
echo "import js from '@eslint/js';" > eslint.config.js
175-
echo "export default [js.configs.recommended];" >> eslint.config.js
192+
cat <<EOL > eslint.config.cjs
193+
const js = require("@eslint/js");
194+
const globals = require("globals");
195+
196+
module.exports = [
197+
js.configs.recommended,
198+
{
199+
languageOptions: {
200+
ecmaVersion: "latest",
201+
sourceType: "module",
202+
globals: globals.node,
203+
},
204+
rules: {
205+
"no-unused-vars": "warn",
206+
"no-console": "off"
207+
}
208+
}
209+
];
210+
EOL
176211
fi
177212
213+
178214
# Remove unused imports and missing file references
179215
echo "Running ESLint to remove unused imports..."
180216
npm install eslint -g
@@ -241,12 +277,30 @@ jobs:
241277
git clean -fdX # Remove untracked files and directories
242278
git gc --prune=now # Garbage collect and prune unreachable objects
243279
244-
if [ ! -f "eslint.config.js" ]; then
280+
if [ ! -f "eslint.config.cjs" ]; then
245281
echo "Creating default ESLint config..."
246-
echo "import js from '@eslint/js';" > eslint.config.js
247-
echo "export default [js.configs.recommended];" >> eslint.config.js
282+
cat <<EOL > eslint.config.cjs
283+
const js = require("@eslint/js");
284+
const globals = require("globals");
285+
286+
module.exports = [
287+
js.configs.recommended,
288+
{
289+
languageOptions: {
290+
ecmaVersion: "latest",
291+
sourceType: "module",
292+
globals: globals.node,
293+
},
294+
rules: {
295+
"no-unused-vars": "warn",
296+
"no-console": "off"
297+
}
298+
}
299+
];
300+
EOL
248301
fi
249302
303+
250304
# Remove unused imports and missing file references
251305
echo "Running ESLint to remove unused imports..."
252306
npm install eslint -g

0 commit comments

Comments
 (0)