Skip to content

Commit

Permalink
fix: Add missing CSS pseudo classes to types and ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
nikeee committed Sep 24, 2024
1 parent 2b77aad commit 3ddf402
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
26 changes: 24 additions & 2 deletions packages/eslint-plugin/__tests__/stylex-valid-styles-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ eslintTester.run('stylex-valid-styles', rule.default, {
'100%': {
opacity: 1,
},
});
});
const styles = create({
main: {
animationName: fadeIn,
Expand All @@ -174,7 +174,7 @@ eslintTester.run('stylex-valid-styles', rule.default, {
'100%': {
opacity: 1,
},
});
});
const styles = create({
main: {
animationName: fadeIn,
Expand Down Expand Up @@ -254,6 +254,28 @@ eslintTester.run('stylex-valid-styles', rule.default, {
},
},
})`,
// test for input ranges
`import stylex from "stylex";
stylex.create({
default: {
'WebkitAppearance': 'textfield',
'::-webkit-slider-thumb': {
appearance: 'none',
},
'::-webkit-slider-runnable-track': {
appearance: 'none',
},
'::-moz-range-thumb': {
appearance: 'none',
},
'::-moz-range-track': {
appearance: 'none',
},
'::-moz-range-progress': {
appearance: 'none',
},
},
})`,
// test for color
`import stylex from "stylex";
stylex.create({
Expand Down
7 changes: 7 additions & 0 deletions packages/eslint-plugin/src/stylex-valid-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,13 @@ const pseudoElements = makeUnionRule(
makeLiteralRule('::-webkit-scrollbar-track-piece'),
makeLiteralRule('::-webkit-scrollbar-corner'),
makeLiteralRule('::-webkit-resizer'),
// For input ranges in Chromium
makeLiteralRule('::-webkit-slider-thumb'),
makeLiteralRule('::-webkit-slider-runnable-track'),
// For input ranges in Firefox
makeLiteralRule('::-moz-range-thumb'),
makeLiteralRule('::-moz-range-track'),
makeLiteralRule('::-moz-range-progress'),
);

const pseudoClassesAndAtRules = makeUnionRule(
Expand Down
7 changes: 7 additions & 0 deletions packages/stylex/src/StyleXTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ type CSSPropertiesWithExtras = Partial<
'::-webkit-search-cancel-button'?: CSSProperties;
'::-webkit-search-results-button'?: CSSProperties;
'::-webkit-search-results-decoration'?: CSSProperties;
// For input ranges in Chromium
'::-webkit-slider-thumb'?: CSSProperties;
'::-webkit-slider-runnable-track'?: CSSProperties;
// For input ranges in Firefox
'::-moz-range-thumb'?: CSSProperties;
'::-moz-range-track'?: CSSProperties;
'::-moz-range-progress'?: CSSProperties;
}
>
>;
Expand Down

0 comments on commit 3ddf402

Please sign in to comment.