When I added linaria/stylelint-config to .stylelintrc.js according to the document, I got the following error.
$ npx stylelint src/index.tsx --fix
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/ahu/workspace/tmp/my-react-template/node_modules/postcss/lib/node.js:193:21)
at /Users/ahu/workspace/tmp/my-react-template/node_modules/stylelint/lib/standalone.js:257:44
at async Promise.all (index 0)
Strangely, this error message is almost identical to that reported in https://github.com/stylelint/stylelint/issues/4481.
package.json
{
"name": "my-react-template",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "webpack-dev-server --open",
"build": "webpack -p",
"lint:type": "tsc",
"lint:format": "prettier -c --ignore-path .gitignore .",
"lint:ts": "eslint 'src/**/*.[tj]s{,x}'",
"lint:css": "stylelint -f verbose 'src/**'",
},
"dependencies": {
"@babel/runtime": "^7.9.6",
"core-js": "^3.6.5",
"linaria": "^1.4.0-beta.10",
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"devDependencies": {
"@babel/core": "^7.9.6",
"@babel/plugin-transform-runtime": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@babel/preset-react": "^7.9.4",
"@babel/preset-typescript": "^7.9.0",
"@types/react": "^16.9.35",
"@types/react-dom": "^16.9.8",
"@types/webpack": "^4.41.12",
"@types/webpack-dev-server": "^3.10.1",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"babel-loader": "^8.1.0",
"css-loader": "^3.5.3",
"eslint": "^7.0.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.0.1",
"html-webpack-plugin": "^4.3.0",
"mini-css-extract-plugin": "^0.9.0",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"prettier": "^2.0.5",
"stylelint": "^13.3.3",
"stylelint-config-prettier": "^8.0.1",
"stylelint-config-recess-order": "^2.0.4",
"stylelint-config-standard": "^20.0.0",
"typescript": "^3.9.2",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.11.0"
}
}
.stylelintrc.js
module.exports = {
extends: [
"stylelint-config-standard",
"stylelint-config-recess-order",
"linaria/stylelint-config",
"stylelint-config-prettier",
],
rules: {
"declaration-empty-line-before": null,
},
ignoreFiles: ["node_modules/**", "dist", ".linaria-cache"],
};
src/index.tsx
import { styled } from "linaria/react";
import React from "react";
import ReactDOM from "react-dom";
const Title = styled.h1`
font-size: 1.5em;
text-align: center;
`;
ReactDOM.render(<Title>Hello, React!</Title>, document.getElementById("root"));
Outputs of yarn lint:css --fix:
yarn run v1.22.4
$ stylelint -f verbose 'src/**' --fix
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/ahu/workspace/tmp/my-react-template/node_modules/postcss/lib/node.js:193:21)
at /Users/ahu/workspace/tmp/my-react-template/node_modules/stylelint/lib/standalone.js:257:44
at async Promise.all (index 2)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Hi @ahuglajbclajep, please provide a repository with a reproduction of the bug. We cannot afford to reproduce each bug on our own :( . And also many different factors may cause a bug, so we need a repro as working (or actually not working) project
This is the minimal reproduction repository: ahuglajbclajep/linaria_614
$ git clone [email protected]:ahuglajbclajep/linaria_614.git .
$ yarn install
$ yarn lint:css # or `npx stylelint src/index.tsx --fix`
Thanks @ahuglajbclajep 馃檹 We will once we have time
I checked this and this problem will occur in any config with processor. Basically as docs said https://stylelint.io/user-guide/configure#processors processors are not compatible with autofix feature.
Most helpful comment
Thanks @ahuglajbclajep 馃檹 We will once we have time