@teambit/linter 0.0.880 → 0.0.882
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/dist/index.js +0 -8
- package/dist/index.js.map +1 -1
- package/dist/lint.cmd.js +0 -45
- package/dist/lint.cmd.js.map +1 -1
- package/dist/lint.task.js +2 -14
- package/dist/lint.task.js.map +1 -1
- package/dist/linter.aspect.js +0 -5
- package/dist/linter.aspect.js.map +1 -1
- package/dist/linter.composition.js +0 -6
- package/dist/linter.composition.js.map +1 -1
- package/dist/linter.graphql.js +0 -5
- package/dist/linter.graphql.js.map +1 -1
- package/dist/linter.main.runtime.js +2 -42
- package/dist/linter.main.runtime.js.map +1 -1
- package/dist/linter.service.js +0 -25
- package/dist/linter.service.js.map +1 -1
- package/package-tar/teambit-linter-0.0.882.tgz +0 -0
- package/package.json +9 -9
- package/{preview-1666312873430.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-linter-0.0.880.tgz +0 -0
package/dist/index.js
CHANGED
@@ -34,29 +34,21 @@ Object.defineProperty(exports, "LinterAspect", {
|
|
34
34
|
}
|
35
35
|
});
|
36
36
|
exports.default = void 0;
|
37
|
-
|
38
37
|
function _linter() {
|
39
38
|
const data = require("./linter.aspect");
|
40
|
-
|
41
39
|
_linter = function () {
|
42
40
|
return data;
|
43
41
|
};
|
44
|
-
|
45
42
|
return data;
|
46
43
|
}
|
47
|
-
|
48
44
|
function _linter2() {
|
49
45
|
const data = require("./linter");
|
50
|
-
|
51
46
|
_linter2 = function () {
|
52
47
|
return data;
|
53
48
|
};
|
54
|
-
|
55
49
|
return data;
|
56
50
|
}
|
57
|
-
|
58
51
|
var _default = _linter().LinterAspect;
|
59
|
-
|
60
52
|
exports.default = _default;
|
61
53
|
|
62
54
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["LinterAspect"],"sources":["index.ts"],"sourcesContent":["import { LinterAspect } from './linter.aspect';\n\nexport { LinterAspect };\nexport type { LinterMain, LinterConfig } from './linter.main.runtime';\nexport { LintResults, Linter, LintResult, ComponentLintResult } from './linter';\nexport type { LintTask } from './lint.task';\nexport type { LinterContext, LinterOptions } from './linter-context';\nexport default LinterAspect;\n"],"mappings":"
|
1
|
+
{"version":3,"names":["LinterAspect"],"sources":["index.ts"],"sourcesContent":["import { LinterAspect } from './linter.aspect';\n\nexport { LinterAspect };\nexport type { LinterMain, LinterConfig } from './linter.main.runtime';\nexport { LintResults, Linter, LintResult, ComponentLintResult } from './linter';\nexport type { LintTask } from './lint.task';\nexport type { LinterContext, LinterOptions } from './linter-context';\nexport default LinterAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAgF,eAGjEA,sBAAY;AAAA"}
|
package/dist/lint.cmd.js
CHANGED
@@ -1,58 +1,41 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
6
|
-
|
7
5
|
require("core-js/modules/es.promise.js");
|
8
|
-
|
9
6
|
require("core-js/modules/es.regexp.exec.js");
|
10
|
-
|
11
7
|
Object.defineProperty(exports, "__esModule", {
|
12
8
|
value: true
|
13
9
|
});
|
14
10
|
exports.LintCmd = void 0;
|
15
|
-
|
16
11
|
function _defineProperty2() {
|
17
12
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
18
|
-
|
19
13
|
_defineProperty2 = function () {
|
20
14
|
return data;
|
21
15
|
};
|
22
|
-
|
23
16
|
return data;
|
24
17
|
}
|
25
|
-
|
26
18
|
function _timer() {
|
27
19
|
const data = require("@teambit/legacy/dist/toolbox/timer");
|
28
|
-
|
29
20
|
_timer = function () {
|
30
21
|
return data;
|
31
22
|
};
|
32
|
-
|
33
23
|
return data;
|
34
24
|
}
|
35
|
-
|
36
25
|
function _chalk() {
|
37
26
|
const data = _interopRequireDefault(require("chalk"));
|
38
|
-
|
39
27
|
_chalk = function () {
|
40
28
|
return data;
|
41
29
|
};
|
42
|
-
|
43
30
|
return data;
|
44
31
|
}
|
45
|
-
|
46
32
|
function _lodash() {
|
47
33
|
const data = require("lodash");
|
48
|
-
|
49
34
|
_lodash = function () {
|
50
35
|
return data;
|
51
36
|
};
|
52
|
-
|
53
37
|
return data;
|
54
38
|
}
|
55
|
-
|
56
39
|
class LintCmd {
|
57
40
|
constructor(linter, componentHost, workspace) {
|
58
41
|
this.linter = linter;
|
@@ -63,7 +46,6 @@ class LintCmd {
|
|
63
46
|
(0, _defineProperty2().default)(this, "group", 'development');
|
64
47
|
(0, _defineProperty2().default)(this, "options", [['c', 'changed', 'lint only new and modified components'], ['f', 'fix', 'automatically fix problems'], ['', 'fix-type <fixType>', 'specify the types of fixes to apply (problem, suggestion, layout)'], ['j', 'json', 'return the lint results in json format']]);
|
65
48
|
}
|
66
|
-
|
67
49
|
async report([components = []], linterOptions) {
|
68
50
|
const {
|
69
51
|
code,
|
@@ -73,14 +55,11 @@ class LintCmd {
|
|
73
55
|
lintResults,
|
74
56
|
componentsIdsToLint
|
75
57
|
} = data;
|
76
|
-
|
77
58
|
const title = _chalk().default.bold(`linting total of ${_chalk().default.cyan(componentsIdsToLint.length.toString())} component(s) in workspace '${_chalk().default.cyan(this.componentHost.name)}'`);
|
78
|
-
|
79
59
|
const componentsOutputs = lintResults.results.map(lintRes => {
|
80
60
|
const compTitle = _chalk().default.bold.cyan(lintRes.componentId.toString({
|
81
61
|
ignoreVersion: true
|
82
62
|
}));
|
83
|
-
|
84
63
|
const compOutput = lintRes.output;
|
85
64
|
return `${compTitle}\n${compOutput}`;
|
86
65
|
}).join('\n');
|
@@ -90,7 +69,6 @@ class LintCmd {
|
|
90
69
|
data: `${title}\n\n${componentsOutputs}\n\n${summary}`
|
91
70
|
};
|
92
71
|
}
|
93
|
-
|
94
72
|
getSummarySection(data) {
|
95
73
|
const {
|
96
74
|
duration,
|
@@ -126,15 +104,12 @@ class LintCmd {
|
|
126
104
|
const summary = `${summaryTitle}\n${summaryTotals}`;
|
127
105
|
return summary;
|
128
106
|
}
|
129
|
-
|
130
107
|
renderTotalLine(componentsCount, itemsCount, fieldLabel) {
|
131
108
|
if (itemsCount === 0) return undefined;
|
132
109
|
return `total of ${_chalk().default.green(itemsCount.toString())} ${_chalk().default.cyan(fieldLabel)} (from ${_chalk().default.green(componentsCount.toString())} components)`;
|
133
110
|
}
|
134
|
-
|
135
111
|
async json([components = []], linterOptions) {
|
136
112
|
const timer = _timer().Timer.create();
|
137
|
-
|
138
113
|
timer.start();
|
139
114
|
const componentsIds = await this.getIdsToLint(components, linterOptions.changed);
|
140
115
|
const componentsToLint = await this.workspace.getMany(componentsIds);
|
@@ -146,11 +121,9 @@ class LintCmd {
|
|
146
121
|
const jsonLinterResults = toJsonLintResults(linterResults);
|
147
122
|
const timerResponse = timer.stop();
|
148
123
|
let code = 0;
|
149
|
-
|
150
124
|
if (jsonLinterResults.totalErrorCount || jsonLinterResults.totalFatalErrorCount) {
|
151
125
|
code = 1;
|
152
126
|
}
|
153
|
-
|
154
127
|
return {
|
155
128
|
code,
|
156
129
|
data: {
|
@@ -160,23 +133,17 @@ class LintCmd {
|
|
160
133
|
}
|
161
134
|
};
|
162
135
|
}
|
163
|
-
|
164
136
|
async getIdsToLint(components, changed = false) {
|
165
137
|
if (components.length) {
|
166
138
|
return this.workspace.resolveMultipleComponentIds(components);
|
167
139
|
}
|
168
|
-
|
169
140
|
if (changed) {
|
170
141
|
return this.workspace.getNewAndModifiedIds();
|
171
142
|
}
|
172
|
-
|
173
143
|
return this.componentHost.listIds();
|
174
144
|
}
|
175
|
-
|
176
145
|
}
|
177
|
-
|
178
146
|
exports.LintCmd = LintCmd;
|
179
|
-
|
180
147
|
function toJsonLintResults(results) {
|
181
148
|
let totalErrorCount = 0;
|
182
149
|
let totalFatalErrorCount = 0;
|
@@ -190,50 +157,38 @@ function toJsonLintResults(results) {
|
|
190
157
|
let totalComponentsWithWarningCount = 0;
|
191
158
|
const newResults = results.results.map(res => {
|
192
159
|
var _res$data;
|
193
|
-
|
194
160
|
const resultsWithoutComponent = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.results.map(result => {
|
195
161
|
return Object.assign({}, {
|
196
162
|
componentId: result.component.id
|
197
163
|
}, (0, _lodash().omit)(result, ['component']));
|
198
164
|
});
|
199
|
-
|
200
165
|
if (res.data) {
|
201
166
|
if (res.data.totalErrorCount) {
|
202
167
|
var _res$data$totalCompon;
|
203
|
-
|
204
168
|
totalErrorCount += res.data.totalErrorCount;
|
205
169
|
totalComponentsWithErrorCount += (_res$data$totalCompon = res.data.totalComponentsWithErrorCount) !== null && _res$data$totalCompon !== void 0 ? _res$data$totalCompon : 0;
|
206
170
|
}
|
207
|
-
|
208
171
|
if (res.data.totalFatalErrorCount) {
|
209
172
|
var _res$data$totalCompon2;
|
210
|
-
|
211
173
|
totalFatalErrorCount += res.data.totalFatalErrorCount;
|
212
174
|
totalComponentsWithFatalErrorCount += (_res$data$totalCompon2 = res.data.totalComponentsWithFatalErrorCount) !== null && _res$data$totalCompon2 !== void 0 ? _res$data$totalCompon2 : 0;
|
213
175
|
}
|
214
|
-
|
215
176
|
if (res.data.totalFixableErrorCount) {
|
216
177
|
var _res$data$totalCompon3;
|
217
|
-
|
218
178
|
totalFixableErrorCount += res.data.totalFixableErrorCount;
|
219
179
|
totalComponentsWithFixableErrorCount += (_res$data$totalCompon3 = res.data.totalComponentsWithFixableErrorCount) !== null && _res$data$totalCompon3 !== void 0 ? _res$data$totalCompon3 : 0;
|
220
180
|
}
|
221
|
-
|
222
181
|
if (res.data.totalFixableWarningCount) {
|
223
182
|
var _res$data$totalCompon4;
|
224
|
-
|
225
183
|
totalFixableWarningCount += res.data.totalFixableWarningCount;
|
226
184
|
totalComponentsWithFixableWarningCount += (_res$data$totalCompon4 = res.data.totalComponentsWithFixableWarningCount) !== null && _res$data$totalCompon4 !== void 0 ? _res$data$totalCompon4 : 0;
|
227
185
|
}
|
228
|
-
|
229
186
|
if (res.data.totalWarningCount) {
|
230
187
|
var _res$data$totalCompon5;
|
231
|
-
|
232
188
|
totalWarningCount += res.data.totalWarningCount;
|
233
189
|
totalComponentsWithWarningCount += (_res$data$totalCompon5 = res.data.totalComponentsWithWarningCount) !== null && _res$data$totalCompon5 !== void 0 ? _res$data$totalCompon5 : 0;
|
234
190
|
}
|
235
191
|
}
|
236
|
-
|
237
192
|
return (0, _lodash().compact)(resultsWithoutComponent);
|
238
193
|
});
|
239
194
|
return {
|
package/dist/lint.cmd.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["LintCmd","constructor","linter","componentHost","workspace","report","components","linterOptions","code","data","json","lintResults","componentsIdsToLint","title","chalk","bold","cyan","length","toString","name","componentsOutputs","results","map","lintRes","compTitle","componentId","ignoreVersion","compOutput","output","join","summary","getSummarySection","duration","seconds","summaryTitle","totalFieldsMap","itemsDataField","componentsDataField","label","summaryTotals","item","renderTotalLine","filter","Boolean","componentsCount","itemsCount","fieldLabel","undefined","green","timer","Timer","create","start","componentsIds","getIdsToLint","changed","componentsToLint","getMany","opts","fix","fixTypes","fixType","split","linterResults","lint","jsonLinterResults","toJsonLintResults","timerResponse","stop","totalErrorCount","totalFatalErrorCount","comp","id","resolveMultipleComponentIds","getNewAndModifiedIds","listIds","totalFixableErrorCount","totalFixableWarningCount","totalWarningCount","totalComponentsWithErrorCount","totalComponentsWithFatalErrorCount","totalComponentsWithFixableErrorCount","totalComponentsWithFixableWarningCount","totalComponentsWithWarningCount","newResults","res","resultsWithoutComponent","result","Object","assign","component","omit","compact","flatten","errors"],"sources":["lint.cmd.ts"],"sourcesContent":["import { TimerResponse, Timer } from '@teambit/legacy/dist/toolbox/timer';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { ComponentFactory, ComponentID } from '@teambit/component';\nimport chalk from 'chalk';\nimport { EnvsExecutionResult } from '@teambit/envs';\nimport { Workspace } from '@teambit/workspace';\nimport { compact, flatten, omit } from 'lodash';\nimport { LinterMain } from './linter.main.runtime';\nimport { ComponentLintResult, LintResults } from './linter';\nimport { FixTypes, LinterOptions } from './linter-context';\n\nexport type LintCmdOptions = {\n changed?: boolean;\n fix?: boolean;\n fixType?: string;\n json?: boolean;\n};\n\n/**\n * A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component\n */\nexport type JsonComponentLintResult = Omit<ComponentLintResult, 'component'> & {\n componentId: ComponentID;\n};\n\nexport type JsonLintDataResults = Omit<LintResults, 'results'> & { results: JsonComponentLintResult[] };\n/**\n * A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component\n */\nexport type JsonLintResultsData = {\n duration: TimerResponse;\n lintResults: JsonLintDataResults;\n componentsIdsToLint: string[];\n};\n\nexport type JsonLintResults = {\n code: number;\n data: JsonLintResultsData;\n};\n\nexport class LintCmd implements Command {\n name = 'lint [component...]';\n description = 'lint components in the development workspace';\n group = 'development';\n options = [\n ['c', 'changed', 'lint only new and modified components'],\n ['f', 'fix', 'automatically fix problems'],\n ['', 'fix-type <fixType>', 'specify the types of fixes to apply (problem, suggestion, layout)'],\n ['j', 'json', 'return the lint results in json format'],\n ] as CommandOptions;\n\n constructor(private linter: LinterMain, private componentHost: ComponentFactory, private workspace: Workspace) {}\n\n async report([components = []]: [string[]], linterOptions: LintCmdOptions) {\n const { code, data } = await this.json([components], linterOptions);\n const { lintResults, componentsIdsToLint } = data;\n const title = chalk.bold(\n `linting total of ${chalk.cyan(componentsIdsToLint.length.toString())} component(s) in workspace '${chalk.cyan(\n this.componentHost.name\n )}'`\n );\n\n const componentsOutputs = lintResults.results\n .map((lintRes) => {\n const compTitle = chalk.bold.cyan(lintRes.componentId.toString({ ignoreVersion: true }));\n const compOutput = lintRes.output;\n return `${compTitle}\\n${compOutput}`;\n })\n .join('\\n');\n\n const summary = this.getSummarySection(data);\n return { code, data: `${title}\\n\\n${componentsOutputs}\\n\\n${summary}` };\n }\n\n private getSummarySection(data: JsonLintResultsData) {\n const { duration, lintResults, componentsIdsToLint } = data;\n const { seconds } = duration;\n const summaryTitle = `linted ${chalk.cyan(componentsIdsToLint.length.toString())} components in ${chalk.cyan(\n seconds.toString()\n )} seconds`;\n\n const totalFieldsMap = [\n { itemsDataField: 'totalErrorCount', componentsDataField: 'totalComponentsWithErrorCount', label: 'Errors' },\n {\n itemsDataField: 'totalFatalErrorCount',\n componentsDataField: 'totalComponentsWithFatalErrorCount',\n label: 'FatalErrors',\n },\n {\n itemsDataField: 'totalFixableErrorCount',\n componentsDataField: 'totalComponentsWithFixableErrorCount',\n label: 'FixableErrors',\n },\n {\n itemsDataField: 'totalFixableWarningCount',\n componentsDataField: 'totalComponentsWithFixableWarningCount',\n label: 'FixableWarnings',\n },\n {\n itemsDataField: 'totalWarningCount',\n componentsDataField: 'totalComponentsWithWarningCount',\n label: 'Warnings',\n },\n ];\n\n const summaryTotals = totalFieldsMap\n .map((item) =>\n this.renderTotalLine(lintResults[item.componentsDataField], lintResults[item.itemsDataField], item.label)\n )\n .filter(Boolean)\n .join('\\n');\n const summary = `${summaryTitle}\\n${summaryTotals}`;\n return summary;\n }\n\n private renderTotalLine(componentsCount: number, itemsCount: number, fieldLabel: string): string | undefined {\n if (itemsCount === 0) return undefined;\n return `total of ${chalk.green(itemsCount.toString())} ${chalk.cyan(fieldLabel)} (from ${chalk.green(\n componentsCount.toString()\n )} components)`;\n }\n\n async json([components = []]: [string[]], linterOptions: LintCmdOptions): Promise<JsonLintResults> {\n const timer = Timer.create();\n timer.start();\n const componentsIds = await this.getIdsToLint(components, linterOptions.changed);\n const componentsToLint = await this.workspace.getMany(componentsIds);\n const opts: LinterOptions = {\n fix: linterOptions.fix,\n fixTypes: linterOptions.fixType ? (linterOptions.fixType.split(',') as FixTypes) : undefined,\n };\n const linterResults = await this.linter.lint(componentsToLint, opts);\n const jsonLinterResults = toJsonLintResults(linterResults);\n const timerResponse = timer.stop();\n let code = 0;\n if (jsonLinterResults.totalErrorCount || jsonLinterResults.totalFatalErrorCount) {\n code = 1;\n }\n return {\n code,\n data: {\n duration: timerResponse,\n lintResults: jsonLinterResults,\n componentsIdsToLint: componentsToLint.map((comp) => comp.id.toString()),\n },\n };\n }\n\n private async getIdsToLint(components: string[], changed = false): Promise<ComponentID[]> {\n if (components.length) {\n return this.workspace.resolveMultipleComponentIds(components);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.componentHost.listIds();\n }\n}\n\nfunction toJsonLintResults(results: EnvsExecutionResult<LintResults>): JsonLintDataResults {\n let totalErrorCount = 0;\n let totalFatalErrorCount = 0;\n let totalFixableErrorCount = 0;\n let totalFixableWarningCount = 0;\n let totalWarningCount = 0;\n let totalComponentsWithErrorCount = 0;\n let totalComponentsWithFatalErrorCount = 0;\n let totalComponentsWithFixableErrorCount = 0;\n let totalComponentsWithFixableWarningCount = 0;\n let totalComponentsWithWarningCount = 0;\n\n const newResults = results.results.map((res) => {\n const resultsWithoutComponent = res.data?.results.map((result) => {\n return Object.assign({}, { componentId: result.component.id }, omit(result, ['component']));\n });\n\n if (res.data) {\n if (res.data.totalErrorCount) {\n totalErrorCount += res.data.totalErrorCount;\n totalComponentsWithErrorCount += res.data.totalComponentsWithErrorCount ?? 0;\n }\n if (res.data.totalFatalErrorCount) {\n totalFatalErrorCount += res.data.totalFatalErrorCount;\n totalComponentsWithFatalErrorCount += res.data.totalComponentsWithFatalErrorCount ?? 0;\n }\n if (res.data.totalFixableErrorCount) {\n totalFixableErrorCount += res.data.totalFixableErrorCount;\n totalComponentsWithFixableErrorCount += res.data.totalComponentsWithFixableErrorCount ?? 0;\n }\n if (res.data.totalFixableWarningCount) {\n totalFixableWarningCount += res.data.totalFixableWarningCount;\n totalComponentsWithFixableWarningCount += res.data.totalComponentsWithFixableWarningCount ?? 0;\n }\n if (res.data.totalWarningCount) {\n totalWarningCount += res.data.totalWarningCount;\n totalComponentsWithWarningCount += res.data.totalComponentsWithWarningCount ?? 0;\n }\n }\n\n return compact(resultsWithoutComponent);\n });\n return {\n results: compact(flatten(newResults)),\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n totalComponentsWithErrorCount,\n totalComponentsWithFatalErrorCount,\n totalComponentsWithFixableErrorCount,\n totalComponentsWithFixableWarningCount,\n totalComponentsWithWarningCount,\n errors: results?.errors,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAkCO,MAAMA,OAAN,CAAiC;EAWtCC,WAAW,CAASC,MAAT,EAAqCC,aAArC,EAA8EC,SAA9E,EAAoG;IAAA,KAA3FF,MAA2F,GAA3FA,MAA2F;IAAA,KAA/DC,aAA+D,GAA/DA,aAA+D;IAAA,KAAtBC,SAAsB,GAAtBA,SAAsB;IAAA,8CAVxG,qBAUwG;IAAA,qDATjG,8CASiG;IAAA,+CARvG,aAQuG;IAAA,iDAPrG,CACR,CAAC,GAAD,EAAM,SAAN,EAAiB,uCAAjB,CADQ,EAER,CAAC,GAAD,EAAM,KAAN,EAAa,4BAAb,CAFQ,EAGR,CAAC,EAAD,EAAK,oBAAL,EAA2B,mEAA3B,CAHQ,EAIR,CAAC,GAAD,EAAM,MAAN,EAAc,wCAAd,CAJQ,CAOqG;EAAE;;EAErG,MAANC,MAAM,CAAC,CAACC,UAAU,GAAG,EAAd,CAAD,EAAgCC,aAAhC,EAA+D;IACzE,MAAM;MAAEC,IAAF;MAAQC;IAAR,IAAiB,MAAM,KAAKC,IAAL,CAAU,CAACJ,UAAD,CAAV,EAAwBC,aAAxB,CAA7B;IACA,MAAM;MAAEI,WA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J,CAAS6D,oBAAjC;QACAU,kCAAkC,8BAAIK,GAAG,CAAC5E,IAAJ,CAASuE,kCAAb,2EAAmD,CAArF;MACD;;MACD,IAAIK,GAAG,CAAC5E,IAAJ,CAASmE,sBAAb,EAAqC;QAAA;;QACnCA,sBAAsB,IAAIS,GAAG,CAAC5E,IAAJ,CAASmE,sBAAnC;QACAK,oCAAoC,8BAAII,GAAG,CAAC5E,IAAJ,CAASwE,oCAAb,2EAAqD,CAAzF;MACD;;MACD,IAAII,GAAG,CAAC5E,IAAJ,CAASoE,wBAAb,EAAuC;QAAA;;QACrCA,wBAAwB,IAAIQ,GAAG,CAAC5E,IAAJ,CAASoE,wBAArC;QACAK,sCAAsC,8BAAIG,GAAG,CAAC5E,IAAJ,CAASyE,sCAAb,2EAAuD,CAA7F;MACD;;MACD,IAAIG,GAAG,CAAC5E,IAAJ,CAASqE,iBAAb,EAAgC;QAAA;;QAC9BA,iBAAiB,IAAIO,GAAG,CAAC5E,IAAJ,CAASqE,iBAA9B;QACAK,+BAA+B,8BAAIE,GAAG,CAAC5E,IAAJ,CAAS0E,+BAAb,2EAAgD,CAA/E;MACD;IACF;;IAED,OAAO,IAAAS,iBAAA,EAAQN,uBAAR,CAAP;EACD,CA7BkB,CAAnB;EA8BA,OAAO;IACLjE,OAAO,EAAE,IAAAuE,iBAAA,EAAQ,IAAAC,iBAAA,EAAQT,UAAR,CAAR,CADJ;IAELf,eAFK;IAGLC,oBAHK;IAILM,sBAJK;IAKLC,wBALK;IAMLC,iBANK;IAOLC,6BAPK;IAQLC,kCARK;IASLC,oCATK;IAULC,sCAVK;IAWLC,+BAXK;IAYLW,MAAM,EAAEzE,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEyE;EAZZ,CAAP;AAcD"}
|
1
|
+
{"version":3,"names":["LintCmd","constructor","linter","componentHost","workspace","report","components","linterOptions","code","data","json","lintResults","componentsIdsToLint","title","chalk","bold","cyan","length","toString","name","componentsOutputs","results","map","lintRes","compTitle","componentId","ignoreVersion","compOutput","output","join","summary","getSummarySection","duration","seconds","summaryTitle","totalFieldsMap","itemsDataField","componentsDataField","label","summaryTotals","item","renderTotalLine","filter","Boolean","componentsCount","itemsCount","fieldLabel","undefined","green","timer","Timer","create","start","componentsIds","getIdsToLint","changed","componentsToLint","getMany","opts","fix","fixTypes","fixType","split","linterResults","lint","jsonLinterResults","toJsonLintResults","timerResponse","stop","totalErrorCount","totalFatalErrorCount","comp","id","resolveMultipleComponentIds","getNewAndModifiedIds","listIds","totalFixableErrorCount","totalFixableWarningCount","totalWarningCount","totalComponentsWithErrorCount","totalComponentsWithFatalErrorCount","totalComponentsWithFixableErrorCount","totalComponentsWithFixableWarningCount","totalComponentsWithWarningCount","newResults","res","resultsWithoutComponent","result","Object","assign","component","omit","compact","flatten","errors"],"sources":["lint.cmd.ts"],"sourcesContent":["import { TimerResponse, Timer } from '@teambit/legacy/dist/toolbox/timer';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { ComponentFactory, ComponentID } from '@teambit/component';\nimport chalk from 'chalk';\nimport { EnvsExecutionResult } from '@teambit/envs';\nimport { Workspace } from '@teambit/workspace';\nimport { compact, flatten, omit } from 'lodash';\nimport { LinterMain } from './linter.main.runtime';\nimport { ComponentLintResult, LintResults } from './linter';\nimport { FixTypes, LinterOptions } from './linter-context';\n\nexport type LintCmdOptions = {\n changed?: boolean;\n fix?: boolean;\n fixType?: string;\n json?: boolean;\n};\n\n/**\n * A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component\n */\nexport type JsonComponentLintResult = Omit<ComponentLintResult, 'component'> & {\n componentId: ComponentID;\n};\n\nexport type JsonLintDataResults = Omit<LintResults, 'results'> & { results: JsonComponentLintResult[] };\n/**\n * A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component\n */\nexport type JsonLintResultsData = {\n duration: TimerResponse;\n lintResults: JsonLintDataResults;\n componentsIdsToLint: string[];\n};\n\nexport type JsonLintResults = {\n code: number;\n data: JsonLintResultsData;\n};\n\nexport class LintCmd implements Command {\n name = 'lint [component...]';\n description = 'lint components in the development workspace';\n group = 'development';\n options = [\n ['c', 'changed', 'lint only new and modified components'],\n ['f', 'fix', 'automatically fix problems'],\n ['', 'fix-type <fixType>', 'specify the types of fixes to apply (problem, suggestion, layout)'],\n ['j', 'json', 'return the lint results in json format'],\n ] as CommandOptions;\n\n constructor(private linter: LinterMain, private componentHost: ComponentFactory, private workspace: Workspace) {}\n\n async report([components = []]: [string[]], linterOptions: LintCmdOptions) {\n const { code, data } = await this.json([components], linterOptions);\n const { lintResults, componentsIdsToLint } = data;\n const title = chalk.bold(\n `linting total of ${chalk.cyan(componentsIdsToLint.length.toString())} component(s) in workspace '${chalk.cyan(\n this.componentHost.name\n )}'`\n );\n\n const componentsOutputs = lintResults.results\n .map((lintRes) => {\n const compTitle = chalk.bold.cyan(lintRes.componentId.toString({ ignoreVersion: true }));\n const compOutput = lintRes.output;\n return `${compTitle}\\n${compOutput}`;\n })\n .join('\\n');\n\n const summary = this.getSummarySection(data);\n return { code, data: `${title}\\n\\n${componentsOutputs}\\n\\n${summary}` };\n }\n\n private getSummarySection(data: JsonLintResultsData) {\n const { duration, lintResults, componentsIdsToLint } = data;\n const { seconds } = duration;\n const summaryTitle = `linted ${chalk.cyan(componentsIdsToLint.length.toString())} components in ${chalk.cyan(\n seconds.toString()\n )} seconds`;\n\n const totalFieldsMap = [\n { itemsDataField: 'totalErrorCount', componentsDataField: 'totalComponentsWithErrorCount', label: 'Errors' },\n {\n itemsDataField: 'totalFatalErrorCount',\n componentsDataField: 'totalComponentsWithFatalErrorCount',\n label: 'FatalErrors',\n },\n {\n itemsDataField: 'totalFixableErrorCount',\n componentsDataField: 'totalComponentsWithFixableErrorCount',\n label: 'FixableErrors',\n },\n {\n itemsDataField: 'totalFixableWarningCount',\n componentsDataField: 'totalComponentsWithFixableWarningCount',\n label: 'FixableWarnings',\n },\n {\n itemsDataField: 'totalWarningCount',\n componentsDataField: 'totalComponentsWithWarningCount',\n label: 'Warnings',\n },\n ];\n\n const summaryTotals = totalFieldsMap\n .map((item) =>\n this.renderTotalLine(lintResults[item.componentsDataField], lintResults[item.itemsDataField], item.label)\n )\n .filter(Boolean)\n .join('\\n');\n const summary = `${summaryTitle}\\n${summaryTotals}`;\n return summary;\n }\n\n private renderTotalLine(componentsCount: number, itemsCount: number, fieldLabel: string): string | undefined {\n if (itemsCount === 0) return undefined;\n return `total of ${chalk.green(itemsCount.toString())} ${chalk.cyan(fieldLabel)} (from ${chalk.green(\n componentsCount.toString()\n )} components)`;\n }\n\n async json([components = []]: [string[]], linterOptions: LintCmdOptions): Promise<JsonLintResults> {\n const timer = Timer.create();\n timer.start();\n const componentsIds = await this.getIdsToLint(components, linterOptions.changed);\n const componentsToLint = await this.workspace.getMany(componentsIds);\n const opts: LinterOptions = {\n fix: linterOptions.fix,\n fixTypes: linterOptions.fixType ? (linterOptions.fixType.split(',') as FixTypes) : undefined,\n };\n const linterResults = await this.linter.lint(componentsToLint, opts);\n const jsonLinterResults = toJsonLintResults(linterResults);\n const timerResponse = timer.stop();\n let code = 0;\n if (jsonLinterResults.totalErrorCount || jsonLinterResults.totalFatalErrorCount) {\n code = 1;\n }\n return {\n code,\n data: {\n duration: timerResponse,\n lintResults: jsonLinterResults,\n componentsIdsToLint: componentsToLint.map((comp) => comp.id.toString()),\n },\n };\n }\n\n private async getIdsToLint(components: string[], changed = false): Promise<ComponentID[]> {\n if (components.length) {\n return this.workspace.resolveMultipleComponentIds(components);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.componentHost.listIds();\n }\n}\n\nfunction toJsonLintResults(results: EnvsExecutionResult<LintResults>): JsonLintDataResults {\n let totalErrorCount = 0;\n let totalFatalErrorCount = 0;\n let totalFixableErrorCount = 0;\n let totalFixableWarningCount = 0;\n let totalWarningCount = 0;\n let totalComponentsWithErrorCount = 0;\n let totalComponentsWithFatalErrorCount = 0;\n let totalComponentsWithFixableErrorCount = 0;\n let totalComponentsWithFixableWarningCount = 0;\n let totalComponentsWithWarningCount = 0;\n\n const newResults = results.results.map((res) => {\n const resultsWithoutComponent = res.data?.results.map((result) => {\n return Object.assign({}, { componentId: result.component.id }, omit(result, ['component']));\n });\n\n if (res.data) {\n if (res.data.totalErrorCount) {\n totalErrorCount += res.data.totalErrorCount;\n totalComponentsWithErrorCount += res.data.totalComponentsWithErrorCount ?? 0;\n }\n if (res.data.totalFatalErrorCount) {\n totalFatalErrorCount += res.data.totalFatalErrorCount;\n totalComponentsWithFatalErrorCount += res.data.totalComponentsWithFatalErrorCount ?? 0;\n }\n if (res.data.totalFixableErrorCount) {\n totalFixableErrorCount += res.data.totalFixableErrorCount;\n totalComponentsWithFixableErrorCount += res.data.totalComponentsWithFixableErrorCount ?? 0;\n }\n if (res.data.totalFixableWarningCount) {\n totalFixableWarningCount += res.data.totalFixableWarningCount;\n totalComponentsWithFixableWarningCount += res.data.totalComponentsWithFixableWarningCount ?? 0;\n }\n if (res.data.totalWarningCount) {\n totalWarningCount += res.data.totalWarningCount;\n totalComponentsWithWarningCount += res.data.totalComponentsWithWarningCount ?? 0;\n }\n }\n\n return compact(resultsWithoutComponent);\n });\n return {\n results: compact(flatten(newResults)),\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n totalComponentsWithErrorCount,\n totalComponentsWithFatalErrorCount,\n totalComponentsWithFixableErrorCount,\n totalComponentsWithFixableWarningCount,\n totalComponentsWithWarningCount,\n errors: results?.errors,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAkCO,MAAMA,OAAO,CAAoB;EAWtCC,WAAW,CAASC,MAAkB,EAAUC,aAA+B,EAAUC,SAAoB,EAAE;IAAA,KAA3FF,MAAkB,GAAlBA,MAAkB;IAAA,K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,OAAO,IAAAS,iBAAO,EAACN,uBAAuB,CAAC;EACzC,CAAC,CAAC;EACF,OAAO;IACLjE,OAAO,EAAE,IAAAuE,iBAAO,EAAC,IAAAC,iBAAO,EAACT,UAAU,CAAC,CAAC;IACrCf,eAAe;IACfC,oBAAoB;IACpBM,sBAAsB;IACtBC,wBAAwB;IACxBC,iBAAiB;IACjBC,6BAA6B;IAC7BC,kCAAkC;IAClCC,oCAAoC;IACpCC,sCAAsC;IACtCC,+BAA+B;IAC/BW,MAAM,EAAEzE,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEyE;EACnB,CAAC;AACH"}
|
package/dist/lint.task.js
CHANGED
@@ -1,41 +1,31 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
require("core-js/modules/es.promise.js");
|
6
|
-
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
8
6
|
value: true
|
9
7
|
});
|
10
8
|
exports.LintTask = void 0;
|
11
|
-
|
12
9
|
function _defineProperty2() {
|
13
10
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
14
|
-
|
15
11
|
_defineProperty2 = function () {
|
16
12
|
return data;
|
17
13
|
};
|
18
|
-
|
19
14
|
return data;
|
20
15
|
}
|
21
|
-
|
22
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
23
|
-
|
24
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
25
|
-
|
26
18
|
class LintTask {
|
27
19
|
constructor(aspectId, name = 'lint') {
|
28
20
|
this.aspectId = aspectId;
|
29
21
|
this.name = name;
|
30
22
|
}
|
31
|
-
|
32
23
|
async execute(context) {
|
33
|
-
const linter = context.env.getLinter();
|
34
|
-
|
24
|
+
const linter = context.env.getLinter();
|
25
|
+
// @ts-ignore TODO: fix this
|
35
26
|
const linterContext = _objectSpread({
|
36
27
|
rootDir: context.capsuleNetwork.capsulesRootDir
|
37
28
|
}, context);
|
38
|
-
|
39
29
|
const results = await linter.lint(linterContext);
|
40
30
|
const componentsResults = results.results.map(lintResult => {
|
41
31
|
return {
|
@@ -51,9 +41,7 @@ class LintTask {
|
|
51
41
|
componentsResults
|
52
42
|
};
|
53
43
|
}
|
54
|
-
|
55
44
|
}
|
56
|
-
|
57
45
|
exports.LintTask = LintTask;
|
58
46
|
|
59
47
|
//# sourceMappingURL=lint.task.js.map
|
package/dist/lint.task.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["LintTask","constructor","aspectId","name","execute","context","linter","env","getLinter","linterContext","rootDir","capsuleNetwork","capsulesRootDir","results","lint","componentsResults","map","lintResult","component","metadata","output","errors"],"sources":["lint.task.ts"],"sourcesContent":["import { BuildTask, BuiltTaskResult, BuildContext, ComponentResult } from '@teambit/builder';\nimport { Linter } from './linter';\nimport { LinterContext } from './linter-context';\n\nexport class LintTask implements BuildTask {\n constructor(readonly aspectId: string, readonly name = 'lint') {}\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const linter: Linter = context.env.getLinter();\n // @ts-ignore TODO: fix this\n const linterContext: LinterContext = {\n rootDir: context.capsuleNetwork.capsulesRootDir,\n ...context,\n };\n const results = await linter.lint(linterContext);\n const componentsResults = results.results.map((lintResult): ComponentResult => {\n return {\n component: lintResult.component,\n metadata: {\n output: lintResult.output,\n results: lintResult.results,\n },\n errors: [],\n };\n });\n\n return {\n componentsResults,\n };\n }\n}\n"],"mappings":"
|
1
|
+
{"version":3,"names":["LintTask","constructor","aspectId","name","execute","context","linter","env","getLinter","linterContext","rootDir","capsuleNetwork","capsulesRootDir","results","lint","componentsResults","map","lintResult","component","metadata","output","errors"],"sources":["lint.task.ts"],"sourcesContent":["import { BuildTask, BuiltTaskResult, BuildContext, ComponentResult } from '@teambit/builder';\nimport { Linter } from './linter';\nimport { LinterContext } from './linter-context';\n\nexport class LintTask implements BuildTask {\n constructor(readonly aspectId: string, readonly name = 'lint') {}\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const linter: Linter = context.env.getLinter();\n // @ts-ignore TODO: fix this\n const linterContext: LinterContext = {\n rootDir: context.capsuleNetwork.capsulesRootDir,\n ...context,\n };\n const results = await linter.lint(linterContext);\n const componentsResults = results.results.map((lintResult): ComponentResult => {\n return {\n component: lintResult.component,\n metadata: {\n output: lintResult.output,\n results: lintResult.results,\n },\n errors: [],\n };\n });\n\n return {\n componentsResults,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAIO,MAAMA,QAAQ,CAAsB;EACzCC,WAAW,CAAUC,QAAgB,EAAWC,IAAI,GAAG,MAAM,EAAE;IAAA,KAA1CD,QAAgB,GAAhBA,QAAgB;IAAA,KAAWC,IAAI,GAAJA,IAAI;EAAY;EAEhE,MAAMC,OAAO,CAACC,OAAqB,EAA4B;IAC7D,MAAMC,MAAc,GAAGD,OAAO,CAACE,GAAG,CAACC,SAAS,EAAE;IAC9C;IACA,MAAMC,aAA4B;MAChCC,OAAO,EAAEL,OAAO,CAACM,cAAc,CAACC;IAAe,GAC5CP,OAAO,CACX;IACD,MAAMQ,OAAO,GAAG,MAAMP,MAAM,CAACQ,IAAI,CAACL,aAAa,CAAC;IAChD,MAAMM,iBAAiB,GAAGF,OAAO,CAACA,OAAO,CAACG,GAAG,CAAEC,UAAU,IAAsB;MAC7E,OAAO;QACLC,SAAS,EAAED,UAAU,CAACC,SAAS;QAC/BC,QAAQ,EAAE;UACRC,MAAM,EAAEH,UAAU,CAACG,MAAM;UACzBP,OAAO,EAAEI,UAAU,CAACJ;QACtB,CAAC;QACDQ,MAAM,EAAE;MACV,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;MACLN;IACF,CAAC;EACH;AACF;AAAC"}
|
package/dist/linter.aspect.js
CHANGED
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.LinterAspect = void 0;
|
7
|
-
|
8
7
|
function _harmony() {
|
9
8
|
const data = require("@teambit/harmony");
|
10
|
-
|
11
9
|
_harmony = function () {
|
12
10
|
return data;
|
13
11
|
};
|
14
|
-
|
15
12
|
return data;
|
16
13
|
}
|
17
|
-
|
18
14
|
const LinterAspect = _harmony().Aspect.create({
|
19
15
|
id: 'teambit.defender/linter'
|
20
16
|
});
|
21
|
-
|
22
17
|
exports.LinterAspect = LinterAspect;
|
23
18
|
|
24
19
|
//# sourceMappingURL=linter.aspect.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["LinterAspect","Aspect","create","id"],"sources":["linter.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const LinterAspect = Aspect.create({\n id: 'teambit.defender/linter',\n});\n"],"mappings":"
|
1
|
+
{"version":3,"names":["LinterAspect","Aspect","create","id"],"sources":["linter.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const LinterAspect = Aspect.create({\n id: 'teambit.defender/linter',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,YAAY,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACxCC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
|
@@ -1,22 +1,17 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.Logo = void 0;
|
9
|
-
|
10
8
|
function _react() {
|
11
9
|
const data = _interopRequireDefault(require("react"));
|
12
|
-
|
13
10
|
_react = function () {
|
14
11
|
return data;
|
15
12
|
};
|
16
|
-
|
17
13
|
return data;
|
18
14
|
}
|
19
|
-
|
20
15
|
const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
21
16
|
style: {
|
22
17
|
height: '100%',
|
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
|
29
24
|
},
|
30
25
|
src: "https://static.bit.dev/extensions-icons/linter.svg"
|
31
26
|
}));
|
32
|
-
|
33
27
|
exports.Logo = Logo;
|
34
28
|
|
35
29
|
//# sourceMappingURL=linter.composition.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["linter.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/linter.svg\" />\n </div>\n);\n"],"mappings":"
|
1
|
+
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["linter.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/linter.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAoD,EAAG,CAEzF;AAAC"}
|
package/dist/linter.graphql.js
CHANGED
@@ -1,22 +1,17 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.linterSchema = linterSchema;
|
9
|
-
|
10
8
|
function _graphqlTag() {
|
11
9
|
const data = _interopRequireDefault(require("graphql-tag"));
|
12
|
-
|
13
10
|
_graphqlTag = function () {
|
14
11
|
return data;
|
15
12
|
};
|
16
|
-
|
17
13
|
return data;
|
18
14
|
}
|
19
|
-
|
20
15
|
function linterSchema() {
|
21
16
|
return {
|
22
17
|
typeDefs: (0, _graphqlTag().default)``,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["linterSchema","typeDefs","gql","resolvers"],"sources":["linter.graphql.ts"],"sourcesContent":["import gql from 'graphql-tag';\n\nexport function linterSchema() {\n return {\n typeDefs: gql``,\n resolvers: {},\n };\n}\n"],"mappings":"
|
1
|
+
{"version":3,"names":["linterSchema","typeDefs","gql","resolvers"],"sources":["linter.graphql.ts"],"sourcesContent":["import gql from 'graphql-tag';\n\nexport function linterSchema() {\n return {\n typeDefs: gql``,\n resolvers: {},\n };\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,SAASA,YAAY,GAAG;EAC7B,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAG,CAAC,EAAC;IACfC,SAAS,EAAE,CAAC;EACd,CAAC;AACH"}
|
@@ -1,141 +1,104 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
6
|
-
|
7
5
|
require("core-js/modules/es.promise.js");
|
8
|
-
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
10
7
|
value: true
|
11
8
|
});
|
12
9
|
exports.LinterMain = void 0;
|
13
|
-
|
14
10
|
function _defineProperty2() {
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
16
|
-
|
17
12
|
_defineProperty2 = function () {
|
18
13
|
return data;
|
19
14
|
};
|
20
|
-
|
21
15
|
return data;
|
22
16
|
}
|
23
|
-
|
24
17
|
function _cli() {
|
25
18
|
const data = require("@teambit/cli");
|
26
|
-
|
27
19
|
_cli = function () {
|
28
20
|
return data;
|
29
21
|
};
|
30
|
-
|
31
22
|
return data;
|
32
23
|
}
|
33
|
-
|
34
24
|
function _component() {
|
35
25
|
const data = require("@teambit/component");
|
36
|
-
|
37
26
|
_component = function () {
|
38
27
|
return data;
|
39
28
|
};
|
40
|
-
|
41
29
|
return data;
|
42
30
|
}
|
43
|
-
|
44
31
|
function _envs() {
|
45
32
|
const data = require("@teambit/envs");
|
46
|
-
|
47
33
|
_envs = function () {
|
48
34
|
return data;
|
49
35
|
};
|
50
|
-
|
51
36
|
return data;
|
52
37
|
}
|
53
|
-
|
54
38
|
function _logger() {
|
55
39
|
const data = require("@teambit/logger");
|
56
|
-
|
57
40
|
_logger = function () {
|
58
41
|
return data;
|
59
42
|
};
|
60
|
-
|
61
43
|
return data;
|
62
44
|
}
|
63
|
-
|
64
45
|
function _workspace() {
|
65
46
|
const data = require("@teambit/workspace");
|
66
|
-
|
67
47
|
_workspace = function () {
|
68
48
|
return data;
|
69
49
|
};
|
70
|
-
|
71
50
|
return data;
|
72
51
|
}
|
73
|
-
|
74
52
|
function _linter() {
|
75
53
|
const data = require("./linter.aspect");
|
76
|
-
|
77
54
|
_linter = function () {
|
78
55
|
return data;
|
79
56
|
};
|
80
|
-
|
81
57
|
return data;
|
82
58
|
}
|
83
|
-
|
84
59
|
function _linter2() {
|
85
60
|
const data = require("./linter.service");
|
86
|
-
|
87
61
|
_linter2 = function () {
|
88
62
|
return data;
|
89
63
|
};
|
90
|
-
|
91
64
|
return data;
|
92
65
|
}
|
93
|
-
|
94
66
|
function _lint() {
|
95
67
|
const data = require("./lint.task");
|
96
|
-
|
97
68
|
_lint = function () {
|
98
69
|
return data;
|
99
70
|
};
|
100
|
-
|
101
71
|
return data;
|
102
72
|
}
|
103
|
-
|
104
73
|
function _lint2() {
|
105
74
|
const data = require("./lint.cmd");
|
106
|
-
|
107
75
|
_lint2 = function () {
|
108
76
|
return data;
|
109
77
|
};
|
110
|
-
|
111
78
|
return data;
|
112
79
|
}
|
113
|
-
|
114
80
|
class LinterMain {
|
115
81
|
constructor(envs, linterService) {
|
116
82
|
this.envs = envs;
|
117
83
|
this.linterService = linterService;
|
118
84
|
}
|
85
|
+
|
119
86
|
/**
|
120
87
|
* lint an array of components.
|
121
88
|
*/
|
122
|
-
|
123
|
-
|
124
89
|
async lint(components, opts) {
|
125
90
|
const envsRuntime = await this.envs.createEnvironment(components);
|
126
91
|
const lintResults = envsRuntime.run(this.linterService, opts);
|
127
92
|
return lintResults;
|
128
93
|
}
|
94
|
+
|
129
95
|
/**
|
130
96
|
* create a lint task for build pipelines.
|
131
97
|
* @param name name of the task.
|
132
98
|
*/
|
133
|
-
|
134
|
-
|
135
99
|
createTask(name) {
|
136
100
|
return new (_lint().LintTask)(_linter().LinterAspect.id, name);
|
137
101
|
}
|
138
|
-
|
139
102
|
static async provider([envs, cli, component, loggerAspect, workspace], config) {
|
140
103
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
141
104
|
const logger = loggerAspect.createLogger(_linter().LinterAspect.id);
|
@@ -145,9 +108,7 @@ class LinterMain {
|
|
145
108
|
cli.register(new (_lint2().LintCmd)(linterAspect, component.getHost(), workspace));
|
146
109
|
return linterAspect;
|
147
110
|
}
|
148
|
-
|
149
111
|
}
|
150
|
-
|
151
112
|
exports.LinterMain = LinterMain;
|
152
113
|
(0, _defineProperty2().default)(LinterMain, "runtime", _cli().MainRuntime);
|
153
114
|
(0, _defineProperty2().default)(LinterMain, "dependencies", [_envs().EnvsAspect, _cli().CLIAspect, _component().ComponentAspect, _logger().LoggerAspect, _workspace().WorkspaceAspect]);
|
@@ -155,7 +116,6 @@ exports.LinterMain = LinterMain;
|
|
155
116
|
extensionFormats: ['.ts', '.tsx', '.js', '.jsx', '.mjs'],
|
156
117
|
fixTypes: ['layout', 'problem', 'suggestion']
|
157
118
|
});
|
158
|
-
|
159
119
|
_linter().LinterAspect.addRuntime(LinterMain);
|
160
120
|
|
161
121
|
//# sourceMappingURL=linter.main.runtime.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["LinterMain","constructor","envs","linterService","lint","components","opts","envsRuntime","createEnvironment","lintResults","run","createTask","name","LintTask","LinterAspect","id","provider","cli","component","loggerAspect","workspace","config","logger","createLogger","LinterService","path","linterAspect","registerService","register","LintCmd","getHost","MainRuntime","EnvsAspect","CLIAspect","ComponentAspect","LoggerAspect","WorkspaceAspect","extensionFormats","fixTypes","addRuntime"],"sources":["linter.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Component, ComponentAspect, ComponentMain } from '@teambit/component';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { LinterAspect } from './linter.aspect';\nimport { LinterService } from './linter.service';\nimport { LintTask } from './lint.task';\nimport { LintCmd } from './lint.cmd';\nimport { FixTypes, LinterOptions } from './linter-context';\n\nexport type LinterConfig = {\n /**\n * extension formats to lint.\n */\n extensionFormats: string[];\n fixTypes?: FixTypes;\n};\n\nexport class LinterMain {\n static runtime = MainRuntime;\n\n constructor(private envs: EnvsMain, private linterService: LinterService) {}\n\n /**\n * lint an array of components.\n */\n async lint(components: Component[], opts: LinterOptions) {\n const envsRuntime = await this.envs.createEnvironment(components);\n const lintResults = envsRuntime.run(this.linterService, opts);\n return lintResults;\n }\n\n /**\n * create a lint task for build pipelines.\n * @param name name of the task.\n */\n createTask(name?: string): LintTask {\n return new LintTask(LinterAspect.id, name);\n }\n\n static dependencies = [EnvsAspect, CLIAspect, ComponentAspect, LoggerAspect, WorkspaceAspect];\n\n static defaultConfig: LinterConfig = {\n extensionFormats: ['.ts', '.tsx', '.js', '.jsx', '.mjs'],\n fixTypes: ['layout', 'problem', 'suggestion'],\n };\n\n static async provider(\n [envs, cli, component, loggerAspect, workspace]: [EnvsMain, CLIMain, ComponentMain, LoggerMain, Workspace],\n config: LinterConfig\n ) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const logger = loggerAspect.createLogger(LinterAspect.id);\n const linterService = new LinterService(config, workspace?.path);\n const linterAspect = new LinterMain(envs, linterService);\n envs.registerService(linterService);\n cli.register(new LintCmd(linterAspect, component.getHost(), workspace));\n\n return linterAspect;\n }\n}\n\nLinterAspect.addRuntime(LinterMain);\n"],"mappings":"
|
1
|
+
{"version":3,"names":["LinterMain","constructor","envs","linterService","lint","components","opts","envsRuntime","createEnvironment","lintResults","run","createTask","name","LintTask","LinterAspect","id","provider","cli","component","loggerAspect","workspace","config","logger","createLogger","LinterService","path","linterAspect","registerService","register","LintCmd","getHost","MainRuntime","EnvsAspect","CLIAspect","ComponentAspect","LoggerAspect","WorkspaceAspect","extensionFormats","fixTypes","addRuntime"],"sources":["linter.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Component, ComponentAspect, ComponentMain } from '@teambit/component';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { LinterAspect } from './linter.aspect';\nimport { LinterService } from './linter.service';\nimport { LintTask } from './lint.task';\nimport { LintCmd } from './lint.cmd';\nimport { FixTypes, LinterOptions } from './linter-context';\n\nexport type LinterConfig = {\n /**\n * extension formats to lint.\n */\n extensionFormats: string[];\n fixTypes?: FixTypes;\n};\n\nexport class LinterMain {\n static runtime = MainRuntime;\n\n constructor(private envs: EnvsMain, private linterService: LinterService) {}\n\n /**\n * lint an array of components.\n */\n async lint(components: Component[], opts: LinterOptions) {\n const envsRuntime = await this.envs.createEnvironment(components);\n const lintResults = envsRuntime.run(this.linterService, opts);\n return lintResults;\n }\n\n /**\n * create a lint task for build pipelines.\n * @param name name of the task.\n */\n createTask(name?: string): LintTask {\n return new LintTask(LinterAspect.id, name);\n }\n\n static dependencies = [EnvsAspect, CLIAspect, ComponentAspect, LoggerAspect, WorkspaceAspect];\n\n static defaultConfig: LinterConfig = {\n extensionFormats: ['.ts', '.tsx', '.js', '.jsx', '.mjs'],\n fixTypes: ['layout', 'problem', 'suggestion'],\n };\n\n static async provider(\n [envs, cli, component, loggerAspect, workspace]: [EnvsMain, CLIMain, ComponentMain, LoggerMain, Workspace],\n config: LinterConfig\n ) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const logger = loggerAspect.createLogger(LinterAspect.id);\n const linterService = new LinterService(config, workspace?.path);\n const linterAspect = new LinterMain(envs, linterService);\n envs.registerService(linterService);\n cli.register(new LintCmd(linterAspect, component.getHost(), workspace));\n\n return linterAspect;\n }\n}\n\nLinterAspect.addRuntime(LinterMain);\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAWO,MAAMA,UAAU,CAAC;EAG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e,CAAC;AAAA,gCAtBlFpC,UAAU,mBAwBgB;EACnCqC,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;EACxDC,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,YAAY;AAC9C,CAAC;AAiBHxB,sBAAY,CAACyB,UAAU,CAACvC,UAAU,CAAC"}
|
package/dist/linter.service.js
CHANGED
@@ -1,71 +1,52 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
require("core-js/modules/es.promise.js");
|
6
|
-
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
8
6
|
value: true
|
9
7
|
});
|
10
8
|
exports.LinterService = void 0;
|
11
|
-
|
12
9
|
function _defineProperty2() {
|
13
10
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
14
|
-
|
15
11
|
_defineProperty2 = function () {
|
16
12
|
return data;
|
17
13
|
};
|
18
|
-
|
19
14
|
return data;
|
20
15
|
}
|
21
|
-
|
22
16
|
function _react() {
|
23
17
|
const data = _interopRequireDefault(require("react"));
|
24
|
-
|
25
18
|
_react = function () {
|
26
19
|
return data;
|
27
20
|
};
|
28
|
-
|
29
21
|
return data;
|
30
22
|
}
|
31
|
-
|
32
23
|
function _lodash() {
|
33
24
|
const data = require("lodash");
|
34
|
-
|
35
25
|
_lodash = function () {
|
36
26
|
return data;
|
37
27
|
};
|
38
|
-
|
39
28
|
return data;
|
40
29
|
}
|
41
|
-
|
42
30
|
function _ink() {
|
43
31
|
const data = require("ink");
|
44
|
-
|
45
32
|
_ink = function () {
|
46
33
|
return data;
|
47
34
|
};
|
48
|
-
|
49
35
|
return data;
|
50
36
|
}
|
51
|
-
|
52
37
|
function _cliHighlight() {
|
53
38
|
const data = _interopRequireDefault(require("cli-highlight"));
|
54
|
-
|
55
39
|
_cliHighlight = function () {
|
56
40
|
return data;
|
57
41
|
};
|
58
|
-
|
59
42
|
return data;
|
60
43
|
}
|
61
|
-
|
62
44
|
class LinterService {
|
63
45
|
constructor(linterConfig, rootDir) {
|
64
46
|
this.linterConfig = linterConfig;
|
65
47
|
this.rootDir = rootDir;
|
66
48
|
(0, _defineProperty2().default)(this, "name", 'linter');
|
67
49
|
}
|
68
|
-
|
69
50
|
async run(context, options) {
|
70
51
|
const mergedOpts = this.optionsWithDefaults(options);
|
71
52
|
const linterContext = this.mergeContext(mergedOpts, context);
|
@@ -73,11 +54,9 @@ class LinterService {
|
|
73
54
|
const results = await linter.lint(linterContext);
|
74
55
|
return results;
|
75
56
|
}
|
76
|
-
|
77
57
|
optionsWithDefaults(options) {
|
78
58
|
return (0, _lodash().defaults)(options, this.linterConfig);
|
79
59
|
}
|
80
|
-
|
81
60
|
mergeContext(options, context) {
|
82
61
|
const linterContext = Object.assign({}, {
|
83
62
|
rootDir: this.rootDir,
|
@@ -88,7 +67,6 @@ class LinterService {
|
|
88
67
|
}, context);
|
89
68
|
return linterContext;
|
90
69
|
}
|
91
|
-
|
92
70
|
render(env) {
|
93
71
|
const descriptor = this.getDescriptor(env);
|
94
72
|
return /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
@@ -102,7 +80,6 @@ class LinterService {
|
|
102
80
|
ignoreIllegals: true
|
103
81
|
})), /*#__PURE__*/_react().default.createElement(_ink().Newline, null));
|
104
82
|
}
|
105
|
-
|
106
83
|
getDescriptor(env) {
|
107
84
|
if (!env.env.getLinter) return undefined;
|
108
85
|
const mergedOpts = this.optionsWithDefaults({});
|
@@ -116,9 +93,7 @@ class LinterService {
|
|
116
93
|
displayName: linter.displayName ? linter.displayName : '?'
|
117
94
|
};
|
118
95
|
}
|
119
|
-
|
120
96
|
}
|
121
|
-
|
122
97
|
exports.LinterService = LinterService;
|
123
98
|
|
124
99
|
//# sourceMappingURL=linter.service.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["LinterService","constructor","linterConfig","rootDir","run","context","options","mergedOpts","optionsWithDefaults","linterContext","mergeContext","linter","env","getLinter","results","lint","defaults","Object","assign","quiet","extensionFormats","fixTypes","fix","render","descriptor","getDescriptor","id","displayName","version","config","highlight","language","ignoreIllegals","undefined","icon","displayConfig"],"sources":["linter.service.tsx"],"sourcesContent":["import React from 'react';\nimport { defaults } from 'lodash';\nimport { EnvService, ExecutionContext, EnvDefinition } from '@teambit/envs';\nimport { Text, Newline } from 'ink';\nimport highlight from 'cli-highlight';\nimport { Linter, LintResults } from './linter';\nimport { LinterContext, LinterOptions } from './linter-context';\nimport { LinterConfig } from './linter.main.runtime';\n\nexport class LinterService implements EnvService<LintResults> {\n name = 'linter';\n\n constructor(private linterConfig: LinterConfig, private rootDir?: string) {}\n\n async run(context: ExecutionContext, options: LinterOptions): Promise<LintResults> {\n const mergedOpts = this.optionsWithDefaults(options);\n const linterContext = this.mergeContext(mergedOpts, context);\n const linter: Linter = context.env.getLinter(linterContext);\n\n const results = await linter.lint(linterContext);\n return results;\n }\n\n private optionsWithDefaults(options: LinterOptions): LinterOptions {\n return defaults(options, this.linterConfig);\n }\n\n private mergeContext(options: LinterOptions, context?: ExecutionContext): LinterContext {\n const linterContext: LinterContext = Object.assign(\n {},\n {\n rootDir: this.rootDir,\n quiet: false,\n extensionFormats: options.extensionFormats,\n fixTypes: options.fixTypes,\n fix: options.fix,\n },\n context\n );\n return linterContext;\n }\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured linter: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text color=\"cyan\">linter config:</Text>\n <Newline />\n <Text>\n {descriptor?.config && highlight(descriptor?.config, { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n getDescriptor(env: EnvDefinition) {\n if (!env.env.getLinter) return undefined;\n const mergedOpts = this.optionsWithDefaults({});\n const linterContext = this.mergeContext(mergedOpts);\n const linter = env.env.getLinter(linterContext);\n\n return {\n id: linter.id,\n icon: linter.icon,\n config: linter.displayConfig ? linter.displayConfig() : undefined,\n version: linter.version ? linter.version() : '?',\n displayName: linter.displayName ? linter.displayName : '?',\n };\n }\n}\n"],"mappings":"
|
1
|
+
{"version":3,"names":["LinterService","constructor","linterConfig","rootDir","run","context","options","mergedOpts","optionsWithDefaults","linterContext","mergeContext","linter","env","getLinter","results","lint","defaults","Object","assign","quiet","extensionFormats","fixTypes","fix","render","descriptor","getDescriptor","id","displayName","version","config","highlight","language","ignoreIllegals","undefined","icon","displayConfig"],"sources":["linter.service.tsx"],"sourcesContent":["import React from 'react';\nimport { defaults } from 'lodash';\nimport { EnvService, ExecutionContext, EnvDefinition } from '@teambit/envs';\nimport { Text, Newline } from 'ink';\nimport highlight from 'cli-highlight';\nimport { Linter, LintResults } from './linter';\nimport { LinterContext, LinterOptions } from './linter-context';\nimport { LinterConfig } from './linter.main.runtime';\n\nexport class LinterService implements EnvService<LintResults> {\n name = 'linter';\n\n constructor(private linterConfig: LinterConfig, private rootDir?: string) {}\n\n async run(context: ExecutionContext, options: LinterOptions): Promise<LintResults> {\n const mergedOpts = this.optionsWithDefaults(options);\n const linterContext = this.mergeContext(mergedOpts, context);\n const linter: Linter = context.env.getLinter(linterContext);\n\n const results = await linter.lint(linterContext);\n return results;\n }\n\n private optionsWithDefaults(options: LinterOptions): LinterOptions {\n return defaults(options, this.linterConfig);\n }\n\n private mergeContext(options: LinterOptions, context?: ExecutionContext): LinterContext {\n const linterContext: LinterContext = Object.assign(\n {},\n {\n rootDir: this.rootDir,\n quiet: false,\n extensionFormats: options.extensionFormats,\n fixTypes: options.fixTypes,\n fix: options.fix,\n },\n context\n );\n return linterContext;\n }\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured linter: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text color=\"cyan\">linter config:</Text>\n <Newline />\n <Text>\n {descriptor?.config && highlight(descriptor?.config, { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n getDescriptor(env: EnvDefinition) {\n if (!env.env.getLinter) return undefined;\n const mergedOpts = this.optionsWithDefaults({});\n const linterContext = this.mergeContext(mergedOpts);\n const linter = env.env.getLinter(linterContext);\n\n return {\n id: linter.id,\n icon: linter.icon,\n config: linter.displayConfig ? linter.displayConfig() : undefined,\n version: linter.version ? linter.version() : '?',\n displayName: linter.displayName ? linter.displayName : '?',\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKO,MAAMA,aAAa,CAAoC;EAG5DC,WAAW,CAASC,YAA0B,EAAUC,OAAgB,EAAE;IAAA,KAAtDD,YAA0B,GAA1BA,YAA0B;IAAA,KAAUC,OAAgB,GAAhBA,OAAgB;IAAA,8CAFjE,QAAQ;EAE4D;EAE3E,MAAMC,GAAG,CAACC,OAAyB,EAAEC,OAAsB,EAAwB;IACjF,MAAMC,UAAU,GAAG,IAAI,CAACC,mBAAmB,CAACF,OAAO,CAAC;IACpD,MAAMG,aAAa,GAAG,IAAI,CAACC,YAAY,CAACH,UAAU,EAAEF,OAAO,CAAC;IAC5D,MAAMM,MAAc,GAAGN,OAAO,CAACO,GAAG,CAACC,SAAS,CAACJ,aAAa,CAAC;IAE3D,MAAMK,OAAO,GAAG,MAAMH,MAAM,CAACI,IAAI,CAACN,aAAa,CAAC;IAChD,OAAOK,OAAO;EAChB;EAEQN,mBAAmB,CAACF,OAAsB,EAAiB;IACjE,OAAO,IAAAU,kBAAQ,E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,IAAI,CAACA,GAAG,CAACA,GAAG,CAACC,SAAS,EAAE,OAAOoB,SAAS;IACxC,MAAM1B,UAAU,GAAG,IAAI,CAACC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAC/C,MAAMC,aAAa,GAAG,IAAI,CAACC,YAAY,CAACH,UAAU,CAAC;IACnD,MAAMI,MAAM,GAAGC,GAAG,CAACA,GAAG,CAACC,SAAS,CAACJ,aAAa,CAAC;IAE/C,OAAO;MACLiB,EAAE,EAAEf,MAAM,CAACe,EAAE;MACbQ,IAAI,EAAEvB,MAAM,CAACuB,IAAI;MACjBL,MAAM,EAAElB,MAAM,CAACwB,aAAa,GAAGxB,MAAM,CAACwB,aAAa,EAAE,GAAGF,SAAS;MACjEL,OAAO,EAAEjB,MAAM,CAACiB,OAAO,GAAGjB,MAAM,CAACiB,OAAO,EAAE,GAAG,GAAG;MAChDD,WAAW,EAAEhB,MAAM,CAACgB,WAAW,GAAGhB,MAAM,CAACgB,WAAW,GAAG;IACzD,CAAC;EACH;AACF;AAAC"}
|
Binary file
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/linter",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.882",
|
4
4
|
"homepage": "https://bit.dev/teambit/defender/linter",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"componentId": {
|
7
7
|
"scope": "teambit.defender",
|
8
8
|
"name": "linter",
|
9
|
-
"version": "0.0.
|
9
|
+
"version": "0.0.882"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"chalk": "2.4.2",
|
@@ -17,12 +17,12 @@
|
|
17
17
|
"@babel/runtime": "7.12.18",
|
18
18
|
"core-js": "^3.0.0",
|
19
19
|
"@teambit/harmony": "0.3.3",
|
20
|
-
"@teambit/cli": "0.0.
|
21
|
-
"@teambit/component": "0.0.
|
22
|
-
"@teambit/envs": "0.0.
|
23
|
-
"@teambit/workspace": "0.0.
|
24
|
-
"@teambit/builder": "0.0.
|
25
|
-
"@teambit/logger": "0.0.
|
20
|
+
"@teambit/cli": "0.0.591",
|
21
|
+
"@teambit/component": "0.0.882",
|
22
|
+
"@teambit/envs": "0.0.882",
|
23
|
+
"@teambit/workspace": "0.0.882",
|
24
|
+
"@teambit/builder": "0.0.882",
|
25
|
+
"@teambit/logger": "0.0.684"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
28
|
"@types/lodash": "4.14.165",
|
@@ -35,7 +35,7 @@
|
|
35
35
|
"@teambit/defender.content.linter-overview": "1.95.0"
|
36
36
|
},
|
37
37
|
"peerDependencies": {
|
38
|
-
"@teambit/legacy": "1.0.
|
38
|
+
"@teambit/legacy": "1.0.374",
|
39
39
|
"react-dom": "^16.8.0 || ^17.0.0",
|
40
40
|
"react": "^16.8.0 || ^17.0.0"
|
41
41
|
},
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_linter@0.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_linter@0.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_linter@0.0.882/dist/linter.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_linter@0.0.882/dist/linter.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
Binary file
|