From bc7a7a764586ac5c40364b5d5b9814b4971ac98c Mon Sep 17 00:00:00 2001 From: Sabir Hassan Date: Mon, 20 Feb 2023 16:10:10 +0500 Subject: [PATCH] chore: add enum for lineEndings in sasjs-lint-schema.json --- README.md | 2 +- sasjslint-schema.json | 1 + src/types/LineEndings.ts | 3 ++- src/types/LintConfig.ts | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a259573..f23393f 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ This will check each line to ensure that the count of leading spaces can be divi ### lineEndings -This setting ensures the line endings in a file conform to the configured type. Possible values are `lf` and `crlf`. If the value is missing, null or undefined then the check would be switched off (no default applied). +This setting ensures the line endings in a file to conform the configured type. Possible values are `lf`, `crlf` and `off` (off means rule is set to be off). If the value is missing, null or undefined then the check would be switched off (no default applied). - Severity: WARNING diff --git a/sasjslint-schema.json b/sasjslint-schema.json index d533a3b..0736bbb 100644 --- a/sasjslint-schema.json +++ b/sasjslint-schema.json @@ -182,6 +182,7 @@ "lineEndings": { "$id": "#/properties/lineEndings", "type": "string", + "enum": ["lf", "crlf", "off"], "title": "lineEndings", "description": "Enforces the configured terminating character for each line. Shows a warning when incorrect line endings are present.", "default": "lf", diff --git a/src/types/LineEndings.ts b/src/types/LineEndings.ts index e40f19b..aa17edd 100644 --- a/src/types/LineEndings.ts +++ b/src/types/LineEndings.ts @@ -1,4 +1,5 @@ export enum LineEndings { LF = 'lf', - CRLF = 'crlf' + CRLF = 'crlf', + OFF = 'off' } diff --git a/src/types/LintConfig.ts b/src/types/LintConfig.ts index c4fff84..e77f7c5 100644 --- a/src/types/LintConfig.ts +++ b/src/types/LintConfig.ts @@ -82,7 +82,7 @@ export class LintConfig { } } - if (json?.lineEndings) { + if (json?.lineEndings && json.lineEndings !== LineEndings.OFF) { if ( json.lineEndings !== LineEndings.LF && json.lineEndings !== LineEndings.CRLF