1
0
mirror of https://github.com/sasjs/lint.git synced 2026-01-09 05:20:06 +00:00

feat(path-lint): add support for linting file names, add lint config schema

This commit is contained in:
Krishna Acondy
2021-03-24 19:37:51 +00:00
parent c88aa8b3f6
commit c92630a8f9
13 changed files with 237 additions and 18 deletions

View File

@@ -0,0 +1,34 @@
import { PathLintRule } from '../types/LintRule'
import { LintRuleType } from '../types/LintRuleType'
import path from 'path'
import { Severity } from '../types/Severity'
const name = 'noSpacesInFileNames'
const description = 'Enforce the absence of spaces within file names.'
const message = 'File name contains spaces'
const test = (value: string) => {
const fileName = path.basename(value)
if (fileName.includes(' ')) {
return [
{
message,
lineNumber: 1,
startColumnNumber: 1,
endColumnNumber: 1,
severity: Severity.Warning
}
]
}
return []
}
/**
* Lint rule that checks for the absence of spaces in a given file name.
*/
export const noSpacesInFileNames: PathLintRule = {
type: LintRuleType.Path,
name,
description,
message,
test
}