microsoft / microsoft/vscode-flake8
Template Sync: Migrate ESLint and config to v10 with flat config
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 52
- Forks
- 34
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 5
Description
### 🔄 Template Sync Required
Changes from the upstream [vscode-python-tools-extension-template](https://github.com/microsoft/vscode-python-tools-extension-template) have not yet been incorporated into this repository.
#### Source PR
- [microsoft/vscode-python-tools-extension-template#296 — Migrate ESLint and config to v10 with flat config](https://github.com/microsoft/vscode-python-tools-extension-template/pull/296)
#### Summary
The template migrated ESLint from v8 (legacy `.eslintrc.json` config) to v10 (flat `eslint.config.mjs` config). The `--ext ts` flag was removed from the lint script (removed in ESLint v9+; file patterns are now specified in the config). A local empty stub package for `@types/eslint-scope` was introduced to suppress a type conflict between webpack's transitive `@types/eslint-scope@^3.7.7` and ESLint v10's bundled TypeScript declarations. Additionally, unused `eslint-disable` directives were removed from two shared source files, as ESLint v9+ reports unused disable directives as warnings by default.
#### Files with missing changes
- **`.eslintrc.json`** — Legacy ESLint v8 config still present; should be deleted and replaced by `eslint.config.mjs`.
- **`eslint.config.mjs`** — New ESLint v10 flat config file is missing entirely.
- **`package.json`** — The `lint` script still uses `eslint src --ext ts` (the `--ext ts` flag was removed in ESLint v9+); also missing the `"overrides"` entry redirecting `@types/eslint-scope` to the local stub.
- **`src/common/python.ts`** — Still contains `/* eslint-disable `@typescript-eslint/naming-convention` */` on line 4; this is an unused disable directive under ESLint v10 and should be removed.
- **`src/common/vscodeapi.ts`** — Still contains `/* eslint-disable `@typescript-eslint/explicit-module-boundary-types` */` and `/* eslint-disable `@typescript-eslint/no-explicit-any` */` on lines 4–5; these are unused disable directives and should be removed.
- **`types/eslint-scope/index.d.ts`** — New stub file is missing; needed to suppress `@types/eslint-scope` type conflicts with ESLint v10.
- **`types/eslint-scope/package.json`** — New stub package manifest is missing.
#### Suggested fix
**1. Delete `.eslintrc.json`** (entire file removed).
**2. Create `eslint.config.mjs`:**
````diff
+import typescriptEslint from "`@typescript-eslint/eslint-plugin`";
+import tsParser from "`@typescript-eslint/parser`";
+
+export default [
+ {
+ ignores: ["out/**", "dist/**", "**/*.d.ts"],
+ },
+ {
+ files: ["src/**/*.ts"],
+ plugins: {
+ "`@typescript-eslint`": typescriptEslint,
+ },
+ languageOptions: {
+ parser: tsParser,
+ parserOptions: {
+ ecmaVersion: 6,
+ sourceType: "module",
+ },
+ },
+ rules: {
+ "`@typescript-eslint/naming-convention`": "warn",
+ "curly": "warn",
+ "eqeqeq": "warn",
+ "no-throw-literal": "warn",
+ "semi": "off",
+ },
+ },
+];
````
**3. Update `package.json` lint script and add overrides:**
````diff
- "lint": "eslint src --ext ts",
+ "lint": "eslint src",
````
````diff
"devDependencies": {
...
- }
+ },
+ "overrides": {
+ "`@types/eslint-scope`": "file:./types/eslint-scope"
+ }
}
````
**4. Update `src/common/python.ts`** (remove unused eslint-disable directive):
````diff
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-/* eslint-disable `@typescript-eslint/naming-convention` */
import { commands, Disposable, Event, EventEmitter, Uri } from 'vscode';
````
**5. Update `src/common/vscodeapi.ts`** (remove unused eslint-disable directives):
````diff
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-/* eslint-disable `@typescript-eslint/explicit-module-boundary-types` */
-/* eslint-disable `@typescript-eslint/no-explicit-any` */
import {
commands,
ConfigurationScope,
````
**6. Create `types/eslint-scope/index.d.ts`:**
````diff
+// Empty stub. eslint-scope types conflict with ESLint v10's bundled types.
+// webpack@5 pulls in `@types/eslint-scope`; this stub suppresses that conflict.
+export {};
````
**7. Create `types/eslint-scope/package.json`:**
````diff
+{
+ "name": "`@types/eslint-scope`",
+ "version": "99.0.0",
+ "description": "Empty stub to prevent `@types/eslint-scope` conflict with ESLint v10 bundled types",
+ "main": "",
+ "types": "index.d.ts"
+}
````
#### Files skipped
- **`package-lock.json`** — Lockfile update; skipped as dependency lock changes are handled separately.
- Dependency version bumps in `package.json` (`eslint` ^8→^10, `typescript`, `webpack-cli`, `fs-extra`) — Dependabot handles version updates automatically.
> **Note:** `src/common/settings.ts` also has a `/* eslint-disable `@typescript-eslint/naming-convention` */` directive that is not present in the template. This may need separate evaluation — it was not part of the upstream PR and may be intentional or require its own fix.
---
🤖 This issue was auto-generated by the [`extension-template-sync`](.github/workflows/extension-template-sync.md) workflow.
> Generated by [Extension Template Sync](https://github.com/microsoft/vscode-flake8/actions/runs/23876136576)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the upstream PR with .eslintrc.json, package.json, src/common/python.ts, src/common/vscodeapi.ts, and the missing types/eslint-scope files. Run the repository's lint command after applying the template-sync changes. Done means ESLint uses the flat config without unused-directive warnings or the reported eslint-scope type conflict.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, typescript, webpack
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100