Styled-jsx: stlyled-jsx/css is not compatible with eslint-plugin-import

Created on 12 Nov 2017  路  2Comments  路  Source: vercel/styled-jsx

Since stlyled-jsx/css do not actually exist, this confuses eslint-import, which checks if imports exist.

eslint-config-import would give errors like this:

Unable to resolve path to module 'styled-jsx/css'  import/no-unresolved

and this failed to pass our CI: https://travis-ci.org/cofacts/rumors-site/builds/300921835

Besides CI, I believe this would also confuse IDEs that checks for imports as well.

How about adding a stub file css.js (with a stub css function inside) so that it can be resolved correctly?

Most helpful comment

I keep ESLint quiet with import/core-modules:

// .eslintrc

{
  "parser": "babel-eslint",
  "extends": "airbnb",
  "env": {
    "node": true,
  },
  "settings": {
    "import/core-modules": ["styled-jsx", "styled-jsx/css"],
  },
  "rules": {
    // ...
  }
}

All 2 comments

I keep ESLint quiet with import/core-modules:

// .eslintrc

{
  "parser": "babel-eslint",
  "extends": "airbnb",
  "env": {
    "node": true,
  },
  "settings": {
    "import/core-modules": ["styled-jsx", "styled-jsx/css"],
  },
  "rules": {
    // ...
  }
}

Cool I didn't know about import/core-modules. Thanks a million!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rauchg picture rauchg  路  24Comments

jacobmischka picture jacobmischka  路  28Comments

coox picture coox  路  26Comments

rauchg picture rauchg  路  18Comments

thisbejim picture thisbejim  路  18Comments