I am getting the above error with stylint
. How to fix any one help me?
my scss
file:
@tailwind base;
@tailwind components;
@tailwind utilities;
/* end of import */
Error I am getting:
src/components/tabs/tabs.scss
15:16 ⚠ Unexpected missing end-of-source newline (no-missing-end-of-source-newline) [stylelint]
[vite:css] Unexpected missing end-of-source newline (no-missing-end-of-source-newline)
13 | }
14 |
15 | /* empty line */
| ^
stylelint
config:
/* eslint-env node */
module.exports = {
extends: [
'stylelint-config-standard',
'stylelint-config-recess-order',
'stylelint-config-css-modules',
'stylelint-config-prettier',
// Uncomment out the below if you want to use scss
'stylelint-config-standard-scss',
'stylelint-config-recommended-scss',
],
plugins: ['stylelint-scss'],
ignoreFiles: [
'./node_modules/**/*.css',
'./dist/**/*.css',
'./coverage/**/*.css',
],
rules: {
'at-rule-no-unknown': [
true,
{
ignoreAtRules: [
'tailwind',
'apply',
'screen',
'variants',
'responsive',
],
},
],
'no-duplicate-selectors': null,
'no-empty-source': null,
'rule-empty-line-before': null,
'comment-empty-line-before': null,
'selector-pseudo-element-no-unknown': null,
'declaration-block-trailing-semicolon': null,
'no-descending-specificity': null,
'string-no-newline': null,
// Limit the number of universal selectors in a selector,
// to avoid very slow selectors
'selector-max-universal': 1,
'selector-class-pattern': null,
// --------
// SCSS rules
// --------
'scss/dollar-variable-colon-space-before': 'never',
'scss/dollar-variable-colon-space-after': 'always',
'scss/dollar-variable-no-missing-interpolation': true,
'scss/dollar-variable-pattern': /^[a-z-]+$/,
'scss/double-slash-comment-whitespace-inside': 'always',
'scss/operator-no-newline-before': true,
'scss/operator-no-unspaced': true,
'scss/selector-no-redundant-nesting-selector': true,
// Allow SCSS and CSS module keywords beginning with `@`
'scss/at-rule-no-unknown': null,
},
};
The no-missing-end-of-source-newline
rule expects a newline at the end of the file. Add a newline to fix the problem:
@tailwind base;
@tailwind components;
@tailwind utilities;
/* end of import */
(Note the additional newline at the end.)
You should also extend Prettier's Stylelint configs last and there's no need to explicitly use postcss-scss
or stylelint-config-recommended-scss
as they are included in stylelint-config-standard-scss
.
Your config should be:
module.exports = {
extends: [
'stylelint-config-standard-scss',
'stylelint-config-css-modules',
'stylelint-config-recess-order',
'stylelint-config-prettier-scss'
],
ignoreFiles: [
'./node_modules/**/*.css',
'./dist/**/*.css',
'./coverage/**/*.css',
],
rules: {
'at-rule-no-unknown': [
true,
{
ignoreAtRules: [
'tailwind',
'apply',
'screen',
'variants',
'responsive',
],
},
],
'no-duplicate-selectors': null,
'no-empty-source': null,
'rule-empty-line-before': null,
'comment-empty-line-before': null,
'selector-pseudo-element-no-unknown': null,
'declaration-block-trailing-semicolon': null,
'no-descending-specificity': null,
'string-no-newline': null,
// Limit the number of universal selectors in a selector,
// to avoid very slow selectors
'selector-max-universal': 1,
'selector-class-pattern': null,
// --------
// SCSS rules
// --------
'scss/dollar-variable-colon-space-before': 'never',
'scss/dollar-variable-colon-space-after': 'always',
'scss/dollar-variable-no-missing-interpolation': true,
'scss/dollar-variable-pattern': /^[a-z-]+$/,
'scss/double-slash-comment-whitespace-inside': 'always',
'scss/operator-no-newline-before': true,
'scss/operator-no-unspaced': true,
'scss/selector-no-redundant-nesting-selector': true,
// Allow SCSS and CSS module keywords beginning with `@`
'scss/at-rule-no-unknown': null,
},
};