Skip to content

Conversation

nzakas
Copy link
Member

@nzakas nzakas commented Jul 24, 2025

Prerequisites checklist

What is the purpose of this pull request?

Ensures that languageOptions.customSyntax is serializable by replacing all functions with true. CSSTree allows functions in its config and we need to account for that to allow things like caching in ESLint.

What changes did you make? (Give an overview)

  • Added CSSLanguage#normalizeLanguageOptions() that adds a toJSON method when the customSyntax option is present
  • Updated the CSSLanguage tests to validate the new functionality works.
  • Updated the plugin test to ensure we get the expected results when run through ESLint.

Related Issues

fixes #211

Is there anything you'd like reviewers to focus on?

@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Jul 24, 2025
@nzakas nzakas requested a review from Copilot July 24, 2025 15:37
@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label Jul 24, 2025
Copy link

@Copilot 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

This PR addresses a serialization issue with ESLint configuration by ensuring that languageOptions.customSyntax containing functions can be properly serialized to JSON. This is necessary for ESLint features like configuration caching.

  • Added normalizeLanguageOptions() method to handle serialization of customSyntax configurations
  • Enhanced test coverage for both unit and integration scenarios
  • Updated JSDoc documentation for consistency

Reviewed Changes

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

File Description
src/languages/css-language.js Implements serialization logic with normalizeLanguageOptions() method and helper function
tests/languages/css-language.test.js Unit tests for the new normalization functionality
tests/plugin/eslint.test.js Integration tests validating serialization behavior through ESLint

@lumirlumir lumirlumir added the accepted There is consensus among the team that this change meets the criteria for inclusion label Jul 25, 2025
@fasttime fasttime moved this from Needs Triage to Triaging in Triage Aug 5, 2025
Copy link

linux-foundation-easycla bot commented Sep 8, 2025

CLA Not Signed

@nzakas nzakas force-pushed the lang-options-serialization branch from 20e1b8a to e4890b0 Compare September 8, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion bug Something isn't working
Projects
Status: Implementing
Development

Successfully merging this pull request may close these issues.

Bug: provided syntax object is not JSON-serializable, which causes ESLint to crash in certain situations
3 participants