1
0
mirror of https://github.com/sasjs/lint.git synced 2026-04-10 07:53:15 +00:00

feat: new rule added 'strictMacroDefinition'

This commit is contained in:
Saad Jutt
2021-05-20 19:14:01 +05:00
parent e5780cd69a
commit dcfeb7a641
7 changed files with 190 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ import { LintConfig } from '../types/LintConfig'
import { getLintConfig } from './getLintConfig'
const expectedFileLintRulesCount = 4
const expectedLineLintRulesCount = 5
const expectedLineLintRulesCount = 6
const expectedPathLintRulesCount = 2
describe('getLintConfig', () => {

View File

@@ -17,7 +17,8 @@ export const DefaultLintConfiguration = {
indentationMultiple: 2,
hasMacroNameInMend: true,
noNestedMacros: true,
hasMacroParentheses: true
hasMacroParentheses: true,
strictMacroDefinition: true
}
/**

View File

@@ -6,11 +6,14 @@ export const trimComments = (
if (commentStarted || trimmed.startsWith('/*')) {
const parts = trimmed.split('*/')
if (parts.length > 1) {
if (parts.length === 2) {
return {
statement: (parts.pop() as string).trim(),
commentStarted: false
}
} else if (parts.length > 2) {
parts.shift()
return trimComments(parts.join('*/'), false)
} else {
return { statement: '', commentStarted: true }
}