@atlaspack/validator-eslint 2.14.5-canary.17 → 2.14.5-canary.171
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/CHANGELOG.md +174 -0
- package/lib/EslintValidator.js +12 -0
- package/lib/types/EslintValidator.d.ts +3 -0
- package/package.json +12 -7
- package/src/{EslintValidator.js → EslintValidator.ts} +14 -4
- package/tsconfig.json +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,179 @@
|
|
|
1
1
|
# @atlaspack/validator-eslint
|
|
2
2
|
|
|
3
|
+
## 2.14.27
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @atlaspack/utils@2.18.4
|
|
9
|
+
- @atlaspack/plugin@2.14.27
|
|
10
|
+
|
|
11
|
+
## 2.14.26
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#742](https://github.com/atlassian-labs/atlaspack/pull/742) [`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd) Thanks [@yamadapc](https://github.com/yamadapc)! - Internal changes and bug fixes to environmentDeduplication flag
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd), [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2)]:
|
|
18
|
+
- @atlaspack/diagnostic@2.14.3
|
|
19
|
+
- @atlaspack/plugin@2.14.26
|
|
20
|
+
- @atlaspack/utils@2.18.3
|
|
21
|
+
|
|
22
|
+
## 2.14.25
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies []:
|
|
27
|
+
- @atlaspack/utils@2.18.2
|
|
28
|
+
- @atlaspack/plugin@2.14.25
|
|
29
|
+
|
|
30
|
+
## 2.14.24
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies []:
|
|
35
|
+
- @atlaspack/utils@2.18.1
|
|
36
|
+
- @atlaspack/plugin@2.14.24
|
|
37
|
+
|
|
38
|
+
## 2.14.23
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
|
|
43
|
+
- @atlaspack/utils@2.18.0
|
|
44
|
+
- @atlaspack/plugin@2.14.23
|
|
45
|
+
|
|
46
|
+
## 2.14.22
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- [#720](https://github.com/atlassian-labs/atlaspack/pull/720) [`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94) Thanks [@alshdavid](https://github.com/alshdavid)! - Migrate to TypeScript
|
|
51
|
+
|
|
52
|
+
- Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
|
|
53
|
+
- @atlaspack/diagnostic@2.14.2
|
|
54
|
+
- @atlaspack/plugin@2.14.22
|
|
55
|
+
- @atlaspack/utils@2.17.4
|
|
56
|
+
|
|
57
|
+
## 2.14.21
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Updated dependencies []:
|
|
62
|
+
- @atlaspack/utils@2.17.3
|
|
63
|
+
- @atlaspack/plugin@2.14.21
|
|
64
|
+
|
|
65
|
+
## 2.14.20
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
|
|
70
|
+
- @atlaspack/plugin@2.14.20
|
|
71
|
+
- @atlaspack/utils@2.17.2
|
|
72
|
+
|
|
73
|
+
## 2.14.19
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- Updated dependencies []:
|
|
78
|
+
- @atlaspack/utils@2.17.1
|
|
79
|
+
- @atlaspack/plugin@2.14.19
|
|
80
|
+
|
|
81
|
+
## 2.14.18
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- Updated dependencies [[`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d), [`de23e0c`](https://github.com/atlassian-labs/atlaspack/commit/de23e0ce49d5504fe3947ac26640a3d951087da3), [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417), [`a5ed1b4`](https://github.com/atlassian-labs/atlaspack/commit/a5ed1b414498560f393ff491af4da25b6e8dde56)]:
|
|
86
|
+
- @atlaspack/utils@2.17.0
|
|
87
|
+
- @atlaspack/plugin@2.14.18
|
|
88
|
+
|
|
89
|
+
## 2.14.17
|
|
90
|
+
|
|
91
|
+
### Patch Changes
|
|
92
|
+
|
|
93
|
+
- Updated dependencies []:
|
|
94
|
+
- @atlaspack/utils@2.16.1
|
|
95
|
+
- @atlaspack/plugin@2.14.17
|
|
96
|
+
|
|
97
|
+
## 2.14.16
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
|
|
102
|
+
- @atlaspack/utils@2.16.0
|
|
103
|
+
- @atlaspack/plugin@2.14.16
|
|
104
|
+
|
|
105
|
+
## 2.14.15
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- Updated dependencies []:
|
|
110
|
+
- @atlaspack/utils@2.15.3
|
|
111
|
+
- @atlaspack/plugin@2.14.15
|
|
112
|
+
|
|
113
|
+
## 2.14.14
|
|
114
|
+
|
|
115
|
+
### Patch Changes
|
|
116
|
+
|
|
117
|
+
- Updated dependencies []:
|
|
118
|
+
- @atlaspack/utils@2.15.2
|
|
119
|
+
- @atlaspack/plugin@2.14.14
|
|
120
|
+
|
|
121
|
+
## 2.14.13
|
|
122
|
+
|
|
123
|
+
### Patch Changes
|
|
124
|
+
|
|
125
|
+
- Updated dependencies []:
|
|
126
|
+
- @atlaspack/utils@2.15.1
|
|
127
|
+
- @atlaspack/plugin@2.14.13
|
|
128
|
+
|
|
129
|
+
## 2.14.12
|
|
130
|
+
|
|
131
|
+
### Patch Changes
|
|
132
|
+
|
|
133
|
+
- Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
|
|
134
|
+
- @atlaspack/utils@2.15.0
|
|
135
|
+
- @atlaspack/plugin@2.14.12
|
|
136
|
+
|
|
137
|
+
## 2.14.11
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- Updated dependencies []:
|
|
142
|
+
- @atlaspack/utils@2.14.11
|
|
143
|
+
- @atlaspack/plugin@2.14.11
|
|
144
|
+
|
|
145
|
+
## 2.14.10
|
|
146
|
+
|
|
147
|
+
### Patch Changes
|
|
148
|
+
|
|
149
|
+
- Updated dependencies []:
|
|
150
|
+
- @atlaspack/plugin@2.14.10
|
|
151
|
+
- @atlaspack/utils@2.14.10
|
|
152
|
+
|
|
153
|
+
## 2.14.9
|
|
154
|
+
|
|
155
|
+
### Patch Changes
|
|
156
|
+
|
|
157
|
+
- Updated dependencies []:
|
|
158
|
+
- @atlaspack/utils@2.14.9
|
|
159
|
+
- @atlaspack/plugin@2.14.9
|
|
160
|
+
|
|
161
|
+
## 2.14.8
|
|
162
|
+
|
|
163
|
+
### Patch Changes
|
|
164
|
+
|
|
165
|
+
- Updated dependencies []:
|
|
166
|
+
- @atlaspack/utils@2.14.8
|
|
167
|
+
- @atlaspack/plugin@2.14.8
|
|
168
|
+
|
|
169
|
+
## 2.14.7
|
|
170
|
+
|
|
171
|
+
### Patch Changes
|
|
172
|
+
|
|
173
|
+
- Updated dependencies []:
|
|
174
|
+
- @atlaspack/utils@2.14.7
|
|
175
|
+
- @atlaspack/plugin@2.14.7
|
|
176
|
+
|
|
3
177
|
## 2.14.6
|
|
4
178
|
|
|
5
179
|
### Patch Changes
|
package/lib/EslintValidator.js
CHANGED
|
@@ -33,14 +33,19 @@ function _assert() {
|
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
35
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
36
|
+
// @ts-expect-error TS7016
|
|
37
|
+
|
|
36
38
|
// For eslint <8.0.0
|
|
39
|
+
// @ts-expect-error TS7034
|
|
37
40
|
let cliEngine = null;
|
|
38
41
|
// For eslint >=8.0.0
|
|
42
|
+
// @ts-expect-error TS7034
|
|
39
43
|
let eslintEngine = null;
|
|
40
44
|
var _default = exports.default = new (_plugin().Validator)({
|
|
41
45
|
async validate({
|
|
42
46
|
asset
|
|
43
47
|
}) {
|
|
48
|
+
// @ts-expect-error TS7005
|
|
44
49
|
if (!cliEngine && !eslintEngine) {
|
|
45
50
|
if (_eslint().default.ESLint) {
|
|
46
51
|
eslintEngine = new (_eslint().default.ESLint)({});
|
|
@@ -50,9 +55,13 @@ var _default = exports.default = new (_plugin().Validator)({
|
|
|
50
55
|
}
|
|
51
56
|
let code = await asset.getCode();
|
|
52
57
|
let results;
|
|
58
|
+
// @ts-expect-error TS7005
|
|
53
59
|
if (cliEngine != null) {
|
|
60
|
+
// @ts-expect-error TS7005
|
|
54
61
|
results = cliEngine.executeOnText(code, asset.filePath).results;
|
|
62
|
+
// @ts-expect-error TS7005
|
|
55
63
|
} else if (eslintEngine != null) {
|
|
64
|
+
// @ts-expect-error TS7005
|
|
56
65
|
results = await eslintEngine.lintText(code, {
|
|
57
66
|
filePath: asset.filePath
|
|
58
67
|
});
|
|
@@ -68,6 +77,7 @@ var _default = exports.default = new (_plugin().Validator)({
|
|
|
68
77
|
let codeframe = {
|
|
69
78
|
filePath: asset.filePath,
|
|
70
79
|
code: result.source,
|
|
80
|
+
// @ts-expect-error TS7006
|
|
71
81
|
codeHighlights: result.messages.map(message => {
|
|
72
82
|
let start = {
|
|
73
83
|
line: message.line,
|
|
@@ -90,8 +100,10 @@ var _default = exports.default = new (_plugin().Validator)({
|
|
|
90
100
|
codeFrames: [codeframe]
|
|
91
101
|
};
|
|
92
102
|
if (result.errorCount > 0) {
|
|
103
|
+
// @ts-expect-error TS2345
|
|
93
104
|
validatorResult.errors.push(diagnostic);
|
|
94
105
|
} else {
|
|
106
|
+
// @ts-expect-error TS2345
|
|
95
107
|
validatorResult.warnings.push(diagnostic);
|
|
96
108
|
}
|
|
97
109
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/validator-eslint",
|
|
3
|
-
"version": "2.14.5-canary.
|
|
3
|
+
"version": "2.14.5-canary.171+f0349a6b9",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,15 +9,16 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/atlassian-labs/atlaspack.git"
|
|
11
11
|
},
|
|
12
|
-
"main": "lib/EslintValidator.js",
|
|
13
|
-
"source": "src/EslintValidator.
|
|
12
|
+
"main": "./lib/EslintValidator.js",
|
|
13
|
+
"source": "./src/EslintValidator.ts",
|
|
14
|
+
"types": "./lib/types/EslintValidator.d.ts",
|
|
14
15
|
"engines": {
|
|
15
16
|
"node": ">= 16.0.0"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@atlaspack/diagnostic": "2.14.1-canary.
|
|
19
|
-
"@atlaspack/plugin": "2.14.5-canary.
|
|
20
|
-
"@atlaspack/utils": "2.14.5-canary.
|
|
19
|
+
"@atlaspack/diagnostic": "2.14.1-canary.239+f0349a6b9",
|
|
20
|
+
"@atlaspack/plugin": "2.14.5-canary.171+f0349a6b9",
|
|
21
|
+
"@atlaspack/utils": "2.14.5-canary.171+f0349a6b9",
|
|
21
22
|
"chalk": "^4.1.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
@@ -27,5 +28,9 @@
|
|
|
27
28
|
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
28
29
|
},
|
|
29
30
|
"type": "commonjs",
|
|
30
|
-
"
|
|
31
|
+
"scripts": {
|
|
32
|
+
"check-ts": "tsc --emitDeclarationOnly --rootDir src",
|
|
33
|
+
"build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
|
|
34
|
+
},
|
|
35
|
+
"gitHead": "f0349a6b9b04755088f121095ca6301a2ada3767"
|
|
31
36
|
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import {Validator} from '@atlaspack/plugin';
|
|
3
|
-
import {
|
|
2
|
+
import {DiagnosticCodeFrame, escapeMarkdown} from '@atlaspack/diagnostic';
|
|
3
|
+
// @ts-expect-error TS7016
|
|
4
4
|
import eslint from 'eslint';
|
|
5
5
|
import invariant from 'assert';
|
|
6
6
|
|
|
7
7
|
// For eslint <8.0.0
|
|
8
|
+
// @ts-expect-error TS7034
|
|
8
9
|
let cliEngine = null;
|
|
9
10
|
// For eslint >=8.0.0
|
|
11
|
+
// @ts-expect-error TS7034
|
|
10
12
|
let eslintEngine = null;
|
|
11
13
|
|
|
12
|
-
export default
|
|
14
|
+
export default new Validator({
|
|
13
15
|
async validate({asset}) {
|
|
16
|
+
// @ts-expect-error TS7005
|
|
14
17
|
if (!cliEngine && !eslintEngine) {
|
|
15
18
|
if (eslint.ESLint) {
|
|
16
19
|
eslintEngine = new eslint.ESLint({});
|
|
@@ -21,9 +24,13 @@ export default (new Validator({
|
|
|
21
24
|
let code = await asset.getCode();
|
|
22
25
|
|
|
23
26
|
let results;
|
|
27
|
+
// @ts-expect-error TS7005
|
|
24
28
|
if (cliEngine != null) {
|
|
29
|
+
// @ts-expect-error TS7005
|
|
25
30
|
results = cliEngine.executeOnText(code, asset.filePath).results;
|
|
31
|
+
// @ts-expect-error TS7005
|
|
26
32
|
} else if (eslintEngine != null) {
|
|
33
|
+
// @ts-expect-error TS7005
|
|
27
34
|
results = await eslintEngine.lintText(code, {filePath: asset.filePath});
|
|
28
35
|
} else {
|
|
29
36
|
invariant(false);
|
|
@@ -40,6 +47,7 @@ export default (new Validator({
|
|
|
40
47
|
let codeframe: DiagnosticCodeFrame = {
|
|
41
48
|
filePath: asset.filePath,
|
|
42
49
|
code: result.source,
|
|
50
|
+
// @ts-expect-error TS7006
|
|
43
51
|
codeHighlights: result.messages.map((message) => {
|
|
44
52
|
let start = {
|
|
45
53
|
line: message.line,
|
|
@@ -67,12 +75,14 @@ export default (new Validator({
|
|
|
67
75
|
};
|
|
68
76
|
|
|
69
77
|
if (result.errorCount > 0) {
|
|
78
|
+
// @ts-expect-error TS2345
|
|
70
79
|
validatorResult.errors.push(diagnostic);
|
|
71
80
|
} else {
|
|
81
|
+
// @ts-expect-error TS2345
|
|
72
82
|
validatorResult.warnings.push(diagnostic);
|
|
73
83
|
}
|
|
74
84
|
}
|
|
75
85
|
|
|
76
86
|
return validatorResult;
|
|
77
87
|
},
|
|
78
|
-
})
|
|
88
|
+
}) as Validator;
|
package/tsconfig.json
ADDED