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

Fix no-prototype-builtins issue in Ruleset variables() #4272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Krinkle
Copy link

@Krinkle Krinkle commented Jul 15, 2024

What:

div {
  hasOwnProperty: blue;
}

http://lesscss.org/less-preview/#eyJjb2RlIjoiI2xpYigpIHtcbiAgICAuY29sb3JzKCkge1xuICAgICAgQHByaW1hcnk6IGJsdWU7XG4gICAgICBAc2Vjb25kYXJ5OiBncmVlbjtcbiAgICB9XG4gICAgLnJ1bGVzKEBzaXplKSB7XG4gICAgICBib3JkZXI6IEBzaXplIHNvbGlkIHdoaXRlO1xuICAgIH1cbiAgfVxuICBcbiAgLmJveCB3aGVuICgjbGliLmNvbG9yc1tAcHJpbWFyeV0gPSBibHVlKSB7XG4gICAgd2lkdGg6IDEwMHB4O1xuICAgIGhlaWdodDogKCR3aWR0aCAvIDIpO1xuICB9XG4gIFxuICAuYmFyOmV4dGVuZCguYm94KSB7XG4gICAgQG1lZGlhIChtaW4td2lkdGg6IDYwMHB4KSB7XG4gICAgICB3aWR0aDogMjAwcHg7XG4gICAgICAjbGliLnJ1bGVzKDFweCk7XG4gICAgfVxuICB9IiwiYWN0aXZlVmVyc2lvbiI6IjQuMi4wIiwibWF0aCI6InBhcmVucy1kaXZpc2lvbiIsInN0cmljdFVuaXRzIjpmYWxzZX0=

Why:

t.indexOf is not a function

The added test fails in CI without this patch as:

- /home/runner/work/less.js/less.js/packages/test-data/less/_main/property-name-interp: OK
ERROR: ruleList.indexOf is not a function

TypeError: ruleList.indexOf is not a function
    at ToCSSVisitor._removeDuplicateRules (/home/runner/work/less.js/less.js/packages/less/lib/less/visitors/to-css-visitor.js:282:34)
    at ToCSSVisitor.visitRuleset (/home/runner/work/less.js/less.js/packages/less/lib/less/visitors/to-css-visitor.js:232:18)
    at Visitor.visit (/home/runner/work/less.js/less.js/packages/less/lib/less/visitors/visitor.js:67:32)
    at Visitor.visitArray (/home/runner/work/less.js/less.js/packages/less/lib/less/visitors/visitor.js:105:30)
    at Ruleset.accept (/home/runner/work/less.js/less.js/packages/less/lib/less/tree/ruleset.js:42:34)
    at ToCSSVisitor.visitRuleset (/home/runner/work/less.js/less.js/packages/less/lib/less/visitors/to-css-visitor.js:227:25)
    at Visitor.visit (/home/runner/work/less.js/less.js/packages/less/lib/less/visitors/visitor.js:67:32)
    at ToCSSVisitor.run (/home/runner/work/less.js/less.js/packages/less/lib/less/visitors/to-css-visitor.js:81:30)
    at default_1 (/home/runner/work/less.js/less.js/packages/less/lib/less/transform-tree.js:78:21)
    at ParseTree.toCSS (/home/runner/work/less.js/less.js/packages/less/lib/less/parse-tree.js:18:58)
- /home/runner/work/less.js/less.js/packages/test-data/less/_main/scope: OK

I note that it doesn't say which LESS file the failure happened in, or which test case it was running (both would point to rulesets.less in this case).

Checklist:

  • Documentation: N/A
  • Added/updated unit tests
  • Code complete

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 15, 2024
@Krinkle Krinkle force-pushed the fix-hasown branch 2 times, most recently from f9d0f54 to 8543227 Compare July 15, 2024 20:19
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant