Skip to content

fix: allow additional properties in CSSLanguageOptions - #538

Open
lumirlumir wants to merge 4 commits into
mainfrom
fix/allow-additional-properties-in-csslanguageoptions
Open

lumirlumir wants to merge 4 commits into
mainfrom
fix/allow-additional-properties-in-csslanguageoptions

Conversation

@lumirlumir

@lumirlumir lumirlumir commented Aug 17, 2026

Copy link
Copy Markdown
Member

Prerequisites checklist

AI acknowledgment

  • I did not use AI to generate this PR.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

What is the purpose of this pull request?

While eslint/eslint#19615 (comment) determined that XXXLanguageOptions can have additional properties, and MarkdownLanguageOptions already extends the LanguageOptions type from @eslint/core, the corresponding CSSLanguageOptions does not allow additional properties.

What changes did you make? (Give an overview)

So, I’ve updated CSSLanguageOptions to extend LanguageOptions from @eslint/core and added type test cases to verify that it allows additional properties.

Just a note: CSSLanguageOptions was already being exported from the main entry point, so this PR doesn’t introduce a new feature and only includes a fix.

Related Issues

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

I found it while working on eslint/markdown#706.

Summary by CodeRabbit

  • Documentation

    • Improved TypeScript definitions for CSS language configuration options.
    • Added clearer typing for custom syntax configuration and syntax extension callbacks.
    • Clarified support for tolerant parsing and default syntax configuration.
  • Tests

    • Expanded type coverage for valid and invalid CSS language options, custom syntax settings, tolerant parsing, and property syntax validation.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Triage Aug 17, 2026
@eslint-github-bot eslint-github-bot Bot added the bug Something isn't working label Aug 17, 2026
@lumirlumir lumirlumir moved this from Needs Triage to Implementing in Triage Aug 17, 2026
@github-actions

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@github-actions github-actions Bot added the Stale label Sep 7, 2026
@lumirlumir lumirlumir removed the Stale label Sep 8, 2026
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a0943b8d-3a31-4f19-ab5f-438c98a131ee

📥 Commits

Reviewing files that changed from the base of the PR and between 0658aa0 and e5232d6.

📒 Files selected for processing (4)
  • src/languages/css-language.js
  • src/languages/css-source-code.js
  • src/types.ts
  • tests/types/types.test.ts

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The change moves CSS language option types into src/types.ts, updates CSS modules to import them from that module, and adds compile-time tests for language options and syntax extension types.

Changes

CSS type definitions

Layer / File(s) Summary
Shared CSS type contract
src/types.ts
The module exports DefaultSyntaxConfig and SyntaxExtensionCallback. It defines CSSLanguageOptions with tolerant and customSyntax properties.
Type consumers and validation
src/languages/css-language.js, src/languages/css-source-code.js, tests/types/types.test.ts
CSS language modules use the shared CSSLanguageOptions type. Type tests cover valid and invalid language options, syntax configurations, and extension callbacks.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: pixel998

Merge Risk: ⚪ Minimal · up to e5232

The relocated CSS type contract remains publicly available and is covered by package-facing compile-time assertions, with no actionable merge risk identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: allowing additional properties in CSSLanguageOptions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/allow-additional-properties-in-csslanguageoptions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread src/types.ts
Comment on lines +28 to +55
/**
* Default syntax configuration representing the structure returned by `@eslint/css-tree/definition-syntax-data`.
*/
export type DefaultSyntaxConfig = CSSTreeDefaultSyntaxConfig;

/**
* A callback used to extend the default CSS syntax configuration.
*/
export type SyntaxExtensionCallback = (
defaultSyntax: DefaultSyntaxConfig,
) => Partial<SyntaxConfig>;

/**
* Language options provided for CSS files.
*/
export interface CSSLanguageOptions extends LanguageOptions {
/**
* Whether to be tolerant of recoverable parsing errors.
* @default false
*/
tolerant?: boolean;

/**
* Custom syntax to use for parsing.
*/
customSyntax?: Partial<SyntaxConfig> | SyntaxExtensionCallback;
}

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.

These three types, which were previously inlined, have already been exported from the main entry point by the following code. Exporting them here does not introduce any new type exports.

export * from "./languages/css-language.js";

@lumirlumir lumirlumir moved this from Implementing to Needs Triage in Triage Sep 14, 2026
@lumirlumir
lumirlumir marked this pull request as ready for review September 14, 2026 09:24

@DMartens DMartens 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.

Changes LGTM, thanks. Leaving open for others to review.

@DMartens DMartens added the accepted There is consensus among the team that this change meets the criteria for inclusion label Sep 14, 2026
@DMartens DMartens moved this from Needs Triage to Merge Candidates in Triage Sep 14, 2026
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: Merge Candidates

Development

Successfully merging this pull request may close these issues.

2 participants