question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

linaria/stylelint-config silently fails and thus doesn't work

See original GitHub issue

bug

What is the current behavior?

apparently stylelint-config preprocessor traverses all module dependencies(imports) and on error silently fails, which results in false outcomes -> no styling errors

image

here is the culprit of muting processing errors https://github.com/callstack/linaria/blob/693919448f/src/stylelint/preprocessor.js#L21

image

when monorepo dependencies are bundled and present on the disk, it will work image

This is bad DX as usually apps/libs are bundled in memory mode (in my case webpack-dev-server), so those module imports are not physically present on disk.

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.

// stylelint.config.js
const config = {
  extends: ['stylelint-config-recommended', 'linaria/stylelint-config'],
};
stylelint packages/**/*.{ts,tsx}
import React from 'react';
import { css } from 'linaria';

const someStyle = css`
  display: block;
  background-color: #333;
  color: pink !important;
  width: 200;
  widhzzz: 300;
`;

function App() {
  return <div className={someStyles} />;
}

What is the expected behavior?

So I see here 2 issues that need to be solved:

  • don’t swallow errors (properly emit occured error)
  • make lint work without traversing absolute module imports ( stylelint-processor-styled-components works like that )

Please provide your exact Babel configuration and mention your Linaria, Node, Yarn/npm version and operating system.

├─ linaria@1.2.4
└─ stylelint@9.10.1

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
satya164commented, Mar 6, 2019

the errors should no longer be ignored #339

1reaction
satya164commented, Mar 6, 2019

This is bad DX as usually apps/libs are bundled in memory mode (in my case webpack-dev-server), so those module imports are not physically present on disk.

Can you clarify what it means? I know the output files are written to memory fs for dev server, but why would the input modules be in memory fs?

don’t swallow errors (properly emit occured error)

Yea we’ll do this

make lint work without traversing absolute module imports ( stylelint-processor-styled-components works like that )

The styled components preprocessor is very limited (e.g. it can’t know the type of certain interpolations and you have to add comments to tell it). Linaria’s preprocessor evaluates the modules and is able to provide better linting as a result.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stylelint failing silently as npm script - Stack Overflow
It actually seems > stylelint 'css/**/*.css' --fix doesnt run at all via npm regardless of the fact it logs out to the console....
Read more >
@linaria/stylelint-config-standard-linaria - npm package | Snyk
The npm package @linaria/stylelint-config-standard-linaria was scanned for known vulnerabilities and missing license, and no issues were found.
Read more >
Linaria: Zero-runtime CSS in JS Library - Morioh
linaria : Zero-runtime CSS in JS library. Write CSS in JS, but with zero runtime, CSS is extracted to CSS files during build....
Read more >
@linaria/stylelint - npm
@linaria/stylelint. TypeScript icon, indicating that this package has built-in type declarations ... Zero-runtime CSS in JS library. Setup. Please ...
Read more >
material-ui - CHANGELOG.md - GitLab
75% of the components have been migrated so far, thanks to the help of the ... You can work around the problem by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found