Skip to content

Migrate eslint to v9 and use @jupyter/eslint-plugin#141

Open
Darshan808 wants to merge 9 commits intojupyterlab:mainfrom
Darshan808:use-@jupyter/eslint-plugin
Open

Migrate eslint to v9 and use @jupyter/eslint-plugin#141
Darshan808 wants to merge 9 commits intojupyterlab:mainfrom
Darshan808:use-@jupyter/eslint-plugin

Conversation

@Darshan808
Copy link
Copy Markdown
Member

@Darshan808 Darshan808 commented Apr 10, 2026

Description

  • Migrate eslint to v9 and use new flat config format (.eslint.config.mjs)
  • Add @jupyter/eslint-plugin with recommeded config for extensions.

@Darshan808 Darshan808 marked this pull request as ready for review April 10, 2026 18:23
Comment thread template/package.json.jinja Outdated
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"@eslint/js": "^9.0.0",
"@jupyter/eslint-plugin": "^0.0.3",
Copy link
Copy Markdown
Member

@krassowski krassowski Apr 24, 2026

Choose a reason for hiding this comment

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

@Darshan808 shall we update to latest version and add translation rules to config file as warn or off (extensions often start without translations and add them later, having the rule in config file will already improve discoverability IMO)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

shall we update to latest version

Yes definitely.

add translation rules to config file as warn or off

The eslintconfig in this template includes all the recommended rules for extensions that we defined using

jupyterPlugin.configs.recommended,

These are available in the docs

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the JupyterLab extension template’s linting setup to ESLint v9, moving configuration out of package.json into the new flat config format and adopting @jupyter/eslint-plugin’s recommended rules.

Changes:

  • Bumps ESLint to v9 and updates related devDependencies (adds @eslint/js, globals, typescript-eslint, @jupyter/eslint-plugin).
  • Replaces eslintConfig/eslintIgnore in package.json with a new eslint.config.mjs flat config template.
  • Simplifies the eslint:check script to run eslint . --cache.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
template/package.json.jinja Updates ESLint-related scripts and devDependencies; removes embedded eslintConfig/eslintIgnore.
template/eslint.config.mjs.jinja Adds the new ESLint v9 flat config using TypeScript + Jupyter recommended configs and Prettier integration.
template/.prettierignore.jinja Adds an ignore entry for eslint.config.mjs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +22 to +23
tseslint.configs.recommended,
jupyterPlugin.configs.recommended,
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

typescript-eslint flat-config configs.recommended is an array of config objects; including it as a single array element produces a nested array that ESLint won’t accept. Spread the recommended configs into the top-level config array (same concern for jupyterPlugin.configs.recommended if it is also an array).

Suggested change
tseslint.configs.recommended,
jupyterPlugin.configs.recommended,
...(Array.isArray(tseslint.configs.recommended)
? tseslint.configs.recommended
: [tseslint.configs.recommended]),
...(Array.isArray(jupyterPlugin.configs.recommended)
? jupyterPlugin.configs.recommended
: [jupyterPlugin.configs.recommended]),

Copilot uses AI. Check for mistakes.
**/package.json
!/package.json
{{python_name}}
eslint.config.mjs
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

This .prettierignore entry is currently a no-op: the prettier:base script only targets .ts/.tsx/.js/.jsx/.css/.json/.md, so eslint.config.mjs won’t be formatted anyway. Either remove this ignore line or update the Prettier glob to include .mjs if you want the config file formatted/checked.

Suggested change
eslint.config.mjs

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +2
import js from '@eslint/js';
import { defineConfig } from 'eslint/config';
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

The PR description mentions migrating to .eslint.config.mjs, but the template adds eslint.config.mjs (no leading dot). Please align the description and the generated filename so users know what to expect (and so tooling/docs references don’t drift).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants