stylex
stylex copied to clipboard
feat(@stylexjs/eslint-plugin): Accept { from: string, as: string } syntax in validImports option for RSD
What changed / motivation ?
React Strict DOM recently removed their eslint plugin and I'm considering migrating to @stylexjs/eslint-plugin
.
However, react-strict-dom exports stylex
under css
object, and it is it incompatible with current validImports
option in the eslint plugin.
e.g. This doesn't work:
module.exports = {
plugins: ['@stylexjs'],
rules: {
'@stylexjs/sort-keys': [
'error',
{
validImports: ['react-strict-dom']
},
],
},
};
I have added { from: string, as: string }
syntax similar to importSources
option in the babel plugin for compatibility with RSD, for both @stylexjs/sort-keys
and @stylexjs/valid-styles
rules.
e.g. now the option accepts this format:
{
validImports: [
{
from: 'react-strict-dom',
as: 'css',
},
],
},
Additional Context
- Added unit tests
- Updated the api docs
- I also checked the behavior locally in
apps/nextjs-example
dir by replacing imports with react-strict-dom and configuring with the new options as in the screenshot.
Pre-flight checklist
- [x] I have read the contributing guidelines Contribution Guidelines
- [x] Performed a self-review of my code