@teambit/linter 1.0.142 → 1.0.143
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/artifacts/__bit_junit.xml +4 -0
- package/artifacts/preview/teambit_defender_linter-preview.js +1 -1
- package/dist/lint.cmd.d.ts +6 -2
- package/dist/lint.cmd.js +19 -8
- package/dist/lint.cmd.js.map +1 -1
- package/dist/linter.composition.d.ts +1 -0
- package/dist/linter.service.d.ts +2 -1
- package/dist/{preview-1705806923881.js → preview-1706194779559.js} +2 -2
- package/package.json +14 -14
- package/tsconfig.json +4 -1
@@ -1 +1 @@
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["teambit.defender/linter-preview"]=n():e["teambit.defender/linter-preview"]=n()}(self,(()=>(()=>{"use strict";var e={
|
1
|
+
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["teambit.defender/linter-preview"]=n():e["teambit.defender/linter-preview"]=n()}(self,(()=>(()=>{"use strict";var e={30466:(e,n,t)=>{Object.defineProperty(n,"ZP",{enumerable:!0,get:function(){return o.default}});var o=r(t(80662));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.defender/content/linter-overview@1.95.0",homepage:"https://bit.dev/teambit/defender/content/linter-overview",exported:!0}},80662:(e,n,t)=>{var o={id:"teambit.defender/content/linter-overview@1.95.0",homepage:"https://bit.dev/teambit/defender/content/linter-overview",exported:!0};Object.defineProperty(n,"__esModule",{value:!0}),n.default=c,p(t(87363));var r=t(40040),i=t(70500),a=["components"];function p(e){return e&&e.__esModule?e:{default:e}}function d(){return d=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},d.apply(this,arguments)}function l(e,n){if(null==e)return{};var t,o,r=s(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)t=i[o],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}function s(e,n){if(null==e)return{};var t,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t=i[o],n.indexOf(t)>=0||(r[t]=e[t]);return r}p.__bit_component=o,d.__bit_component=o,l.__bit_component=o,s.__bit_component=o;var m={},u="wrapper";function c(e){var n=e.components,t=l(e,a);return(0,r.mdx)(u,d({},m,t,{components:n,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,r.mdx)("h1",null,"Overview"),(0,r.mdx)("p",null,"Linting helps us maintain consistent code styling and avoid potential bugs by analyzing our source code, statically, before it is compiled and executed."),(0,r.mdx)("p",null,"The Linter aspect simplifies and standardizes the process of component linting. It does so for linting during development (in the workspace) and for linting during component build (in a capsule, as part of the ",(0,r.mdx)("a",{parentName:"p",href:"/builder/build-pipelines"},"Build Pipeline"),")"),(0,r.mdx)("h2",null,"Linting in development"),(0,r.mdx)("p",null,"Bit lints all components in the ",(0,r.mdx)("a",{parentName:"p",href:"/workspace/overview"},"Workspace")," using just a single command. That is true for components of all types, regardless of their specific ",(0,r.mdx)("a",{parentName:"p",href:"/envs/overview"},"Env"),", and as a consequence of that, their specific Linter implementation"," and configuration."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"bit lint\n")),(0,r.mdx)("p",null,"To learn more on linting during development, please refer to ",(0,r.mdx)("a",{parentName:"p",href:"/linter/workspace-linting"},"Workspace Linting"),"."),(0,r.mdx)("h2",null,"Linting during build"),(0,r.mdx)("p",null,"During build, the lint task is only used for checking linting issues. it will not re-write the components with the auto fix option."),(0,r.mdx)("p",null,"Testing components for distribution is done during ",(0,r.mdx)("inlineCode",{parentName:"p"},"build")," by the Bit ",(0,r.mdx)("a",{parentName:"p",href:"/builder/overview"},"Builder"),"."),(0,r.mdx)("p",null,"Component build can be simulated with ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit build")," and done through ",(0,r.mdx)("a",{parentName:"p",href:"/components/tags"},"Tag")," or ",(0,r.mdx)("a",{parentName:"p",href:"/components/snaps"},"Snap")),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"bit build\n")),(0,r.mdx)("p",null,"By default, linting is ",(0,r.mdx)("strong",{parentName:"p"},"not")," part of the ",(0,r.mdx)("a",{parentName:"p",href:"/builder/build-pipelines"},"Build Pipeline"),"."),(0,r.mdx)("h2",null,"Configuring and implementing Linters"),(0,r.mdx)("p",null,"The Linter implementation"," is configured in the ",(0,r.mdx)("a",{parentName:"p",href:"/envs/overview"},"Env")," which is configured on your ",(0,r.mdx)("a",{parentName:"p",href:"/components/overview"},"Component"),". Customizing it can be done by ",(0,r.mdx)("a",{parentName:"p",href:"/"},"customizing an existing env with your linter")," or by ",(0,r.mdx)("a",{parentName:"p",href:"/envs/customizing-env"},"implementing your own Env"),"."),(0,r.mdx)("p",null,"Linter can also be implemented into Bit through few interfaces. ")))}c.__bit_component=o,c.isMDXComponent=!0},70830:(e,n,t)=>{var o={id:"teambit.defender/linter@1.0.143",homepage:"https://bit.cloud/teambit/defender/linter",exported:!0};function r(){const e=i(t(87363));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.Logo=void 0,r.__bit_component=o,i.__bit_component=o;const a=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/linter.svg"}));a.__bit_component=o,n.Logo=a},40040:e=>{e.exports=MdxJsReact},87363:e=>{e.exports=React},70500:e=>{e.exports=TeambitMdxUiMdxScopeContext}},n={};function t(o){var r=n[o];if(void 0!==r)return r.exports;var i=n[o]={exports:{}};return e[o](i,i.exports,t),i.exports}t.d=(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{t.r(o),t.d(o,{compositions:()=>u,compositions_metadata:()=>f,overview:()=>c});var e={};t.r(e),t.d(e,{default:()=>m});var n=t(70830),r=(t(87363),t(40040)),i=t(70500),a=t(30466),p=["components"];function d(){return d=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},d.apply(this,arguments)}var l={},s="wrapper";function m(e){var n=e.components,t=function(e,n){if(null==e)return{};var t,o,r=function(e,n){if(null==e)return{};var t,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t=i[o],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)t=i[o],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}(e,p);return(0,r.mdx)(s,d({},l,t,{components:n,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{LinterOverview:a.ZP},mdxType:"MDXScopeProvider"},(0,r.mdx)(a.ZP,{mdxType:"LinterOverview"})))}m.isMDXComponent=!0;const u=[n],c=[e],f={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),o})()));
|
package/dist/lint.cmd.d.ts
CHANGED
@@ -37,16 +37,20 @@ export declare class LintCmd implements Command {
|
|
37
37
|
private workspace;
|
38
38
|
name: string;
|
39
39
|
description: string;
|
40
|
+
arguments: {
|
41
|
+
name: string;
|
42
|
+
description: string;
|
43
|
+
}[];
|
40
44
|
helpUrl: string;
|
41
45
|
group: string;
|
42
46
|
options: CommandOptions;
|
43
47
|
constructor(linter: LinterMain, componentHost: ComponentFactory, workspace: Workspace);
|
44
|
-
report([
|
48
|
+
report([pattern]: [string], linterOptions: LintCmdOptions): Promise<{
|
45
49
|
code: number;
|
46
50
|
data: string;
|
47
51
|
}>;
|
48
52
|
private getSummarySection;
|
49
53
|
private renderTotalLine;
|
50
|
-
json([
|
54
|
+
json([pattern]: [string], linterOptions: LintCmdOptions): Promise<JsonLintResults>;
|
51
55
|
private getIdsToLint;
|
52
56
|
}
|
package/dist/lint.cmd.js
CHANGED
@@ -11,6 +11,13 @@ function _timer() {
|
|
11
11
|
};
|
12
12
|
return data;
|
13
13
|
}
|
14
|
+
function _constants() {
|
15
|
+
const data = require("@teambit/legacy/dist/constants");
|
16
|
+
_constants = function () {
|
17
|
+
return data;
|
18
|
+
};
|
19
|
+
return data;
|
20
|
+
}
|
14
21
|
function _chalk() {
|
15
22
|
const data = _interopRequireDefault(require("chalk"));
|
16
23
|
_chalk = function () {
|
@@ -42,17 +49,21 @@ class LintCmd {
|
|
42
49
|
this.linter = linter;
|
43
50
|
this.componentHost = componentHost;
|
44
51
|
this.workspace = workspace;
|
45
|
-
_defineProperty(this, "name", 'lint [component
|
52
|
+
_defineProperty(this, "name", 'lint [component-pattern]');
|
46
53
|
_defineProperty(this, "description", 'lint components in the development workspace');
|
54
|
+
_defineProperty(this, "arguments", [{
|
55
|
+
name: 'component-pattern',
|
56
|
+
description: _constants().COMPONENT_PATTERN_HELP
|
57
|
+
}]);
|
47
58
|
_defineProperty(this, "helpUrl", 'reference/linting/linter-overview');
|
48
59
|
_defineProperty(this, "group", 'development');
|
49
60
|
_defineProperty(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']]);
|
50
61
|
}
|
51
|
-
async report([
|
62
|
+
async report([pattern], linterOptions) {
|
52
63
|
const {
|
53
64
|
code,
|
54
65
|
data
|
55
|
-
} = await this.json([
|
66
|
+
} = await this.json([pattern], linterOptions);
|
56
67
|
const {
|
57
68
|
lintResults,
|
58
69
|
componentsIdsToLint
|
@@ -110,10 +121,10 @@ class LintCmd {
|
|
110
121
|
if (itemsCount === 0) return undefined;
|
111
122
|
return `total of ${_chalk().default.green(itemsCount.toString())} ${_chalk().default.cyan(fieldLabel)} (from ${_chalk().default.green(componentsCount.toString())} components)`;
|
112
123
|
}
|
113
|
-
async json([
|
124
|
+
async json([pattern], linterOptions) {
|
114
125
|
const timer = _timer().Timer.create();
|
115
126
|
timer.start();
|
116
|
-
const componentsIds = await this.getIdsToLint(
|
127
|
+
const componentsIds = await this.getIdsToLint(pattern, linterOptions.changed);
|
117
128
|
const componentsToLint = await this.workspace.getMany(componentsIds);
|
118
129
|
const opts = {
|
119
130
|
fix: linterOptions.fix,
|
@@ -135,9 +146,9 @@ class LintCmd {
|
|
135
146
|
}
|
136
147
|
};
|
137
148
|
}
|
138
|
-
async getIdsToLint(
|
139
|
-
if (
|
140
|
-
return this.workspace.
|
149
|
+
async getIdsToLint(pattern, changed = false) {
|
150
|
+
if (pattern) {
|
151
|
+
return this.workspace.idsByPattern(pattern);
|
141
152
|
}
|
142
153
|
if (changed) {
|
143
154
|
return this.workspace.getNewAndModifiedIds();
|
package/dist/lint.cmd.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_timer","data","require","_chalk","_interopRequireDefault","_lodash","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","LintCmd","constructor","linter","componentHost","workspace","report","components","linterOptions","code","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","exports","totalFixableErrorCount","totalFixableWarningCount","totalWarningCount","totalComponentsWithErrorCount","totalComponentsWithFatalErrorCount","totalComponentsWithFixableErrorCount","totalComponentsWithFixableWarningCount","totalComponentsWithWarningCount","newResults","res","resultsWithoutComponent","result","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 helpUrl = 'reference/linting/linter-overview';\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,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,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BAAO,EAACL,uBAAuB,CAAC;EACzC,CAAC,CAAC;EACF,OAAO;IACLlE,OAAO,EAAE,IAAAuE,iBAAO,EAAC,IAAAC,iBAAO,EAACR,UAAU,CAAC,CAAC;IACrChB,eAAe;IACfC,oBAAoB;IACpBO,sBAAsB;IACtBC,wBAAwB;IACxBC,iBAAiB;IACjBC,6BAA6B;IAC7BC,kCAAkC;IAClCC,oCAAoC;IACpCC,sCAAsC;IACtCC,+BAA+B;IAC/BU,MAAM,EAAEzE,OAAO,EAAEyE;EACnB,CAAC;AACH"}
|
1
|
+
{"version":3,"names":["_timer","data","require","_constants","_chalk","_interopRequireDefault","_lodash","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","LintCmd","constructor","linter","componentHost","workspace","name","description","COMPONENT_PATTERN_HELP","report","pattern","linterOptions","code","json","lintResults","componentsIdsToLint","title","chalk","bold","cyan","length","toString","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","idsByPattern","getNewAndModifiedIds","listIds","exports","totalFixableErrorCount","totalFixableWarningCount","totalWarningCount","totalComponentsWithErrorCount","totalComponentsWithFatalErrorCount","totalComponentsWithFixableErrorCount","totalComponentsWithFixableWarningCount","totalComponentsWithWarningCount","newResults","res","resultsWithoutComponent","result","assign","component","omit","compact","flatten","errors"],"sources":["lint.cmd.ts"],"sourcesContent":["import { TimerResponse, Timer } from '@teambit/legacy/dist/toolbox/timer';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\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-pattern]';\n description = 'lint components in the development workspace';\n arguments = [{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP }];\n helpUrl = 'reference/linting/linter-overview';\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([pattern]: [string], linterOptions: LintCmdOptions) {\n const { code, data } = await this.json([pattern], 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([pattern]: [string], linterOptions: LintCmdOptions): Promise<JsonLintResults> {\n const timer = Timer.create();\n timer.start();\n const componentsIds = await this.getIdsToLint(pattern, 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(pattern: string, changed = false): Promise<ComponentID[]> {\n if (pattern) {\n return this.workspace.idsByPattern(pattern);\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,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAgD,SAAAI,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GA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,oCAAoC;IACpCC,sCAAsC;IACtCC,+BAA+B;IAC/BU,MAAM,EAAEzE,OAAO,EAAEyE;EACnB,CAAC;AACH"}
|
package/dist/linter.service.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
/// <reference types="react" />
|
1
2
|
import { EnvService, ExecutionContext, EnvDefinition, ServiceTransformationMap, EnvContext, Env } from '@teambit/envs';
|
2
3
|
import { Workspace } from '@teambit/workspace';
|
3
4
|
import { Linter, LintResults } from './linter';
|
@@ -24,6 +25,6 @@ export declare class LinterService implements EnvService<LintResults> {
|
|
24
25
|
config: any;
|
25
26
|
version: any;
|
26
27
|
displayName: any;
|
27
|
-
};
|
28
|
+
} | undefined;
|
28
29
|
}
|
29
30
|
export {};
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_linter@1.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_linter@1.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_linter@1.0.143/dist/linter.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_linter@1.0.143/dist/linter.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/linter",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.143",
|
4
4
|
"homepage": "https://bit.cloud/teambit/defender/linter",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"componentId": {
|
7
7
|
"scope": "teambit.defender",
|
8
8
|
"name": "linter",
|
9
|
-
"version": "1.0.
|
9
|
+
"version": "1.0.143"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"chalk": "2.4.2",
|
@@ -15,25 +15,24 @@
|
|
15
15
|
"cli-highlight": "2.1.9",
|
16
16
|
"ink": "3.2.0",
|
17
17
|
"@teambit/harmony": "0.4.6",
|
18
|
-
"@teambit/cli": "0.0.
|
19
|
-
"@teambit/component": "1.0.
|
20
|
-
"@teambit/envs": "1.0.
|
21
|
-
"@teambit/workspace": "1.0.
|
22
|
-
"@teambit/builder": "1.0.
|
23
|
-
"@teambit/isolator": "1.0.
|
24
|
-
"@teambit/logger": "0.0.
|
18
|
+
"@teambit/cli": "0.0.849",
|
19
|
+
"@teambit/component": "1.0.143",
|
20
|
+
"@teambit/envs": "1.0.143",
|
21
|
+
"@teambit/workspace": "1.0.143",
|
22
|
+
"@teambit/builder": "1.0.143",
|
23
|
+
"@teambit/isolator": "1.0.143",
|
24
|
+
"@teambit/logger": "0.0.942"
|
25
25
|
},
|
26
26
|
"devDependencies": {
|
27
27
|
"@types/lodash": "4.14.165",
|
28
28
|
"@types/mocha": "9.1.0",
|
29
|
-
"
|
30
|
-
"@types/testing-library__jest-dom": "^5.9.5",
|
29
|
+
"chai": "4.3.0",
|
31
30
|
"@teambit/defender.content.linter-overview": "1.95.0",
|
32
|
-
"@teambit/harmony.envs.core-aspect-env": "0.0.
|
31
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.24"
|
33
32
|
},
|
34
33
|
"peerDependencies": {
|
35
34
|
"react": "^17.0.0 || ^18.0.0",
|
36
|
-
"@types/react": "17.0.
|
35
|
+
"@types/react": "^17.0.73",
|
37
36
|
"@teambit/legacy": "1.0.624"
|
38
37
|
},
|
39
38
|
"license": "Apache-2.0",
|
@@ -48,7 +47,8 @@
|
|
48
47
|
"default": "./dist/index.js"
|
49
48
|
},
|
50
49
|
"./dist/*": "./dist/*",
|
51
|
-
"./artifacts/*": "./artifacts/*"
|
50
|
+
"./artifacts/*": "./artifacts/*",
|
51
|
+
"./*": "./*.ts"
|
52
52
|
},
|
53
53
|
"private": false,
|
54
54
|
"engines": {
|
package/tsconfig.json
CHANGED
@@ -17,7 +17,10 @@
|
|
17
17
|
"resolveJsonModule": true,
|
18
18
|
"allowJs": true,
|
19
19
|
"outDir": "dist",
|
20
|
-
"emitDeclarationOnly": true
|
20
|
+
"emitDeclarationOnly": true,
|
21
|
+
"strict": true,
|
22
|
+
"strictPropertyInitialization": false,
|
23
|
+
"noImplicitAny": false
|
21
24
|
},
|
22
25
|
"exclude": [
|
23
26
|
"artifacts",
|