Add ESLint rule for Typescript files

[MAILPOET-2658]
This commit is contained in:
Amine Ben hammou
2020-02-27 01:16:37 +01:00
committed by Jack Kitterhing
parent 9de1481efe
commit a669beed07
5 changed files with 220 additions and 2 deletions

View File

@@ -445,11 +445,22 @@ class RoboFile extends \Robo\Tasks {
)
->run();
}
if (substr($filePath, -4) === '.tsx' || substr($filePath, -3) === '.ts') {
// fix ESLint using TS rules
return $this->collectionBuilder()
->taskExec(
'npx eslint -c .eslintrc.ts.json ' .
'--max-warnings 0 ' .
'--fix ' .
$filePath
)
->run();
}
if (substr($filePath, -8) === '.spec.js') {
// fix ESLint using tests rules
return $this->collectionBuilder()
->taskExec(
'npx eslint -c .eslintrc.tests.json ' .
'npx eslint -c .eslintrc.tests_newsletter_editor.json ' .
'--max-warnings 0 ' .
'--fix ' .
$filePath