eslint-plugin-react-strict-dom

0.0.9 • Public • Published

eslint-plugin-react-strict-dom

A plugin to restrict styles to those that are supported on both web and native.

How to fix?

If the lint rule complains about a invalid style property, the following options exist:

  • Remove the invalid style.
  • Allow the invalid style, ignore the lint warning, and accept the runtime warning.
  • Split the component or its styles into separate *.web.js and *.native.js files.

Examples

✅ Examples of valid code for this rule:

You can either replace this with a valid property:

// Foo.js
const styles = stylex.create({
  root: {
    textAlign: 'center',
  },
});

❌ Examples of invalid code for this rule:

// Foo.js
const styles = css.create({
  root: {
    justifySelf: 'center', // `justifySelf` is not supported on native
  },
});

If you have to use a property on web that is unsupported on native, fork the implementation based on the platforms:

// Foo.web.js
// The plugin will ignore `*.web.js` files.
const styles = stylex.create({
  root: {
    justifySelf: 'center'
  },
});

// Foo.native.js
const styles = stylex.create({
  root: {
    textAlign: 'center'
  },
});

License

React Strict DOM is MIT licensed.

Readme

Keywords

none

Package Sidebar

Install

npm i eslint-plugin-react-strict-dom

Weekly Downloads

11

Version

0.0.9

License

MIT

Unpacked Size

51 kB

Total Files

9

Last publish

Collaborators

  • necolas