Ensure linting is done for email editor JS and CSS files

MAILPOET-6215
This commit is contained in:
Oluwaseun Olorunsola
2024-11-05 19:34:22 +01:00
committed by Oluwaseun Olorunsola
parent 820cbd2939
commit ef4cf077ba
3 changed files with 89 additions and 74 deletions

View File

@@ -4,3 +4,4 @@
npx lint-staged -c mailpoet/package.json --cwd mailpoet
npx lint-staged -c package.json
npx lint-staged -c packages/js/email-editor/package.json --cwd packages/js/email-editor

View File

@@ -683,11 +683,21 @@ class RoboFile extends \Robo\Tasks {
}
public function qaLintJavascript() {
return $this->_exec('pnpm run check-types && pnpm run lint');
$collection = $this->collectionBuilder();
return $collection->taskExecStack()
->stopOnFail()
->exec('pnpm run check-types && pnpm run lint')
->exec('cd .. && cd packages/js/email-editor && pnpm run lint:js')
->run();
}
public function qaLintCss() {
return $this->_exec('pnpm run stylelint-check -- "assets/css/src/**/*.scss"');
$collection = $this->collectionBuilder();
return $collection->taskExecStack()
->stopOnFail()
->exec('pnpm run stylelint-check -- "assets/css/src/**/*.scss"')
->exec('cd .. && cd packages/js/email-editor && pnpm run lint:css')
->run();
}
public function qaCodeSniffer(array $filesToCheck, $opts = ['severity' => 'all']) {

View File

@@ -14,6 +14,10 @@
"lint:js": "wp-scripts lint-js ./src/**",
"lint:js-fix": "wp-scripts lint-js ./src/** --fix"
},
"lint-staged": {
"*.{scss,css}": "wp-scripts lint-style",
"*.{js,jsx,ts,tsx}": "wp-scripts lint-js ./src/**"
},
"dependencies": {
"@wordpress/api-fetch": "^7.0.0",
"@wordpress/block-editor": "^13.0.0",