Skip to content

Bug: JSON v1.0.1 is not backward-compatible with ESLint v9.39.2 #213

@lumirlumir

Description

@lumirlumir

Environment

ESLint version: 9.39.2
@eslint/json version: 1.0.1
Node version: 20.19.1
npm version: 10.8.2
Operating System: Stackblitz

Which language are you using?

json

What did you do?

// eslint.config.js

import json from '@eslint/json';
import { defineConfig } from 'eslint/config';

export default defineConfig([
  {
    files: ['**/*.jsonc'],
    plugins: { json },
    language: 'json/jsonc',
    extends: ['json/recommended'],
  },
]);
// tsconfig.json

{
  "include": ["eslint.config.js"],
  "compilerOptions": {
    /* Type Checking */
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "alwaysStrict": true,
    "exactOptionalPropertyTypes": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitAny": true,
    "noImplicitOverride": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noPropertyAccessFromIndexSignature": false, 
    "noUncheckedIndexedAccess": false,
    "noUnusedLocals": false,
    "noUnusedParameters": true,
    "strict": true,
    "strictBindCallApply": true,
    "strictBuiltinIteratorReturn": true,
    "strictFunctionTypes": true,
    "strictNullChecks": true,
    "strictPropertyInitialization": true,
    "useUnknownInCatchVariables": true,

    /* Modules */
    "module": "NodeNext",
    "moduleResolution": "nodenext",

    /* JavaScript Support */
    "allowJs": true,
    "checkJs": true,

    /* Language and Environment */
    "target": "ESNext"
  }
}

What did you expect to happen?

I expected the types in @eslint/json@1.0.1 to be compatible with ESLint v9.

According to the CI test strategy, README.md, and the comments in markdown (eslint/markdown#593 (comment)), JSON v1 is expected to remain backward compatible with ESLint v9.

eslint: [9.15.0, 9.x, 10.x]

What actually happened?

The types in JSON v1 are not compatible with ESLint v9, which prevents using this plugin with ESLint v9 despite it being mentioned as compatible.

Image

Link to Minimal Reproducible Example

https://stackblitz.com/edit/stackblitz-starters-kpy9aaea?file=eslint.config.js

Please run npm run tsc at the reproduction link.

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

The problem is that the ESLint.plugin type, which is extracted from import type { ESLint } from "eslint";, now has different type signatures:

  • ESLint v9.39.2 depends on @eslint/core 0.17.0
  • ESLint v10.0.0 depends on @eslint/core 1.1.0
  • JSON v0.14.0 depends on @eslint/core 0.17.0
  • JSON v1.0.1 depends on @eslint/core 1.1.0

So,

  • JSON v1 and ESLint v10 is compatible. ✅
  • JSON v1 and ESLint v9 is incompatible ❌

Another point is that the HEAD branches of CSS and Markdown are affected by this problem. I discovered it while working on eslint/markdown#593.

To summarize, my question is: do we need to retain type compatibility with ESLint v9 for JSON v1 / CSS v1 / and Markdown v8? If so, I think we need a fundamental solution to ensure these types work seamlessly. Since one of the primary aims of the major releases of language plugins was to maintain backward compatibility, I hope this issue can be addressed.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrepro:yesIssues with a reproducible example

Type

No type

Projects

Status

Evaluating

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions