Skip to content

fix: Ensure languageOptions.customSyntax is serializable#212

Merged
fasttime merged 7 commits into
mainfrom
lang-options-serialization
Sep 11, 2025
Merged

fix: Ensure languageOptions.customSyntax is serializable#212
fasttime merged 7 commits into
mainfrom
lang-options-serialization

Conversation

@nzakas

@nzakas nzakas commented Jul 24, 2025

Copy link
Copy Markdown
Member

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread src/languages/css-language.js Outdated
Comment thread src/languages/css-language.js Outdated
Comment thread src/languages/css-language.js
@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
Comment thread src/languages/css-language.js Outdated
Comment thread src/languages/css-language.js Outdated
@linux-foundation-easycla

linux-foundation-easycla Bot commented Sep 8, 2025

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

nzakas and others added 4 commits September 8, 2025 11:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@nzakas nzakas force-pushed the lang-options-serialization branch from 20e1b8a to e4890b0 Compare September 8, 2025 15:03
Comment thread src/languages/css-language.js Outdated
Comment thread src/languages/css-language.js Outdated
Comment thread src/languages/css-language.js Outdated
@lukaszgryglicki

Copy link
Copy Markdown

/easycla

2 similar comments
@lukaszgryglicki

Copy link
Copy Markdown

/easycla

@lukaszgryglicki

Copy link
Copy Markdown

/easycla

nzakas and others added 3 commits September 11, 2025 12:16

@fasttime fasttime left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!

@fasttime fasttime merged commit 7f82110 into main Sep 11, 2025
22 checks passed
@github-project-automation github-project-automation Bot moved this from Implementing to Complete in Triage Sep 11, 2025
@fasttime fasttime deleted the lang-options-serialization branch September 11, 2025 17:16
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: Complete

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

5 participants