summaryrefslogtreecommitdiff
path: root/eslint.config.js
diff options
context:
space:
mode:
authorTaylor Mullen <[email protected]>2025-05-16 13:54:54 -0700
committerN. Taylor Mullen <[email protected]>2025-05-16 13:59:07 -0700
commit8af970061ecba4dde90425447f3fafc4cf0d59f1 (patch)
tree85eccafe2fd74472c60019d05b9b0972110f76d2 /eslint.config.js
parent8b959c2060352182889e8e056de8a62a301778df (diff)
Fix: Use Node.js script for cross-platform file copying in build
- Replaces the rsync command in the build_package.sh script with a Node.js script (copy_files.cjs) to handle copying necessary files (e.g., .md, .json, .sb) during the build process. - Addresses an issue where the build would fail on systems that do not have rsync installed (e.g., some Windows environments or minimal Linux distributions) by using a Node.js script, providing a cross-platform solution as Node.js is already a project dependency. - Updates the ESLint configuration to correctly lint .cjs files as CommonJS modules. Fixes https://github.com/google-gemini/gemini-cli/issues/387
Diffstat (limited to 'eslint.config.js')
-rw-r--r--eslint.config.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/eslint.config.js b/eslint.config.js
index 5483f8aa..668930f6 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -154,6 +154,34 @@ export default tseslint.config(
},
},
},
+ // Override for .cjs files to use CommonJS
+ {
+ files: ['**/*.cjs'],
+ languageOptions: {
+ sourceType: 'commonjs',
+ globals: {
+ ...globals.node, // Add all Node.js globals
+ __dirname: 'readonly',
+ __filename: 'readonly',
+ exports: 'writable',
+ module: 'readonly',
+ require: 'readonly',
+ },
+ },
+ rules: {
+ // Disable rules that are not applicable to CommonJS
+ '@typescript-eslint/no-require-imports': 'off',
+ 'no-restricted-syntax': [
+ 'error',
+ // Keep other restricted syntaxes, but allow require for .cjs
+ {
+ selector: 'ThrowStatement > Literal:not([value=/^\\\\w+Error:/])',
+ message:
+ 'Do not throw string literals or non-Error objects. Throw new Error("...") instead.',
+ },
+ ],
+ },
+ },
// Prettier config must be last
prettierConfig,
// Custom eslint rules for this repo