linaria/stylelint-config silently fails and thus doesn't work
See original GitHub issuebug
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
here is the culprit of muting processing errors https://github.com/callstack/linaria/blob/693919448f/src/stylelint/preprocessor.js#L21
when monorepo dependencies are bundled and present on the disk, it will work
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:
- Created 5 years ago
- Comments:9 (9 by maintainers)
Top GitHub Comments
the errors should no longer be ignored #339
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?
Yea we’ll do this
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.