@sasjs/lint 1.12.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{CONTRIBUTING.md → .github/CONTRIBUTING.md} +0 -0
- package/{PULL_REQUEST_TEMPLATE.md → .github/PULL_REQUEST_TEMPLATE.md} +0 -0
- package/.gitpod.yml +8 -0
- package/README.md +35 -7
- package/format/shared.js +1 -1
- package/format/shared.js.map +1 -1
- package/package.json +1 -1
- package/rules/file/hasDoxygenHeader.js +4 -2
- package/rules/file/hasDoxygenHeader.js.map +1 -1
- package/sasjslint-schema.json +10 -5
- package/types/LintConfig.d.ts +1 -0
- package/types/LintConfig.js +5 -0
- package/types/LintConfig.js.map +1 -1
- package/utils/getLintConfig.d.ts +2 -0
- package/utils/getLintConfig.js +7 -2
- package/utils/getLintConfig.js.map +1 -1
|
File without changes
|
|
File without changes
|
package/.gitpod.yml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# This configuration file was automatically generated by Gitpod.
|
|
2
|
+
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
|
|
3
|
+
# and commit this file to your remote git repository to share the goodness with others.
|
|
4
|
+
|
|
5
|
+
tasks:
|
|
6
|
+
- init: npm install && npm run build
|
|
7
|
+
|
|
8
|
+
|
package/README.md
CHANGED
|
@@ -23,18 +23,43 @@ Configuration is via a `.sasjslint` file with the following structure (these are
|
|
|
23
23
|
"hasDoxygenHeader": true,
|
|
24
24
|
"hasMacroNameInMend": true,
|
|
25
25
|
"hasMacroParentheses": true,
|
|
26
|
+
"ignoreList": [
|
|
27
|
+
"sajsbuild/",
|
|
28
|
+
"sasjsresults/"
|
|
29
|
+
],
|
|
26
30
|
"indentationMultiple": 2,
|
|
27
31
|
"lowerCaseFileNames": true,
|
|
28
32
|
"maxLineLength": 80,
|
|
29
33
|
"noNestedMacros": true,
|
|
30
34
|
"noSpacesInFileNames": true,
|
|
31
35
|
"noTabIndentation": true,
|
|
32
|
-
"noTrailingSpaces": true
|
|
36
|
+
"noTrailingSpaces": true,
|
|
37
|
+
"defaultHeader": "/**{lineEnding} @file{lineEnding} @brief <Your brief here>{lineEnding} <h4> SAS Macros </h4>{lineEnding}**/"
|
|
33
38
|
}
|
|
34
39
|
```
|
|
35
40
|
|
|
36
41
|
### SAS Lint Settings
|
|
37
42
|
|
|
43
|
+
#### defaultHeader
|
|
44
|
+
|
|
45
|
+
This sets the default program header - applies when a SAS program does NOT begin with `/**`. The default header is as follows:
|
|
46
|
+
|
|
47
|
+
```sas
|
|
48
|
+
/**
|
|
49
|
+
@file
|
|
50
|
+
@brief <Your brief here>
|
|
51
|
+
<h4> SAS Macros </h4>
|
|
52
|
+
**/
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The default header is automatically applied when running `sasjs lint fix` in the SASjs CLI, or by hitting "save" when using the SASjs VS Code extension. If creating a new value, use `{lineEnding}` instead of `\n`, eg as follows:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"defaultHeader": "/**{lineEnding} @file{lineEnding} @brief Our Company Brief{lineEnding}**/"
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
38
63
|
#### noEncodedPasswords
|
|
39
64
|
|
|
40
65
|
This will highlight any rows that contain a `{sas00X}` type password, or `{sasenc}`. These passwords (especially 001 and 002) are NOT secure, and should NEVER be pushed to source control or saved to the filesystem without special permissions applied.
|
|
@@ -60,6 +85,9 @@ As per the example [here](https://github.com/sasjs/lint/issues/20), macros defin
|
|
|
60
85
|
* Default: true
|
|
61
86
|
* Severity: WARNING
|
|
62
87
|
|
|
88
|
+
#### ignoreList
|
|
89
|
+
There may be specific files (or folders) that are not good candidates for linting. Simply list them in this array and they will be ignored. In addition, any files in the project `.gitignore` file will also be ignored.
|
|
90
|
+
|
|
63
91
|
#### indentationMultiple
|
|
64
92
|
This will check each line to ensure that the count of leading spaces can be divided cleanly by this multiple.
|
|
65
93
|
|
|
@@ -75,7 +103,7 @@ On *nix systems, it is imperative that autocall macros are in lowercase. When s
|
|
|
75
103
|
#### maxLineLength
|
|
76
104
|
Code becomes far more readable when line lengths are short. The most compelling reason for short line lengths is to avoid the need to scroll when performing a side-by-side 'compare' between two files (eg as part of a GIT feature branch review). A longer discussion on optimal code line length can be found [here](https://stackoverflow.com/questions/578059/studies-on-optimal-code-width)
|
|
77
105
|
|
|
78
|
-
In batch mode, long SAS code lines may also be truncated, causing hard-to-detect errors.
|
|
106
|
+
In batch mode, long SAS code lines may also be truncated, causing hard-to-detect errors.
|
|
79
107
|
|
|
80
108
|
We strongly recommend a line length limit, and set the bar at 80. To turn this feature off, set the value to 0.
|
|
81
109
|
|
|
@@ -83,7 +111,7 @@ We strongly recommend a line length limit, and set the bar at 80. To turn this
|
|
|
83
111
|
* Severity: WARNING
|
|
84
112
|
|
|
85
113
|
#### noNestedMacros
|
|
86
|
-
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.
|
|
114
|
+
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.
|
|
87
115
|
|
|
88
116
|
* Default: true
|
|
89
117
|
* Severity: WARNING
|
|
@@ -113,7 +141,7 @@ This will highlight lines with trailing spaces. Trailing spaces serve no useful
|
|
|
113
141
|
|
|
114
142
|
### Upcoming Linting Rules:
|
|
115
143
|
|
|
116
|
-
* `noTabs` -> does what it says on the tin
|
|
144
|
+
* `noTabs` -> does what it says on the tin
|
|
117
145
|
* `noGremlins` -> identifies all invisible characters, other than spaces / tabs / line endings. If you really need that bell character, use a hex literal!
|
|
118
146
|
* `lineEndings` -> set a standard line ending, such as LF or CRLF
|
|
119
147
|
|
|
@@ -123,13 +151,13 @@ A formatter will automatically apply rules when you hit SAVE, which can save a L
|
|
|
123
151
|
|
|
124
152
|
We've already implemented the following rules:
|
|
125
153
|
|
|
126
|
-
* Add the macro name to the %mend statement
|
|
127
|
-
* Add a doxygen header template if none exists
|
|
154
|
+
* Add the macro name to the %mend statement
|
|
155
|
+
* Add a doxygen header template if none exists
|
|
128
156
|
* Remove trailing spaces
|
|
129
157
|
|
|
130
158
|
We're looking to implement the following rules:
|
|
131
159
|
|
|
132
|
-
* Change tabs to spaces
|
|
160
|
+
* Change tabs to spaces
|
|
133
161
|
* zap gremlins
|
|
134
162
|
* fix line endings
|
|
135
163
|
|
package/format/shared.js
CHANGED
|
@@ -18,7 +18,7 @@ var processContent = function (config, content) {
|
|
|
18
18
|
config.fileLintRules
|
|
19
19
|
.filter(function (r) { return !!r.fix; })
|
|
20
20
|
.forEach(function (rule) {
|
|
21
|
-
processedContent = rule.fix(processedContent);
|
|
21
|
+
processedContent = rule.fix(processedContent, config);
|
|
22
22
|
});
|
|
23
23
|
return processedContent;
|
|
24
24
|
};
|
package/format/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/format/shared.ts"],"names":[],"mappings":";;;AACA,oDAAkD;AAClD,gDAA8C;AAEvC,IAAM,WAAW,GAAG,UAAC,IAAY,EAAE,MAAkB;IAC1D,IAAM,aAAa,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAClD,IAAM,KAAK,GAAG,qBAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;IAC9C,IAAM,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI;QACpC,OAAO,mBAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,IAAM,oBAAoB,GACxB,MAAM,CAAC,WAAW,KAAK,yBAAW,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAA;IACvD,OAAO,cAAc,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;AAClD,CAAC,CAAA;AAVY,QAAA,WAAW,eAUv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gBAAgB,EAAE,MAAM,CAAC,CAAA;IACxD,CAAC,CAAC,CAAA;IAEJ,OAAO,gBAAgB,CAAA;AACzB,CAAC,CAAA;AAEM,IAAM,WAAW,GAAG,UAAC,MAAkB,EAAE,IAAY;IAC1D,IAAI,aAAa,GAAG,IAAI,CAAA;IACxB,MAAM,CAAC,aAAa;SACjB,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,CAAC,CAAC,GAAG,EAAP,CAAO,CAAC;SACtB,OAAO,CAAC,UAAC,IAAI;QACZ,aAAa,GAAG,IAAI,CAAC,GAAI,CAAC,IAAI,CAAC,CAAA;IACjC,CAAC,CAAC,CAAA;IAEJ,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AATY,QAAA,WAAW,eASvB"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hasDoxygenHeader = void 0;
|
|
4
|
+
var types_1 = require("../../types");
|
|
4
5
|
var LineEndings_1 = require("../../types/LineEndings");
|
|
5
6
|
var LintRuleType_1 = require("../../types/LintRuleType");
|
|
6
7
|
var Severity_1 = require("../../types/Severity");
|
|
7
|
-
var
|
|
8
|
+
var getLintConfig_1 = require("../../utils/getLintConfig");
|
|
8
9
|
var name = 'hasDoxygenHeader';
|
|
9
10
|
var description = 'Enforce the presence of a Doxygen header at the start of each file.';
|
|
10
11
|
var message = 'File missing Doxygen header';
|
|
@@ -57,9 +58,10 @@ var fix = function (value, config) {
|
|
|
57
58
|
}
|
|
58
59
|
else if (result[0].message == messageForSingleAsterisk)
|
|
59
60
|
return value.replace('/*', '/**');
|
|
61
|
+
config = config || new types_1.LintConfig(getLintConfig_1.DefaultLintConfiguration);
|
|
60
62
|
var lineEndingConfig = (config === null || config === void 0 ? void 0 : config.lineEndings) || LineEndings_1.LineEndings.LF;
|
|
61
63
|
var lineEnding = lineEndingConfig === LineEndings_1.LineEndings.LF ? '\n' : '\r\n';
|
|
62
|
-
return "" +
|
|
64
|
+
return "" + (config === null || config === void 0 ? void 0 : config.defaultHeader.replace(/{lineEnding}/g, lineEnding)) + lineEnding + value;
|
|
63
65
|
};
|
|
64
66
|
/**
|
|
65
67
|
* Lint rule that checks for the presence of a Doxygen header in a given file.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasDoxygenHeader.js","sourceRoot":"","sources":["../../../src/rules/file/hasDoxygenHeader.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"hasDoxygenHeader.js","sourceRoot":"","sources":["../../../src/rules/file/hasDoxygenHeader.ts"],"names":[],"mappings":";;;AAAA,qCAAwC;AACxC,uDAAqD;AAErD,yDAAuD;AACvD,iDAA+C;AAC/C,2DAAoE;AAEpE,IAAM,IAAI,GAAG,kBAAkB,CAAA;AAC/B,IAAM,WAAW,GACf,qEAAqE,CAAA;AACvE,IAAM,OAAO,GAAG,6BAA6B,CAAA;AAC7C,IAAM,wBAAwB,GAC5B,+DAA+D,CAAA;AACjE,IAAM,IAAI,GAAG,UAAC,KAAa,EAAE,MAAmB;;IAC9C,IAAM,UAAU,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,MAAK,yBAAW,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA;IAC3E,IAAI;QACF,IAAM,aAAa,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QACzD,IAAI,aAAa;YAAE,OAAO,EAAE,CAAA;QAE5B,IAAM,+BAA+B,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QAC1E,IAAI,+BAA+B;YACjC,OAAO;gBACL;oBACE,OAAO,EAAE,wBAAwB;oBACjC,UAAU,EACR,CAAC,MAAA,KAAK,CAAC,KAAK,CAAC,IAAI,CAAE,CAA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M,CAAA;IAEtE,OAAO,MAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,CAAC,OAAO,CACrC,eAAe,EACf,UAAU,CACX,IAAG,UAAU,GAAG,KAAO,CAAA;AAC1B,CAAC,CAAA;AAED;;GAEG;AACU,QAAA,gBAAgB,GAAiB;IAC5C,IAAI,EAAE,2BAAY,CAAC,IAAI;IACvB,IAAI,MAAA;IACJ,WAAW,aAAA;IACX,OAAO,SAAA;IACP,IAAI,MAAA;IACJ,GAAG,KAAA;CACJ,CAAA"}
|
package/sasjslint-schema.json
CHANGED
|
@@ -17,7 +17,11 @@
|
|
|
17
17
|
"noTabIndentation": true,
|
|
18
18
|
"noTrailingSpaces": true,
|
|
19
19
|
"lineEndings": "lf",
|
|
20
|
-
"strictMacroDefinition": true
|
|
20
|
+
"strictMacroDefinition": true,
|
|
21
|
+
"ignoreList": [
|
|
22
|
+
"sajsbuild",
|
|
23
|
+
"sasjsresults"
|
|
24
|
+
]
|
|
21
25
|
},
|
|
22
26
|
"examples": [
|
|
23
27
|
{
|
|
@@ -33,7 +37,8 @@
|
|
|
33
37
|
"noNestedMacros": true,
|
|
34
38
|
"hasMacroParentheses": true,
|
|
35
39
|
"lineEndings": "crlf",
|
|
36
|
-
"strictMacroDefinition": true
|
|
40
|
+
"strictMacroDefinition": true,
|
|
41
|
+
"ignoreList": ["sajsbuild", "sasjsresults"]
|
|
37
42
|
}
|
|
38
43
|
],
|
|
39
44
|
"properties": {
|
|
@@ -143,11 +148,11 @@
|
|
|
143
148
|
},
|
|
144
149
|
"ignoreList": {
|
|
145
150
|
"$id": "#/properties/ignoreList",
|
|
146
|
-
"type": "
|
|
151
|
+
"type": "array",
|
|
147
152
|
"title": "ignoreList",
|
|
148
|
-
"description": "An array of paths or path patterns to ignore
|
|
153
|
+
"description": "An array of paths or path patterns to ignore when linting. Any files or matching patterns in the .gitignore file will also be ignored.",
|
|
149
154
|
"default": ["sasjsbuild/", "sasjsresults/"],
|
|
150
|
-
"examples": ["sasjs/
|
|
155
|
+
"examples": ["sasjs/tests", "tmp/scratch.sas"]
|
|
151
156
|
}
|
|
152
157
|
}
|
|
153
158
|
}
|
package/types/LintConfig.d.ts
CHANGED
package/types/LintConfig.js
CHANGED
|
@@ -5,6 +5,7 @@ var file_1 = require("../rules/file");
|
|
|
5
5
|
var line_1 = require("../rules/line");
|
|
6
6
|
var path_1 = require("../rules/path");
|
|
7
7
|
var LineEndings_1 = require("./LineEndings");
|
|
8
|
+
var utils_1 = require("../utils");
|
|
8
9
|
/**
|
|
9
10
|
* LintConfig is the logical representation of the .sasjslint file.
|
|
10
11
|
* It exposes two sets of rules - one to be run against each line in a file,
|
|
@@ -22,6 +23,7 @@ var LintConfig = /** @class */ (function () {
|
|
|
22
23
|
this.maxLineLength = 80;
|
|
23
24
|
this.indentationMultiple = 2;
|
|
24
25
|
this.lineEndings = LineEndings_1.LineEndings.LF;
|
|
26
|
+
this.defaultHeader = utils_1.getDefaultHeader();
|
|
25
27
|
if (json === null || json === void 0 ? void 0 : json.ignoreList) {
|
|
26
28
|
if (Array.isArray(json.ignoreList)) {
|
|
27
29
|
json.ignoreList.forEach(function (item) {
|
|
@@ -63,6 +65,9 @@ var LintConfig = /** @class */ (function () {
|
|
|
63
65
|
if (json === null || json === void 0 ? void 0 : json.hasDoxygenHeader) {
|
|
64
66
|
this.fileLintRules.push(file_1.hasDoxygenHeader);
|
|
65
67
|
}
|
|
68
|
+
if (json === null || json === void 0 ? void 0 : json.defaultHeader) {
|
|
69
|
+
this.defaultHeader = json.defaultHeader;
|
|
70
|
+
}
|
|
66
71
|
if (json === null || json === void 0 ? void 0 : json.noSpacesInFileNames) {
|
|
67
72
|
this.pathLintRules.push(path_1.noSpacesInFileNames);
|
|
68
73
|
}
|
package/types/LintConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LintConfig.js","sourceRoot":"","sources":["../../src/types/LintConfig.ts"],"names":[],"mappings":";;;AAAA,sC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aAAJ,IAAI,uBAAJ,IAAI,CAAE,mBAAmB,EAAE;YAC7B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,0BAAmB,CAAC,CAAA;SAC7C;QAED,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,kBAAkB,EAAE;YAC5B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,yBAAkB,CAAC,CAAA;SAC5C;QAED,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,kBAAkB,EAAE;YAC5B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,yBAAkB,CAAC,CAAA;SAC5C;QAED,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,cAAc,EAAE;YACxB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,qBAAc,CAAC,CAAA;SACxC;QAED,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,mBAAmB,EAAE;YAC7B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,0BAAmB,CAAC,CAAA;SAC7C;QAED,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,qBAAqB,EAAE;YAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,4BAAqB,CAAC,CAAA;SAC/C;IACH,CAAC;IACH,iBAAC;AAAD,CAAC,AA5FD,IA4FC;AA5FY,gCAAU"}
|
package/utils/getLintConfig.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LintConfig } from '../types/LintConfig';
|
|
2
|
+
export declare const getDefaultHeader: () => string;
|
|
2
3
|
/**
|
|
3
4
|
* Default configuration that is used when a .sasjslint file is not found
|
|
4
5
|
*/
|
|
@@ -15,6 +16,7 @@ export declare const DefaultLintConfiguration: {
|
|
|
15
16
|
noNestedMacros: boolean;
|
|
16
17
|
hasMacroParentheses: boolean;
|
|
17
18
|
strictMacroDefinition: boolean;
|
|
19
|
+
defaultHeader: string;
|
|
18
20
|
};
|
|
19
21
|
/**
|
|
20
22
|
* Fetches the config from the .sasjslint file and creates a LintConfig object.
|
package/utils/getLintConfig.js
CHANGED
|
@@ -39,11 +39,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.getLintConfig = exports.DefaultLintConfiguration = void 0;
|
|
42
|
+
exports.getLintConfig = exports.DefaultLintConfiguration = exports.getDefaultHeader = void 0;
|
|
43
43
|
var path_1 = __importDefault(require("path"));
|
|
44
44
|
var LintConfig_1 = require("../types/LintConfig");
|
|
45
45
|
var file_1 = require("@sasjs/utils/file");
|
|
46
46
|
var getProjectRoot_1 = require("./getProjectRoot");
|
|
47
|
+
var getDefaultHeader = function () {
|
|
48
|
+
return "/**{lineEnding} @file{lineEnding} @brief <Your brief here>{lineEnding} <h4> SAS Macros </h4>{lineEnding}**/";
|
|
49
|
+
};
|
|
50
|
+
exports.getDefaultHeader = getDefaultHeader;
|
|
47
51
|
/**
|
|
48
52
|
* Default configuration that is used when a .sasjslint file is not found
|
|
49
53
|
*/
|
|
@@ -59,7 +63,8 @@ exports.DefaultLintConfiguration = {
|
|
|
59
63
|
hasMacroNameInMend: true,
|
|
60
64
|
noNestedMacros: true,
|
|
61
65
|
hasMacroParentheses: true,
|
|
62
|
-
strictMacroDefinition: true
|
|
66
|
+
strictMacroDefinition: true,
|
|
67
|
+
defaultHeader: exports.getDefaultHeader()
|
|
63
68
|
};
|
|
64
69
|
/**
|
|
65
70
|
* Fetches the config from the .sasjslint file and creates a LintConfig object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLintConfig.js","sourceRoot":"","sources":["../../src/utils/getLintConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAuB;AACvB,kDAAgD;AAChD,0CAA4C;AAC5C,mDAAiD;
|
|
1
|
+
{"version":3,"file":"getLintConfig.js","sourceRoot":"","sources":["../../src/utils/getLintConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAuB;AACvB,kDAAgD;AAChD,0CAA4C;AAC5C,mDAAiD;AAE1C,IAAM,gBAAgB,GAAG;IAC9B,OAAA,gHAAgH;AAAhH,CAAgH,CAAA;AADrG,QAAA,gBAAgB,oBACqF;AAElH;;GAEG;AACU,QAAA,wBAAwB,GAAG;IACtC,gBAAgB,EAAE,IAAI;IACtB,kBAAkB,EAAE,IAAI;IACxB,gBAAgB,EAAE,IAAI;IACtB,mBAAmB,EAAE,IAAI;IACzB,kBAAkB,EAAE,IAAI;IACxB,aAAa,EAAE,EAAE;IACjB,gBAAgB,EAAE,IAAI;IACtB,mBAAmB,EAAE,CAAC;IACtB,kBAAkB,EAAE,IAAI;IACxB,cAAc,EAAE,IAAI;IACpB,mBAAmB,EAAE,IAAI;IACzB,qBAAqB,EAAE,IAAI;IAC3B,aAAa,EAAE,wBAAgB,EAAE;CAClC,CAAA;AAED;;;;GAIG;AACH,SAAsB,aAAa;;;;;wBACb,qBAAM,+BAAc,EAAE,EAAA;;oBAApC,WAAW,GAAG,SAAsB;oBACpB,qBAAM,eAAQ,CAClC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CACrC,CAAC,KAAK,CAAC,UAAC,CAAC;4BACR,OAAO,IAAI,CAAC,SAAS,CAAC,gCAAwB,CAAC,CAAA;wBACjD,CAAC,CAAC,EAAA;;oBAJI,aAAa,GAAG,SAIpB;oBACF,sBAAO,IAAI,uBAAU,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,EAAA;;;;CACjD;AARD,sCAQC"}
|