diff --git a/README.md b/README.md index b0206a5..4fa0a07 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Configuration is via a `.sasjslint` file with the following structure (these are "lowerCaseFileNames": true, "maxLineLength": 80, "noNestedMacros": true, + "noGremlins": true, "noSpacesInFileNames": true, "noTabs": true, "noTrailingSpaces": true, @@ -125,6 +126,15 @@ We strongly recommend a line length limit, and set the bar at 80. To turn this f - Default: 80 - Severity: WARNING +### noGremlins + +Capture zero-width whitespace and other non-standard characters. The logic is borrowed from the [VSCode Gremlins Extension](https://github.com/nhoizey/vscode-gremlins) - if you are looking for more advanced gremlin zapping capabilities, we highly recommend to use their extension instead. + +The list of characters can be found in this file: [https://github.com/sasjs/lint/blob/main/src/rules/line/noGremlins.ts](https://github.com/sasjs/lint/blob/main/src/rules/line/noGremlins.ts) + +- Default: true +- Severity: WARNING + ### noNestedMacros Where macros are defined inside other macros, they are recompiled every time the outer macro is invoked. Hence, it is widely considered inefficient, and bad practice, to nest macro definitions. diff --git a/sasjslint-schema.json b/sasjslint-schema.json index ea853c4..29644a7 100644 --- a/sasjslint-schema.json +++ b/sasjslint-schema.json @@ -13,6 +13,7 @@ "indentationMultiple": 2, "lowerCaseFileNames": true, "maxLineLength": 80, + "noGremlins": true, "noNestedMacros": true, "noSpacesInFileNames": true, "noTabs": true, @@ -29,6 +30,7 @@ "noSpacesInFileNames": true, "lowerCaseFileNames": true, "maxLineLength": 80, + "noGremlins": true, "noTabs": true, "indentationMultiple": 4, "hasMacroNameInMend": true, @@ -68,7 +70,7 @@ "$id": "#/properties/noGremlins", "type": "array", "title": "noGremlins", - "description": "", + "description": "Captures problematic characters such as zero-width whitespace and others that look valid but usually are not (such as the en dash)", "default": [true], "examples": [true, false] }, diff --git a/src/rules/line/noGremlins.ts b/src/rules/line/noGremlins.ts index 6e63321..f52d3f9 100644 --- a/src/rules/line/noGremlins.ts +++ b/src/rules/line/noGremlins.ts @@ -4,8 +4,8 @@ import { LintRuleType } from '../../types/LintRuleType' import { Severity } from '../../types/Severity' const name = 'noGremlins' -const description = 'Disallow characters specified in grimlins array' -const message = 'Line contains a grimlin' +const description = 'Disallow characters specified in gremlins array' +const message = 'Line contains a gremlin' const test = (value: string, lineNumber: number, config?: LintConfig) => { const severity = config?.severityLevel[name] || Severity.Warning @@ -45,7 +45,7 @@ const test = (value: string, lineNumber: number, config?: LintConfig) => { } /** - * Lint rule that checks if a given line of text contains any grimlin. + * Lint rule that checks if a given line of text contains any gremlins. */ export const noGremlins: LineLintRule = { type: LintRuleType.Line,