Skip to content
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

Investigate CSS linting with sass-lint #281

Open
tulipdexter opened this issue Jan 15, 2019 · 2 comments
Open

Investigate CSS linting with sass-lint #281

tulipdexter opened this issue Jan 15, 2019 · 2 comments

Comments

@tulipdexter
Copy link
Contributor

tulipdexter commented Jan 15, 2019

Further to removing the CSS linting rules from the playbook documentation, there is some investigation to be done about whether we can have 1 linter instead of stylelint and sass-lint, and what the repercussions of that change would be.

@tulipdexter
Copy link
Contributor Author

tulipdexter commented Feb 1, 2019

Ok I investigated this.

Setup

  • 2 files, one .css and one .scss with the same code in them
  • 2 NPM scripts, running sass-lint using our config
  • Went through most of the rules in the @springernature/sasslint-config and created a CSS declaration for each one that should have failed the linting.
"scripts": {
    "sasslint": "sass-lint --config ./node_modules/@springernature/sasslint-config/config/.sass-lint.yml './scss/*.scss' -v",
    "sasslintcss": "sass-lint --config ./node_modules/@springernature/sasslint-config/config/.sass-lint.yml './css/*.css' -v",
}

Results

For the most part, sass-lint caught the errors in the CSS as well as the SCSS. But it didn't catch all. The ones it didn't catch are shown below:

/**
 --- space-before-brace ---
 */

/* Should fail but doesn't: Whitespace required before { */
.test{
	color: aliceblue;
}

/**
 --- indentation ---
 */

/* Should fail but doesn't - Mixed spaces and tabs */
.test {
	color: aliceblue;
	background: red;
}

/* Should fail but doesn't - Expected indentation of 1 tab but found 0 */
.test {
color: aliceblue;
background: red;
}

/* Should fail but doesn't - Expected indentation of 1 tab but found 0 */
.test {
		color: aliceblue;
		background: red;
}

/**
 --- empty-line-between-blocks ---
 */

/* Should fail but doesn't: Space expected between blocks */
.test {
	color: aliceblue;
}
.test {
	color: aliceblue;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants