-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new stylelint
support.
#686
Comments
import styled from 'emotion'
const Container = styled('div')({
position: 'relative',
fontSize: 13,
fontWeight: 'bold',
lineHeight: '30px',
color: 'white',
textAlign: 'center',
cursor: 'default',
backgroundColor: 'gray',
borderRadius: 15,
size: 30,
marginTop: 10,
margin: '0 auto'
})
const Avatar = () => {
return h(Container)
}
export default Avatar {
"extends": [
"stylelint-config-standard"
]
} ➤ npm ls | grep stylelint
├─┬ [email protected]
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├─┬ [email protected]
├─┬ [email protected]
➤ npm ls | grep postcss-jsx
├─┬ [email protected]
➤ n stylelint components/avatar.js
TypeError: this[node.type] is not a function
at Stringifier.stringify (/home/ai/Dev/amplifr-front/node_modules/postcss/lib/stringifier.js:33:24)
at stringify (/home/ai/Dev/amplifr-front/node_modules/postcss/lib/stringify.js:14:9)
at Obj.toString (/home/ai/Dev/amplifr-front/node_modules/postcss/lib/node.js:195:9)
at module.exports (/home/ai/Dev/amplifr-front/node_modules/stylelint/lib/utils/rawNodeString.js:12:18)
at module.exports (/home/ai/Dev/amplifr-front/node_modules/stylelint/lib/utils/blockString.js:22:10)
at root.walkDecls.decl (/home/ai/Dev/amplifr-front/node_modules/stylelint/lib/rules/declaration-block-semicolon-newline-after/index.js:54:23)
at /home/ai/Dev/amplifr-front/node_modules/postcss/lib/container.js:188:28
at /home/ai/Dev/amplifr-front/node_modules/postcss/lib/container.js:144:26
at Obj.each (/home/ai/Dev/amplifr-front/node_modules/postcss/lib/container.js:110:22)
at Obj.walk (/home/ai/Dev/amplifr-front/node_modules/postcss/lib/container.js:143:21) |
import styled from 'stylelint'
const Container = styled.div`
position: relative;
font-size: 13px;
font-weight: bold;
line-height: 30px;
color: white;
text-align: center;
cursor: default;
background-color: gray;
border-radius: 15px;
size: 30px;
margin-top: 10px;
margin: 0 auto;
`
const Avatar = () => {
return h(Container)
}
export default Avatar
No error, margin overriding margin-top error was missed |
import styled from 'stylelint'
const Container = styled.div`
position: relative;
font-size: 13px;
font-weight: bold;
line-height: 30px;
color: white;
text-align: center;
cursor: default;
background-color: gray;
border-radius: 15px;
size: 30px;
margin-top: 10px;
margin: 0 auto;
`
const Avatar = () => {
return h(Container)
}
export default Avatar {
"processors": ["stylelint-processor-styled-components"],
"extends": [
"stylelint-config-standard"
]
}
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
@Andarist what do you think? |
the idea is good, im totally out of the loop here though, not knowing this tool etc and cant evaluate it right now also - what's this issue about? adding this to the docs? |
Yeap. Adding it to docs. |
Somebody would have to create a PR for this - preferably to some ecosystem/community-like page 😉 I think it should get merged in without much hesitation on our side. |
@gucong3000 will you send a PR? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Instead of working with issues, you created a bot which says “we don’t care” for you. Not good feedback for users and contributors. |
The PR is merged, just close the issue. |
Close this by #800. |
Not sure how #800 fixes this issue. It's just a reference to use stylelint. Tried adding |
FYI ended up getting it working with the above advice:
HOWEVER in my case I wanted to lint both |
@ilias-t Have you tried using parens instead? stylelint **/*.(css|tsx) When running '**/*.(js|jsx)' |
Anyone able to get this working these days with Edit: Hm.. definitely related to The discrepancy in lines is due to this though: const a = 1;
const b = 2;
const tweaks = css`
color: white; // some comment
^--- Error at 2:17, because line 1, as reported by stylelint, is the first line of the template literal
&& {
padding: 36px;
}
`; |
@slapbox I get the same issue. gonna try the comment about styled components |
there should be some docs on this :) |
There are more details over here: styled-components/styled-components#3607 (comment) Our config, which we use for linting CSS in
/** @type { import('stylelint').Config } */
const config = {
extends: [
'stylelint-config-recommended',
'stylelint-config-styled-components',
'stylelint-config-prettier',
],
rules: {
'no-descending-specificity': null,
},
overrides: [
{
files: [
'**/*.js',
'**/*.cjs',
'**/*.mjs',
'**/*.jsx',
'**/*.ts',
'**/*.tsx',
],
processors: ['stylelint-processor-styled-components'],
customSyntax: 'postcss-scss',
},
],
};
module.exports = config; It mostly works - at least better than nothing. As soon as either Emotion or Styled Components can provide an updated solution (eg. a |
I am working on
stylelint
andpostcss
that supportemotion
.I need more testing and feedback. Can someone help me?
All you need to do is just install postcss-jsx
processors
andsyntax
must remove from.stylelintrc
and CLIThe text was updated successfully, but these errors were encountered: