@atlaspack/validator-eslint 2.14.5-canary.14 → 2.14.5-canary.140

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 CHANGED
@@ -1,5 +1,133 @@
1
1
  # @atlaspack/validator-eslint
2
2
 
3
+ ## 2.14.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/utils@2.17.3
9
+ - @atlaspack/plugin@2.14.21
10
+
11
+ ## 2.14.20
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
16
+ - @atlaspack/plugin@2.14.20
17
+ - @atlaspack/utils@2.17.2
18
+
19
+ ## 2.14.19
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies []:
24
+ - @atlaspack/utils@2.17.1
25
+ - @atlaspack/plugin@2.14.19
26
+
27
+ ## 2.14.18
28
+
29
+ ### Patch Changes
30
+
31
+ - 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)]:
32
+ - @atlaspack/utils@2.17.0
33
+ - @atlaspack/plugin@2.14.18
34
+
35
+ ## 2.14.17
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies []:
40
+ - @atlaspack/utils@2.16.1
41
+ - @atlaspack/plugin@2.14.17
42
+
43
+ ## 2.14.16
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
48
+ - @atlaspack/utils@2.16.0
49
+ - @atlaspack/plugin@2.14.16
50
+
51
+ ## 2.14.15
52
+
53
+ ### Patch Changes
54
+
55
+ - Updated dependencies []:
56
+ - @atlaspack/utils@2.15.3
57
+ - @atlaspack/plugin@2.14.15
58
+
59
+ ## 2.14.14
60
+
61
+ ### Patch Changes
62
+
63
+ - Updated dependencies []:
64
+ - @atlaspack/utils@2.15.2
65
+ - @atlaspack/plugin@2.14.14
66
+
67
+ ## 2.14.13
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies []:
72
+ - @atlaspack/utils@2.15.1
73
+ - @atlaspack/plugin@2.14.13
74
+
75
+ ## 2.14.12
76
+
77
+ ### Patch Changes
78
+
79
+ - Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
80
+ - @atlaspack/utils@2.15.0
81
+ - @atlaspack/plugin@2.14.12
82
+
83
+ ## 2.14.11
84
+
85
+ ### Patch Changes
86
+
87
+ - Updated dependencies []:
88
+ - @atlaspack/utils@2.14.11
89
+ - @atlaspack/plugin@2.14.11
90
+
91
+ ## 2.14.10
92
+
93
+ ### Patch Changes
94
+
95
+ - Updated dependencies []:
96
+ - @atlaspack/plugin@2.14.10
97
+ - @atlaspack/utils@2.14.10
98
+
99
+ ## 2.14.9
100
+
101
+ ### Patch Changes
102
+
103
+ - Updated dependencies []:
104
+ - @atlaspack/utils@2.14.9
105
+ - @atlaspack/plugin@2.14.9
106
+
107
+ ## 2.14.8
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies []:
112
+ - @atlaspack/utils@2.14.8
113
+ - @atlaspack/plugin@2.14.8
114
+
115
+ ## 2.14.7
116
+
117
+ ### Patch Changes
118
+
119
+ - Updated dependencies []:
120
+ - @atlaspack/utils@2.14.7
121
+ - @atlaspack/plugin@2.14.7
122
+
123
+ ## 2.14.6
124
+
125
+ ### Patch Changes
126
+
127
+ - Updated dependencies []:
128
+ - @atlaspack/utils@2.14.6
129
+ - @atlaspack/plugin@2.14.6
130
+
3
131
  ## 2.14.5
4
132
 
5
133
  ### Patch Changes
@@ -0,0 +1,3 @@
1
+ import { Validator } from '@atlaspack/plugin';
2
+ declare const _default: Validator;
3
+ export default _default;
@@ -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.14+267b0d591",
3
+ "version": "2.14.5-canary.140+43fdd2238",
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.js",
12
+ "main": "./lib/EslintValidator.js",
13
+ "source": "./src/EslintValidator.ts",
14
+ "types": "./lib/EslintValidator.d.ts",
14
15
  "engines": {
15
16
  "node": ">= 16.0.0"
16
17
  },
17
18
  "dependencies": {
18
- "@atlaspack/diagnostic": "2.14.1-canary.82+267b0d591",
19
- "@atlaspack/plugin": "2.14.5-canary.14+267b0d591",
20
- "@atlaspack/utils": "2.14.5-canary.14+267b0d591",
19
+ "@atlaspack/diagnostic": "2.14.1-canary.208+43fdd2238",
20
+ "@atlaspack/plugin": "2.14.5-canary.140+43fdd2238",
21
+ "@atlaspack/utils": "2.14.5-canary.140+43fdd2238",
21
22
  "chalk": "^4.1.0"
22
23
  },
23
24
  "devDependencies": {
@@ -27,5 +28,8 @@
27
28
  "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
28
29
  },
29
30
  "type": "commonjs",
30
- "gitHead": "267b0d59131c00e4cd1526bbf87aa84b9c8fd411"
31
- }
31
+ "scripts": {
32
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src"
33
+ },
34
+ "gitHead": "43fdd223860fbc97af17d68c65419b97412cb888"
35
+ }
@@ -1,16 +1,19 @@
1
- // @flow
2
1
  import {Validator} from '@atlaspack/plugin';
3
- import {type DiagnosticCodeFrame, escapeMarkdown} from '@atlaspack/diagnostic';
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 (new Validator({
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
- }): Validator);
88
+ }) as Validator;
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["src"]
4
+ }