Page MenuHomePhabricator

Auto re-configure stylelint to lint vue files too
Open, Needs TriagePublic

Description

Right now we specify '**/*.{css,less}' in all the Gruntfile.jses. We need this to be '**/*.{css,less,vue}' instead, or upstream it somehow into stylelint the way eslint does it?

Event Timeline

grunt-eslint has no such feature, we would have to change *.{js,json} to *.{js,json,vue} as well.

Once grunt has handed a list of files to eslint/stylelint, then they can do their own filtering. This is where ESLint 7 added the ability to guess which file types to use based on overrides, so we don't have to pass the --extensions=js,json flag anymore. I think stylelint will just attempt to lint any files that grunt passes it.

We could change grunt-eslint to pass all files, and rely on ESLint to work out which ones are lintable, but this may have a performance impact in large repos. AFAIK stylelint has not such feature so you always have to tell in which file types you want linted.

So is the proposal to have libup find stuff like https://codesearch.wmcloud.org/search/?q=%5C*%5C*%2F%5C*.%5C%7Bcss%2Cless%5C%7D&i=nope&files=&repos= and add vue unconditionally to that list? Or should we only do it in repos with vue files?

And is this ready to move ahead on?

Same is true for HTML file style blocks in newer stylelint versions.
Compare Codex config:

"overrides": [
		{
			"files": [ "**/*.(less|css|html|vue)" ],
			"customSyntax": "postcss-less",
			"rules": {
				"function-no-unknown": null
			}
		},
		{
			"files": [ "**/*.(html|vue)" ],
			"customSyntax": "postcss-html"
		}
	],