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

chore(*): organise rules into folders by type

This commit is contained in:
Krishna Acondy
2021-04-07 16:34:33 +01:00
parent cc33ebb6e6
commit c9b6c3af95
26 changed files with 80 additions and 66 deletions

View File

@@ -0,0 +1,34 @@
import { PathLintRule } from '../../types/LintRule'
import { LintRuleType } from '../../types/LintRuleType'
import { Severity } from '../../types/Severity'
import path from 'path'
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
}