stylelint autofix doesn't work with linaria preprocess
Environment
- Linaria version: [email protected]
- [email protected]
- Bundler (+ version): [email protected]
- [email protected]
- [email protected]
- Node.js version: v12.18.3
- OS: OSX 10.15.6
Description
Stylelint autofix doesn't work. It works when I remove 'linaria/stylelint-config' from the extended presets.
command: npx stylelint "**/*.{tsx,css}" --fix
Error:
Autofix is incompatible with processors and will be disabled. Are you sure you need a processor?
TypeError: Cannot read property 'stringify' of null
at Root.toString (/Users/hannahjin/workspace/fork/repo/node_modules/postcss/lib/node.js:193:21)
at /Users/hannahjin/workspace/fork/repo/node_modules/stylelint/lib/standalone.js:254:44
at async Promise.all (index 0)
If I override the syntax to css-in-js for stylelint cli option npx stylelint "**/*.{tsx,css}" --syntax=css-in-js --fix, then I get
Error:
Autofix is incompatible with processors and will be disabled. Are you sure you need a processor?
Reproducible Demo
stylelint.config.js
module.exports = {
extends: ['stylelint-config-recommended', 'linaria/stylelint-config'],
plugins: ['stylelint-high-performance-animation'],
rules: {
'color-hex-case': 'lower',
'color-named': 'never',
'declaration-block-no-shorthand-property-overrides': null,
'font-weight-notation': 'numeric',
'length-zero-no-unit': true,
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: ['global'],
},
],
'plugin/no-low-performance-animation-properties': true,
},
};
Tested against a dummy component like
import * as React from 'react';
import { css } from 'linaria';
const special = css`
width: 100px;
padding: 0px 4px; /*expects auofix */
--webkit-box-sizing: border-box;
:global() {
font-weight: bold; /*expects error */
}
color: green; /*expects error */
transition: color 200ms; /*expects error */
`;
export const TestComponent: React.FC = () => {
return <div className={special}>Test</div>;
};
Are there any plans to support Stylelint 15 and Stylelint 16? Our project currently uses these versions of Stylelint, and we are encountering compatibility issues with the current version of the package.
Additionally, the syntax package we have been working with @stylelint/postcss-css-in-js is now deprecated. We've tried using @linaria/postcss-linaria and the @linaria/stylelint-config-standard-linaria configuration, but we are experiencing issues with autofix.
Could anyone from linaria team provide any guidance or updates on these matters ?