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
Indentation rule #3427
Comments
I'm not why sass-lin allows the first line to be indented and that is ok /shrug Anyways, the indentation docs here show what stylelint indents. If you want to indent the closing brace on the last line you can do that per:
I'm also closing this as the current stylelint behaviour is intended as is. If you believe it is a bug in stylelint then please create a new issue using the template that includes your stylelint configuration and example code for us to reproduce the issue. |
Thanks for the feedback @ntwb. Before opening the call, I have a question: By analyzing the gif below, do you think it should have a consistency of stylelint? The stylelint is leaving indentation out of the set, just because there is no element at the top. The sass-lint accuses the inconsistency in these cases. What do you think about it? Thank you again. |
Indentation you're asking about should not be a concern of stylelint, because it's HTML indentation. <!DOCTYPE html>
<html lang="en">
<head>
<style>
body {
background: #fff;
}
</style>
</head>
<body>
</body>
</html> Stylelint doesn't care about HTML indentation. It respects whatever indentation HTML has, but it check styles indentation. |
Note that sass-lint validates the indentation also by considering the left wall of the style block. I'm just questioning this, as I'm migrating some projects with sass-lint for validation with stylelint. This non-validation can cause me problems at the time of the builds pipeline. @ntwb and @hudochenkov Do you think I should open an issue? |
@hudochenkov But, I'm working, on my projects, with SFC files from Vue.js (* .vue). Template for vue.js files (.vue): <template>
<span class="test">
{ test }
</span>
</template>
<script>
export default {
name: 'test',
data() {
return {
test: 'hello world!',
};
},
};
</script>
<style lang="scss" scoped>
.test {
margin: 10px;
}
</style>
|
I'm trying to solve this problem. "use strict";
const stylelint = require("stylelint") // npm i stylelint/stylelint#indent_infer
stylelint.lint({
code: `
<style>
a {
display:block;
}
</style>`,
codeFilename: "a.html",
config: {
rules: {
indentation: [
2,
{
baseIndentLevel: 0,
}
]
},
},
fix: true,
}).then(result => console.log(result.output)); $ node indent_test.js
<style>
a {
display:block;
}
</style> |
@CodeLittlePrince Please ensure your using the latest version of stylelint (by deleting your |
Hi,
I need help regarding a behavior in a rule.
We use sass-lint (https://github.com/sasstools/sass-lint) on some projects, but we're migrating to stylelint. In sass-lint, we use the
indentation
rule and it has a slightly different behavior in its validation.Look at the illustrations:
indentation with sass-lint
:indentation with stylelint
:We found that there is a difference in the validation. Sass-lint validates even the beginning of the style block, not allowing indentation in the initial part. If I indent all the contents of the block, the stylelint allows, but the sass-lint does not.
I wanted your opinion on this behavior. Does
sass-lint
validation make sense? Can I simulate the same validation with stylelint?Thanks in advance for your help,
Jackson
The text was updated successfully, but these errors were encountered: