Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,46 @@ import importPlugin from "eslint-plugin-import";
const opts = tseslint.config(
eslint.configs.recommended,
// ...tseslint.configs.recommended,
...tseslint.configs.strict,
...tseslint.configs.stylistic,
// ...tseslint.configs.strict,
// ...tseslint.configs.stylistic,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
globals: {
queueMicrotask: "readonly",
parserOptions: {
sourceType: "module",
project: "./tsconfig.json",
// projectService: true,
tsconfigRootDir: import.meta.dirname,
Comment on lines 14 to +19

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Ensure all linted TS files are covered by project config

The new type‑checked config sets parserOptions.project: "./tsconfig.json", but that tsconfig only includes core, cloud, cli, dashboard, and tests. Directories like use-fireproof/ and smoke/npm/ still contain TypeScript files and are not ignored. Running pnpm lint against those files will now fail with Parsing error: File ... is not included in the project before any of the intended rule diagnostics are emitted. Consider adding a dedicated tsconfig.eslint.json that references every package or explicitly ignoring the out-of-project folders so lint can complete.

Useful? React with 👍 / 👎.

},
},
},
{
ignores: [
"babel.config.cjs",
"prettier.config.js",
"jest.config.js",
"setup.*.js",
"to-esm.js",
"vitest.*.ts",
"**/.esm-cache/**",
"**/dist/",
"dist/**",
"**/pubdir/",
"**/node_modules/",
"**/scripts/",
"**/examples/",
"scripts/",
"coverage/",
"smoke/react/",
"src/missingTypes/lib.deno.d.ts",
"**/.cache/**",
"**/.esm-cache/**",
"**/.wrangler/**",
],
},
{
files: ["**/*.js", "*.mjs"],
extends: [tseslint.configs.disableTypeChecked],
},
Comment on lines +45 to +47
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

🧩 Analysis chain

JS override misses nested .mjs and all .cjs files.

This leaves type‑checked rules active in those files. Expand globs.

Apply this diff:

-  files: ["**/*.js", "*.mjs"],
+  files: ["**/*.js", "**/*.mjs", "**/*.cjs"],

Quick check:


🏁 Script executed:

#!/bin/bash
echo "Any nested .mjs/.cjs files not matched by '*.mjs'?"; fd -t f -e mjs -e cjs | sed '1,1d' || true

Length of output: 113


Expand override globs to include nested .mjs and all .cjs files

"*.mjs" only matches top-level .mjs and misses nested .mjs/.cjs — fd lists smoke/npm/patch-package.json.mjs and smoke/react/eslint.config.mjs.

File: eslint.config.mjs (lines 45-47)

-  files: ["**/*.js", "*.mjs"],
+  files: ["**/*.js", "**/*.mjs", "**/*.cjs"],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
files: ["**/*.js", "*.mjs"],
extends: [tseslint.configs.disableTypeChecked],
},
files: ["**/*.js", "**/*.mjs", "**/*.cjs"],
extends: [tseslint.configs.disableTypeChecked],
},
🤖 Prompt for AI Agents
In eslint.config.mjs around lines 45 to 47, the override's files globs only
include "**/*.js" and "*.mjs", which misses nested .mjs and any .cjs files;
update the files array to use recursive globs such as "**/*.mjs" and "**/*.cjs"
(and keep "**/*.js") so nested module files and CommonJS files are covered,
e.g., replace "*.mjs" with "**/*.mjs" and add "**/*.cjs" to the list.

{
plugins: {
import: importPlugin,
Expand All @@ -53,6 +67,12 @@ const opts = tseslint.config(
"no-restricted-globals": ["error", "URL", "TextDecoder", "TextEncoder"],
},
},
{
files: ["**/*.ts", "**/*.tsx"],
rules: {
"@typescript-eslint/prefer-readonly": "error",
},
},
);

export default opts;
Loading