summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eslint.config.js28
-rwxr-xr-xscripts/build_package.sh2
-rw-r--r--[-rwxr-xr-x]scripts/copy_files.js (renamed from scripts/copy_files.cjs)11
3 files changed, 10 insertions, 31 deletions
diff --git a/eslint.config.js b/eslint.config.js
index 668930f6..5483f8aa 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -154,34 +154,6 @@ 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
diff --git a/scripts/build_package.sh b/scripts/build_package.sh
index 022cae5a..e64d98cc 100755
--- a/scripts/build_package.sh
+++ b/scripts/build_package.sh
@@ -27,7 +27,7 @@ fi
tsc --build
# copy .{md,json} files
-node ../../scripts/copy_files.cjs
+node ../../scripts/copy_files.js
# touch dist/.last_build
touch dist/.last_build
diff --git a/scripts/copy_files.cjs b/scripts/copy_files.js
index 456d6d41..e6c6b696 100755..100644
--- a/scripts/copy_files.cjs
+++ b/scripts/copy_files.js
@@ -1,4 +1,11 @@
#!/usr/bin/env node
+
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,8 +20,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-const fs = require('fs');
-const path = require('path');
+import fs from 'fs';
+import path from 'path';
const sourceDir = path.join('src');
const targetDir = path.join('dist', 'src');