[7.x] [precommit] lint ts files with eslint (#36218) (#36236)

This commit is contained in:
Spencer 2019-05-08 07:52:14 -07:00 committed by GitHub
parent 57459dbc66
commit 9079b260fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -30,7 +30,7 @@ export function pickFilesToLint(log, files) {
const cli = new CLIEngine();
return files.filter(file => {
if (!file.isJs()) {
if (!file.isJs() && !file.isTypescript()) {
return;
}

View file

@ -119,14 +119,14 @@ async function checkForSnakeCase(log, files) {
const ignored = matchesAnyGlob(path, IGNORE_FILE_GLOBS);
if (ignored) {
log.debug('%j ignored', file);
log.debug('[casing] %j ignored', file);
return;
}
const pathToValidate = getPathWithoutIgnoredParents(file);
const invalid = NON_SNAKE_CASE_RE.test(pathToValidate);
if (!invalid) {
log.debug('%j uses valid casing', file);
log.debug('[casing] %j uses valid casing', file);
} else {
const ignoredParent = file.getRelativePath().slice(0, -pathToValidate.length);
errorPaths.push(`${dim(ignoredParent)}${pathToValidate}`);