Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: generate-baseline misses many functions #72

Open
1 task done
rviscomi opened this issue Feb 26, 2025 · 1 comment · May be fixed by #74
Open
1 task done

Bug: generate-baseline misses many functions #72

rviscomi opened this issue Feb 26, 2025 · 1 comment · May be fixed by #74
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion bug Something isn't working

Comments

@rviscomi
Copy link
Contributor

Environment

Node version: v20.0.0
npm version: v9.6.4
Local ESLint version: v9.21.0 (Currently used)
Global ESLint version: Not found
@eslint/css version: 0.4.0
Operating System: darwin 23.6.0

Which language are you using?

stylesheet

What did you do?

Configuration
import globals from "globals";
import css from "@eslint/css";


/** @type {import('eslint').Linter.Config[]} */
export default [
  {
    languageOptions: {
      globals: globals.browser
    }
  },
  {
    files: ["**/*.css"],
    plugins: {
      css,
    },
    language: "css/css",
    rules: {
      "css/require-baseline": ["warn", {
        "available": "widely"
      }],
    },
  },
];
/** src/functions.css */
a {
  background: color-mix(in srgb, lightblue, white 80%);
}

div {
  background: conic-gradient(from 0deg at 0% 25%, blue, green, yellow 180deg);
}
npx eslint src/functions.css

What did you expect to happen?

ESLint should warn when Baseline newly available features like color-mix and conic-gradient are used.

I'd also expect the types map within baseline-data.js to include entries for functions like color-mix and conic-gradient.

There is a related color entry, but its Baseline status should be Newly available (5) according to MDN.

What actually happened?

ESLint doesn't emit any warnings for these newly available features, despite the config being set to widely available.

color-mix and conic-gradient aren't listed in the types map, and color has a Baseline status of Widely available (10).

Link to Minimal Reproducible Example

https://github.com/rviscomi/baseline-demos/blob/main/eslint/src/functions.css

Participation

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

Additional comments

The cssTypePattern regex seems to be responsible for this:

const cssTypePattern = /^css\.types\.(?<type>[a-zA-Z$\d-]+)$/u;

@rviscomi rviscomi added the bug Something isn't working label Feb 26, 2025
@nzakas nzakas added the accepted There is consensus among the team that this change meets the criteria for inclusion label Feb 26, 2025
@nzakas nzakas added this to Triage Feb 26, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Feb 26, 2025
@nzakas nzakas moved this from Needs Triage to Ready to Implement in Triage Feb 26, 2025
@nzakas
Copy link
Member

nzakas commented Feb 26, 2025

Thanks for the report. I've confirmed that this is a bug. I knew there were some edge cases where functions weren't getting flagged but just didn't have the time to investigate before the release. If you're up for submitting a pull request, we'd happily accept.

@rviscomi rviscomi linked a pull request Feb 26, 2025 that will close this issue
1 task
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: Ready to Implement
Development

Successfully merging a pull request may close this issue.

2 participants