Use the new ESLint config for ./do qa:fix-file
[MAILPOET-5015]
This commit is contained in:
@@ -623,7 +623,8 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function qaFixFile($filePath) {
|
public function qaFixFile($filePath) {
|
||||||
if (substr($filePath, -4) === '.php') {
|
$extension = pathinfo($filePath, PATHINFO_EXTENSION);
|
||||||
|
if ($extension === 'php') {
|
||||||
// fix PHPCS rules
|
// fix PHPCS rules
|
||||||
return $this->collectionBuilder()
|
return $this->collectionBuilder()
|
||||||
->taskExec(
|
->taskExec(
|
||||||
@@ -634,48 +635,10 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
)
|
)
|
||||||
->run();
|
->run();
|
||||||
}
|
}
|
||||||
if (substr($filePath, -4) === '.jsx') {
|
if (in_array($extension, ['js', 'jsx', 'ts', 'tsx'], true)) {
|
||||||
// fix ESLint using ES6 rules
|
// fix ESLint rules
|
||||||
return $this->collectionBuilder()
|
return $this->collectionBuilder()
|
||||||
->taskExec(
|
->taskExec("pnpm eslint --max-warnings 0 --fix $filePath")
|
||||||
'npx ../eslint-config/node_modules/.bin/eslint -c ../eslint-config/.eslintrc.es6.js ' .
|
|
||||||
'--max-warnings 0 ' .
|
|
||||||
'--fix ' .
|
|
||||||
$filePath
|
|
||||||
)
|
|
||||||
->run();
|
|
||||||
}
|
|
||||||
if (substr($filePath, -4) === '.tsx' || substr($filePath, -3) === '.ts') {
|
|
||||||
// fix ESLint using TS rules
|
|
||||||
return $this->collectionBuilder()
|
|
||||||
->taskExec(
|
|
||||||
'npx ../eslint-config/node_modules/.bin/eslint -c ../eslint-config/.eslintrc.ts.js ' .
|
|
||||||
'--max-warnings 0 ' .
|
|
||||||
'--fix ' .
|
|
||||||
$filePath
|
|
||||||
)
|
|
||||||
->run();
|
|
||||||
}
|
|
||||||
if (substr($filePath, -8) === '.spec.js') {
|
|
||||||
// fix ESLint using tests rules
|
|
||||||
return $this->collectionBuilder()
|
|
||||||
->taskExec(
|
|
||||||
'npx ../eslint-config/node_modules/.bin/eslint -c ../eslint-config/.eslintrc.tests_newsletter_editor.js ' .
|
|
||||||
'--max-warnings 0 ' .
|
|
||||||
'--fix ' .
|
|
||||||
$filePath
|
|
||||||
)
|
|
||||||
->run();
|
|
||||||
}
|
|
||||||
if (substr($filePath, -3) === '.js') {
|
|
||||||
// fix ESLint using ES5 rules
|
|
||||||
return $this->collectionBuilder()
|
|
||||||
->taskExec(
|
|
||||||
'npx ../eslint-config/node_modules/.bin/eslint -c ../eslint-config/.eslintrc.es5.js ' .
|
|
||||||
'--max-warnings 0 ' .
|
|
||||||
'--fix ' .
|
|
||||||
$filePath
|
|
||||||
)
|
|
||||||
->run();
|
->run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user