Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 7, 2026

Changes

Summary

  • Removed redundant function-to-object conversion logic in parse() method as normalizeLanguageOptions() already handles this
  • Fixed linting errors by converting arrow functions to properly documented function declarations
  • Updated test to normalize language options before parsing when using function-based customSyntax
  • Added TypeScript type cast to indicate customSyntax is always an object after normalization
  • Ran prettier to format files

Addressed Feedback

  • Code review comment: Removed lines 232-236 in parse() method - the conversion is now only done in normalizeLanguageOptions()
  • Linting errors: Fixed func-style and JSDoc errors by converting arrow functions to function declarations with proper documentation
  • Formatting: Ran prettier to format all files

All tests pass (963 passing) and linting passes with no errors.

Original prompt

This section details on the original issue you should resolve

<issue_title>Change Request: Allow function customSyntax options</issue_title>
<issue_description>### Environment

HEAD

What problem do you want to solve?

The CSS plugin currently only accepts objects as languageOptions.customSyntax. This is primarily so we can serialize languageOptions for various reasons.

However, CSSTree also allows function-based customSyntax, which is helpful when you want to extend the base syntax in some way. This also ensures that the package providing the custom syntax doesn't need a direct dependency on CSSTree to work.

I'd like to extend languageOptions.customSyntax to accept functions.

What do you think is the correct solution?

Update CSSLanguage so that languageOptions.customSyntax can be a function. This should match the SyntaxExtensionCallback type.

In order to make it serializable, instead of passing directly into CSSTree, we'll instead import the default syntax:

import defaultSyntax from "@eslint/css-tree/definition-syntax-data";

Then call the custom syntax function and pass in defaultSyntax, then evaluate the resulting object before passing it to CSSTree. This mimics what CSSTree does internally with a function syntax extension

Participation

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

Additional comments

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Jan 7, 2026
@eslint-github-bot
Copy link

Hi @Copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@eslint-github-bot
Copy link

Hi @copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@eslint-github-bot
Copy link

Hi @Copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

1 similar comment
@eslint-github-bot
Copy link

Hi @Copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@eslint-github-bot
Copy link

Hi @copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

2 similar comments
@eslint-github-bot
Copy link

Hi @Copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@eslint-github-bot
Copy link

Hi @Copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@eslint-github-bot
Copy link

Hi @copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

1 similar comment
@eslint-github-bot
Copy link

Hi @copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

Copilot AI changed the title [WIP] Update customSyntax to accept function options Allow function-based customSyntax options Jan 7, 2026
Copilot AI requested a review from nzakas January 7, 2026 17:11
@eslint-github-bot
Copy link

Hi @copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@nzakas nzakas changed the title Allow function-based customSyntax options feat: Allow function-based customSyntax options Jan 7, 2026
@nzakas nzakas marked this pull request as ready for review January 7, 2026 21:25
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

@copilot fix the linting errors.

Comment on lines 232 to 236
// Convert function-based customSyntax to object if needed
let customSyntax = languageOptions.customSyntax;
if (typeof customSyntax === "function") {
customSyntax = customSyntax(defaultSyntax);
}
Copy link
Member

Choose a reason for hiding this comment

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

@copilot we don't need these. normalizeLanguageOptions() ensures languageOptions.customSyntax is an object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the redundant conversion logic in parse(). The function-to-object conversion now only happens in normalizeLanguageOptions(). Fixed in commit 5dcc991.

@nzakas nzakas moved this from Needs Triage to Implementing in Triage Jan 7, 2026
Copy link
Contributor Author

Copilot AI commented Jan 7, 2026

@copilot fix the linting errors.

Fixed linting errors by converting arrow functions to function declarations with proper JSDoc documentation. All linting errors are now resolved. Fixed in commit 5dcc991.

Copilot AI requested a review from nzakas January 7, 2026 21:40
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

LGTM.

@nzakas
Copy link
Member

nzakas commented Jan 7, 2026

@copilot run prettier to properly format the files.

@nzakas nzakas moved this from Implementing to Merge Candidates in Triage Jan 7, 2026
Copy link
Contributor Author

Copilot AI commented Jan 7, 2026

@copilot run prettier to properly format the files.

Ran prettier to format all files. Fixed in commit 11746fe.

Copilot AI requested a review from nzakas January 7, 2026 23:00
@nzakas nzakas merged commit 3479200 into main Jan 8, 2026
22 checks passed
@nzakas nzakas deleted the copilot/allow-function-customsyntax-options branch January 8, 2026 21:01
@github-project-automation github-project-automation bot moved this from Merge Candidates to Complete in Triage Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

Change Request: Allow function customSyntax options

2 participants