Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

64 changes: 0 additions & 64 deletions .eslintrc.js

This file was deleted.

11 changes: 11 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ CHANGELOG.md
babel.config.json
pnpm-lock.yaml
.pnpm-store

# Codicon doc/build artifacts not loaded at runtime (only codicon.css + codicon.ttf are used)
dist/codicons/codicon.html
dist/codicons/codicon.svg
dist/codicons/codicon.csv
dist/codicons/metadata.json

# Unused Monaco language workers. The data-browsing webview only uses the
# 'typescript' language, so the css/html workers are never requested at runtime.
dist/monaco-editor/vs/assets/css.worker-*.js
dist/monaco-editor/vs/assets/html.worker-*.js
scripts/**
playwright-report
test-results
Expand Down
75 changes: 75 additions & 0 deletions eslint-devtools.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import mochaPlugin from 'eslint-plugin-mocha';
import filenameRules from 'eslint-plugin-filename-rules';
import devtoolsPlugin from '@mongodb-js/eslint-plugin-devtools';
import sharedDevtools from '@mongodb-js/eslint-config-devtools';

/**
* Flat-config adapter for the shared `@mongodb-js/eslint-config-devtools`.
*
* Import the single exported `devtoolsConfig` array and spread it into
* `eslint.config.js`; it registers the devtools plugins and applies the shared
* per-language rule maps (js / ts / test).
*
* Why this adapter exists:
* - The shared devtools config is still authored in the legacy `.eslintrc`
* format: `plugins` is an array of strings and its per-language settings live
* under an `overrides` array whose entries use `env`, `parser` (as a string)
* and `extends: ['eslint:recommended', 'plugin:PLUGIN/recommended']`. None of
* that can be spread into flat config directly.
* - The usual bridge, `FlatCompat`, does not work here either: it resolves
* those legacy `plugin:PLUGIN/recommended` strings, but the major-bumped
* plugins (eslint-plugin-mocha, typescript-eslint, ...) have dropped their
* legacy eslintrc configs, so the strings no longer resolve.
*
* So we do the two things flat config needs by hand: register the plugins the
* rule maps reference, and reuse the shared config's rule maps. The rule maps
* are plain objects, read off the MAIN entry's `overrides` (no subpath, so no
* explicit `.js` extension is required under native ESM) matched by file glob.
*
* Note: `devtoolsRulesFor` only reads each override's `rules` object, which
* holds just a handful of explicit rules (eqeqeq, no-console, ...). The bulk of
* the shared config comes from `eslint:recommended`, listed in every override's
* `extends` array - which we do not read. `js.configs.recommended` below is the
* flat-config replacement for that `eslint:recommended` extend; without it we
* would silently lose every recommended rule.
*
* TODO(COMPASS-10812): once `@mongodb-js/eslint-config-devtools` ships a native flat
* config, delete this adapter and consume that flat config directly.
*/
const devtoolsOverrides = sharedDevtools.overrides ?? [];

const devtoolsRulesFor = (glob) =>
devtoolsOverrides.find((override) => override.files?.includes(glob))?.rules ??
{};

export const devtoolsConfig = [
js.configs.recommended,
{
name: 'devtools/plugins',
plugins: {
'filename-rules': filenameRules,
'@mongodb-js/devtools': devtoolsPlugin,
},
},
{
name: 'devtools/js',
files: ['**/*.js'],
rules: devtoolsRulesFor('**/*.js'),
},
{
name: 'devtools/ts',
files: ['**/*.{ts,tsx}'],
extends: [tseslint.configs.recommendedTypeChecked],
rules: devtoolsRulesFor('**/*.ts'),
},
{
name: 'devtools/test',
files: ['src/test/**/*.{ts,tsx}'],
// The shared test rules turn some mocha/recommended rules back off, so they
// must be spread after extending mocha/recommended.
extends: [mochaPlugin.configs.recommended],
rules: devtoolsRulesFor('**/*.test.ts'),
},
];
84 changes: 84 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { defineConfig } from 'eslint/config';
import { devtoolsConfig } from './eslint-devtools.js';

const extraTsRules = {
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-floating-promises': 2,
'@typescript-eslint/no-unsafe-assignment': 0,
'@typescript-eslint/no-unsafe-member-access': 0,
'@typescript-eslint/no-unsafe-call': 0,
'@typescript-eslint/no-unsafe-return': 0,
'@typescript-eslint/no-unsafe-argument': 0,
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' },
],
'@typescript-eslint/explicit-function-return-type': [
'warn',
{ allowHigherOrderFunctions: true },
],
'@typescript-eslint/ban-ts-comment': [
'error',
{ 'ts-ignore': 'allow-with-description' },
],
};

export default defineConfig([
{
ignores: [
'node_modules/**',
'out/**',
'dist/**',
'scripts/**',
'src/vscode-dts/**',
'ext/agent-skills/**',
'playwright-report/**',
'test-results/**',
'.claude/**',
'.vscode-test/**',
],
},
// Base JS/TS config plus the devtools plugins and shared rule maps.
...devtoolsConfig,
{
files: ['**/*.js'],
languageOptions: {
globals: {
module: 'readonly',
require: 'readonly',
exports: 'writable',
process: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
},
},
},
{
rules: {
// TODO(VSCODE-724): Update our file naming and enable this rule.
// We have a lot of files that do not match the filename rules.
'filename-rules/match': 0,
'no-console': [1, { allow: ['warn', 'error', 'info'] }],
},
},
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
...extraTsRules,
},
},
{
files: ['src/test/**/*.{ts,tsx}'],
rules: {
// Chai assertions such as `expect(x).to.be.true` are expressions.
'@typescript-eslint/no-unused-expressions': 0,
'no-console': 0,
},
},
]);
35 changes: 21 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,7 @@
"react-redux": "^9.2.0",
"ts-log": "^2.2.7",
"uuid": "^14.0.0",
"vscode-languageclient": "^9.0.1",
"vscode-languageclient": "^10.1.0",
"vscode-languageserver": "^9.0.1",
"vscode-languageserver-textdocument": "^1.0.12",
"xss": "^1.0.15",
Expand All @@ -1516,19 +1516,21 @@
"devDependencies": {
"@babel/preset-typescript": "^7.28.5",
"@babel/types": "^7.29.0",
"@eslint/js": "^10.0.1",
"@modelcontextprotocol/sdk": "^1.29.0",
"@mongodb-js/eslint-config-devtools": "^0.11.6",
"@mongodb-js/eslint-plugin-devtools": "0.3.4",
"@mongodb-js/oidc-mock-provider": "^0.13.11",
"@mongodb-js/oidc-plugin": "^2.0.8",
"@mongodb-js/prettier-config-devtools": "^1.0.3",
"@mongodb-js/sbom-tools": "^0.10.15",
"@mongodb-js/signing-utils": "^0.5.10",
"@mongosh/service-provider-core": "^3.7.1",
"@mongosh/service-provider-core": "^5.0.6",
"@playwright/test": "^1.59.1",
"@testing-library/react": "^16.3.2",
"@testing-library/user-event": "^14.6.1",
"@types/babel__traverse": "^7.28.0",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.3",
"@types/chai-as-promised": "^8.0.2",
"@types/debug": "^4.1.13",
"@types/lodash": "^4.17.24",
Expand All @@ -1541,9 +1543,7 @@
"@types/sinon": "^9.0.11",
"@types/sinon-chai": "^3.2.12",
"@types/vscode": "^1.117.0",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@vscode/test-electron": "^2.5.2",
"@vscode/test-electron": "^3.0.0",
"@vscode/vsce": "^3.9.2",
"buffer": "^6.0.3",
"chai": "^6.2.2",
Expand All @@ -1552,12 +1552,13 @@
"cross-env": "^7.0.3",
"depcheck": "^1.4.7",
"duplicate-package-checker-webpack-plugin": "^3.0.0",
"eslint": "^8.57.1",
"eslint-plugin-mocha": "^10.5.0",
"eslint": "^10.6.0",
"eslint-plugin-filename-rules": "1.3.1",
"eslint-plugin-mocha": "^11.3.0",
"fork-ts-checker-webpack-plugin": "^9.1.0",
"glob": "^13.0.6",
"husky": "^9.1.7",
"jsdom": "^23.2.0",
"jsdom": "^29.1.1",
"mkdirp": "^1.0.4",
"mocha": "^11.7.5",
"mocha-junit-reporter": "^2.2.1",
Expand All @@ -1582,6 +1583,7 @@
"ts-loader": "^9.5.7",
"ts-node": "^10.9.2",
"typescript": "^5.9.2",
"typescript-eslint": "^8.62.1",
"webfont": "^11.2.26",
"webpack": "^5.106.2",
"webpack-bundle-analyzer": "^5.3.0",
Expand All @@ -1592,7 +1594,6 @@
"pnpm": {
"overrides": {
"react": "^18.3.1",
"jsonwebtoken>jws": "3.2.3",
"mongodb": "^7.2.0",
"kerberos": "^7.0.0",
"bson": "^7.2.0",
Expand All @@ -1601,11 +1602,17 @@
"@mongosh/service-provider-node-driver": "^5.2.0",
"@mongodb-js/oidc-plugin": "^2.0.8",
"@mongodb-js/devtools-proxy-support": "^0.7.16",
"brace-expansion": "^5.0.7",
"tar": "^7.5.11",
"serialize-javascript": "^7.0.4",
"underscore": "^1.13.8",
"fast-xml-parser": "^5.7.0"
"brace-expansion": "^5.0.7",
"serialize-javascript": "^7.0.5",
"basic-ftp": "^5.3.1",
"fast-uri": "^3.1.3",
"hono": "^4.12.25",
"tmp": "^0.2.7",
"trim": "^0.0.3",
"undici": "^7.28.0",
"ws": "^8.21.0",
"@xmldom/xmldom": "^0.9.10"
}
}
}
Loading
Loading