@teambit/linter 1.0.107 → 1.0.109

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.
@@ -0,0 +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={33802:(e,n,t)=>{var o={id:"teambit.defender/linter@1.0.109",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},54272:(e,n,t)=>{Object.defineProperty(n,"ZP",{enumerable:!0,get:function(){return o.default}});var o=r(t(43538));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}},43538:(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},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(33802),r=(t(87363),t(40040)),i=t(70500),a=t(54272),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})()));
@@ -4,7 +4,7 @@ import { ComponentFactory, ComponentID } from '@teambit/component';
4
4
  import { Workspace } from '@teambit/workspace';
5
5
  import { LinterMain } from './linter.main.runtime';
6
6
  import { ComponentLintResult, LintResults } from './linter';
7
- export declare type LintCmdOptions = {
7
+ export type LintCmdOptions = {
8
8
  changed?: boolean;
9
9
  fix?: boolean;
10
10
  fixType?: string;
@@ -13,21 +13,21 @@ export declare type LintCmdOptions = {
13
13
  /**
14
14
  * 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
15
15
  */
16
- export declare type JsonComponentLintResult = Omit<ComponentLintResult, 'component'> & {
16
+ export type JsonComponentLintResult = Omit<ComponentLintResult, 'component'> & {
17
17
  componentId: ComponentID;
18
18
  };
19
- export declare type JsonLintDataResults = Omit<LintResults, 'results'> & {
19
+ export type JsonLintDataResults = Omit<LintResults, 'results'> & {
20
20
  results: JsonComponentLintResult[];
21
21
  };
22
22
  /**
23
23
  * 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
24
24
  */
25
- export declare type JsonLintResultsData = {
25
+ export type JsonLintResultsData = {
26
26
  duration: TimerResponse;
27
27
  lintResults: JsonLintDataResults;
28
28
  componentsIdsToLint: string[];
29
29
  };
30
- export declare type JsonLintResults = {
30
+ export type JsonLintResults = {
31
31
  code: number;
32
32
  data: JsonLintResultsData;
33
33
  };
package/dist/lint.cmd.js CHANGED
@@ -158,8 +158,7 @@ function toJsonLintResults(results) {
158
158
  let totalComponentsWithFixableWarningCount = 0;
159
159
  let totalComponentsWithWarningCount = 0;
160
160
  const newResults = results.results.map(res => {
161
- var _res$data;
162
- const resultsWithoutComponent = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.results.map(result => {
161
+ const resultsWithoutComponent = res.data?.results.map(result => {
163
162
  return Object.assign({}, {
164
163
  componentId: result.component.id
165
164
  }, (0, _lodash().omit)(result, ['component']));
@@ -200,7 +199,7 @@ function toJsonLintResults(results) {
200
199
  totalComponentsWithFixableErrorCount,
201
200
  totalComponentsWithFixableWarningCount,
202
201
  totalComponentsWithWarningCount,
203
- errors: results === null || results === void 0 ? void 0 : results.errors
202
+ errors: results?.errors
204
203
  };
205
204
  }
206
205
 
@@ -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","_res$data","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,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAgD,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA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AC,iBAAO,EAACT,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/BW,MAAM,EAAE1E,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAE0E;EACnB,CAAC;AACH"}
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,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAgD,SAAAG,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,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAE,MAAA,CAAAF,CAAA;AAAA,S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I,CAAC;MACxF;MACA,IAAIK,GAAG,CAACjH,IAAI,CAACwG,sBAAsB,EAAE;QACnCA,sBAAsB,IAAIS,GAAG,CAACjH,IAAI,CAACwG,sBAAsB;QACzDK,oCAAoC,IAAII,GAAG,CAACjH,IAAI,CAAC6G,oCAAoC,IAAI,CAAC;MAC5F;MACA,IAAII,GAAG,CAACjH,IAAI,CAACyG,wBAAwB,EAAE;QACrCA,wBAAwB,IAAIQ,GAAG,CAACjH,IAAI,CAACyG,wBAAwB;QAC7DK,sCAAsC,IAAIG,GAAG,CAACjH,IAAI,CAAC8G,sCAAsC,IAAI,CAAC;MAChG;MACA,IAAIG,GAAG,CAACjH,IAAI,CAAC0G,iBAAiB,EAAE;QAC9BA,iBAAiB,IAAIO,GAAG,CAACjH,IAAI,CAAC0G,iBAAiB;QAC/CK,+BAA+B,IAAIE,GAAG,CAACjH,IAAI,CAAC+G,+BAA+B,IAAI,CAAC;MAClF;IACF;IAEA,OAAO,IAAAQ,iBAAO,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"}
package/dist/lint.task.js CHANGED
@@ -56,8 +56,7 @@ class LintTask {
56
56
  }
57
57
  getComponentsDirectory(capsuleRootDir, components, capsuleList) {
58
58
  return _component().ComponentMap.as(components, component => {
59
- var _capsuleList$getCapsu;
60
- const fullPath = ((_capsuleList$getCapsu = capsuleList.getCapsule(component.id)) === null || _capsuleList$getCapsu === void 0 ? void 0 : _capsuleList$getCapsu.path) || '';
59
+ const fullPath = capsuleList.getCapsule(component.id)?.path || '';
61
60
  const relativePath = _path().default.relative(capsuleRootDir, fullPath);
62
61
  return relativePath;
63
62
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_path","data","_interopRequireDefault","require","_component","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","LintTask","constructor","aspectId","name","execute","context","linter","env","getLinter","rootDir","capsuleNetwork","capsulesRootDir","componentsDirMap","getComponentsDirectory","components","graphCapsules","linterContext","results","lint","componentsResults","map","lintResult","component","metadata","output","errors","capsuleRootDir","capsuleList","ComponentMap","as","_capsuleList$getCapsu","fullPath","getCapsule","id","path","relativePath","relative","exports"],"sources":["lint.task.ts"],"sourcesContent":["import path from 'path';\nimport { BuildTask, BuiltTaskResult, BuildContext, ComponentResult } from '@teambit/builder';\nimport { Component, ComponentMap } from '@teambit/component';\nimport { CapsuleList } from '@teambit/isolator';\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 const rootDir = context.capsuleNetwork.capsulesRootDir;\n const componentsDirMap = this.getComponentsDirectory(\n rootDir,\n context.components,\n context.capsuleNetwork.graphCapsules\n );\n\n // @ts-ignore TODO: fix this\n const linterContext: LinterContext = {\n rootDir,\n componentsDirMap,\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 private getComponentsDirectory(\n capsuleRootDir: string,\n components: Component[],\n capsuleList: CapsuleList\n ): ComponentMap<string> {\n return ComponentMap.as<string>(components, (component) => {\n const fullPath = capsuleList.getCapsule(component.id)?.path || '';\n const relativePath = path.relative(capsuleRootDir, fullPath);\n return relativePath;\n });\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6D,SAAAC,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,C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A,QAAA"}
1
+ {"version":3,"names":["_path","data","_interopRequireDefault","require","_component","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","LintTask","constructor","aspectId","name","execute","context","linter","env","getLinter","rootDir","capsuleNetwork","capsulesRootDir","componentsDirMap","getComponentsDirectory","components","graphCapsules","linterContext","results","lint","componentsResults","map","lintResult","component","metadata","output","errors","capsuleRootDir","capsuleList","ComponentMap","as","fullPath","getCapsule","id","path","relativePath","relative","exports"],"sources":["lint.task.ts"],"sourcesContent":["import path from 'path';\nimport { BuildTask, BuiltTaskResult, BuildContext, ComponentResult } from '@teambit/builder';\nimport { Component, ComponentMap } from '@teambit/component';\nimport { CapsuleList } from '@teambit/isolator';\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 const rootDir = context.capsuleNetwork.capsulesRootDir;\n const componentsDirMap = this.getComponentsDirectory(\n rootDir,\n context.components,\n context.capsuleNetwork.graphCapsules\n );\n\n // @ts-ignore TODO: fix this\n const linterContext: LinterContext = {\n rootDir,\n componentsDirMap,\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 private getComponentsDirectory(\n capsuleRootDir: string,\n components: Component[],\n capsuleList: CapsuleList\n ): ComponentMap<string> {\n return ComponentMap.as<string>(components, (component) => {\n const fullPath = capsuleList.getCapsule(component.id)?.path || '';\n const relativ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S,CAAC,CAAC;IAC9C,MAAMC,OAAO,GAAGJ,OAAO,CAACK,cAAc,CAACC,eAAe;IACtD,MAAMC,gBAAgB,GAAG,IAAI,CAACC,sBAAsB,CAClDJ,OAAO,EACPJ,OAAO,CAACS,UAAU,EAClBT,OAAO,CAACK,cAAc,CAACK,aACzB,CAAC;;IAED;IACA,MAAMC,aAA4B,GAAArC,aAAA;MAChC8B,OAAO;MACPG;IAAgB,GACbP,OAAO,CACX;IACD,MAAMY,OAAO,GAAG,MAAMX,MAAM,CAACY,IAAI,CAACF,aAAa,CAAC;IAChD,MAAMG,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;EAEQN,sBAAsBA,CAC5Ba,cAAsB,EACtBZ,UAAuB,EACvBa,WAAwB,EACF;IACtB,OAAOC,yBAAY,CAACC,EAAE,CAASf,UAAU,EAAGQ,SAAS,IAAK;MACxD,MAAMQ,QAAQ,GAAGH,WAAW,CAACI,UAAU,CAACT,SAAS,CAACU,EAAE,CAAC,EAAEC,IAAI,IAAI,EAAE;MACjE,MAAMC,YAAY,GAAGD,eAAI,CAACE,QAAQ,CAACT,cAAc,EAAEI,QAAQ,CAAC;MAC5D,OAAOI,YAAY;IACrB,CAAC,CAAC;EACJ;AACF;AAACE,OAAA,CAAApC,QAAA,GAAAA,QAAA"}
@@ -1,7 +1,7 @@
1
1
  import { ComponentMap } from '@teambit/component';
2
2
  import { ExecutionContext } from '@teambit/envs';
3
- export declare type FixType = 'problem' | 'suggestion' | 'layout';
4
- export declare type FixTypes = Array<FixType>;
3
+ export type FixType = 'problem' | 'suggestion' | 'layout';
4
+ export type FixTypes = Array<FixType>;
5
5
  export interface LinterOptions {
6
6
  /**
7
7
  * extensions formats to lint. (e.g. .ts, .tsx, etc.)
@@ -1,2 +1,2 @@
1
- import React from 'react';
2
- export declare const Logo: () => React.JSX.Element;
1
+ /// <reference types="react" />
2
+ export declare const Logo: () => JSX.Element;
package/dist/linter.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BuildContext } from '@teambit/builder';
2
2
  import { Component } from '@teambit/component';
3
3
  import { LinterContext } from './linter-context';
4
- export declare type ComponentLintResult = {
4
+ export type ComponentLintResult = {
5
5
  /**
6
6
  * the linted component.
7
7
  */
@@ -35,7 +35,7 @@ export declare type ComponentLintResult = {
35
35
  */
36
36
  results: LintResult[];
37
37
  };
38
- export declare type LintResult = {
38
+ export type LintResult = {
39
39
  /**
40
40
  * path of the linted file.
41
41
  */
@@ -69,7 +69,7 @@ export declare type LintResult = {
69
69
  */
70
70
  raw: any;
71
71
  };
72
- export declare type LintMessage = {
72
+ export type LintMessage = {
73
73
  /**
74
74
  * severity of the issue.
75
75
  */
@@ -99,7 +99,7 @@ export declare type LintMessage = {
99
99
  */
100
100
  suggestions?: string[];
101
101
  };
102
- export declare type LintResults = {
102
+ export type LintResults = {
103
103
  results: ComponentLintResult[];
104
104
  /**
105
105
  * total errors count of the component (from all of the components).
@@ -7,7 +7,7 @@ import { LinterService } from './linter.service';
7
7
  import { LintTask } from './lint.task';
8
8
  import { FixTypes, LinterOptions } from './linter-context';
9
9
  import { Linter } from './linter';
10
- export declare type LinterConfig = {
10
+ export type LinterConfig = {
11
11
  /**
12
12
  * extension formats to lint.
13
13
  */
@@ -1,10 +1,10 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { EnvService, ExecutionContext, EnvDefinition, ServiceTransformationMap, EnvContext, Env } from '@teambit/envs';
3
3
  import { Workspace } from '@teambit/workspace';
4
4
  import { Linter, LintResults } from './linter';
5
5
  import { LinterOptions } from './linter-context';
6
6
  import { LinterConfig } from './linter.main.runtime';
7
- declare type LinterTransformationMap = ServiceTransformationMap & {
7
+ type LinterTransformationMap = ServiceTransformationMap & {
8
8
  getLinter: () => Linter;
9
9
  };
10
10
  export declare class LinterService implements EnvService<LintResults> {
@@ -17,7 +17,7 @@ export declare class LinterService implements EnvService<LintResults> {
17
17
  private optionsWithDefaults;
18
18
  private mergeContext;
19
19
  private getComponentsDirectory;
20
- render(env: EnvDefinition): React.JSX.Element;
20
+ render(env: EnvDefinition): JSX.Element;
21
21
  transform(env: Env, context: EnvContext): LinterTransformationMap | undefined;
22
22
  getDescriptor(env: EnvDefinition): {
23
23
  id: any;
@@ -25,6 +25,6 @@ export declare class LinterService implements EnvService<LintResults> {
25
25
  config: any;
26
26
  version: any;
27
27
  displayName: any;
28
- } | undefined;
28
+ };
29
29
  }
30
30
  export {};
@@ -66,10 +66,9 @@ class LinterService {
66
66
  return (0, _lodash().defaults)(options, this.linterConfig);
67
67
  }
68
68
  mergeContext(options, context) {
69
- var _this$workspace;
70
- const componentsDirMap = context !== null && context !== void 0 && context.components ? this.getComponentsDirectory(context.components) : _component().ComponentMap.create([]);
69
+ const componentsDirMap = context?.components ? this.getComponentsDirectory(context.components) : _component().ComponentMap.create([]);
71
70
  const linterContext = Object.assign({}, {
72
- rootDir: (_this$workspace = this.workspace) === null || _this$workspace === void 0 ? void 0 : _this$workspace.path,
71
+ rootDir: this.workspace?.path,
73
72
  quiet: false,
74
73
  extensionFormats: options.extensionFormats,
75
74
  fixTypes: options.fixTypes,
@@ -86,19 +85,19 @@ class LinterService {
86
85
  render(env) {
87
86
  const descriptor = this.getDescriptor(env);
88
87
  return /*#__PURE__*/_react().default.createElement(_ink().Text, {
89
- key: descriptor === null || descriptor === void 0 ? void 0 : descriptor.id
88
+ key: descriptor?.id
90
89
  }, /*#__PURE__*/_react().default.createElement(_ink().Text, {
91
90
  color: "cyan"
92
- }, "configured linter: "), /*#__PURE__*/_react().default.createElement(_ink().Text, null, descriptor === null || descriptor === void 0 ? void 0 : descriptor.id, " (", descriptor === null || descriptor === void 0 ? void 0 : descriptor.displayName, " @ ", descriptor === null || descriptor === void 0 ? void 0 : descriptor.version, ")"), /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, {
91
+ }, "configured linter: "), /*#__PURE__*/_react().default.createElement(_ink().Text, null, descriptor?.id, " (", descriptor?.displayName, " @ ", descriptor?.version, ")"), /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, {
93
92
  color: "cyan"
94
- }, "linter config:"), /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, null, (descriptor === null || descriptor === void 0 ? void 0 : descriptor.config) && (0, _cliHighlight().default)(descriptor === null || descriptor === void 0 ? void 0 : descriptor.config, {
93
+ }, "linter config:"), /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, null, descriptor?.config && (0, _cliHighlight().default)(descriptor?.config, {
95
94
  language: 'javascript',
96
95
  ignoreIllegals: true
97
96
  })), /*#__PURE__*/_react().default.createElement(_ink().Newline, null));
98
97
  }
99
98
  transform(env, context) {
100
99
  // Old env
101
- if (!(env !== null && env !== void 0 && env.linter)) return undefined;
100
+ if (!env?.linter) return undefined;
102
101
  return {
103
102
  getLinter: () => env.linter()(context)
104
103
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireDefault","require","_lodash","_ink","_cliHighlight","_component","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","LinterService","constructor","linterConfig","workspace","run","context","options","mergedOpts","optionsWithDefaults","linterContext","mergeContext","linter","getLinter","results","lint","env","defaults","_this$workspace","componentsDirMap","components","getComponentsDirectory","ComponentMap","create","assign","rootDir","path","quiet","extensionFormats","fixTypes","fix","as","component","componentDir","id","undefined","relative","render","descriptor","getDescriptor","createElement","Text","color","displayName","version","Newline","config","highlight","language","ignoreIllegals","transform","icon","displayConfig","exports"],"sources":["linter.service.tsx"],"sourcesContent":["import React from 'react';\nimport { defaults } from 'lodash';\nimport { EnvService, ExecutionContext, EnvDefinition, ServiceTransformationMap, EnvContext, Env } from '@teambit/envs';\nimport { Text, Newline } from 'ink';\nimport { Workspace } from '@teambit/workspace';\nimport highlight from 'cli-highlight';\nimport { Component, ComponentMap } from '@teambit/component';\nimport { Linter, LintResults } from './linter';\nimport { LinterContext, LinterOptions } from './linter-context';\nimport { LinterConfig } from './linter.main.runtime';\n\ntype LinterTransformationMap = ServiceTransformationMap & {\n getLinter: () => Linter;\n};\n\nexport class LinterService implements EnvService<LintResults> {\n name = 'linter';\n\n constructor(private linterConfig: LinterConfig, private workspace: Workspace) {}\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 = this.getLinter(context, options);\n\n const results = await linter.lint(linterContext);\n return results;\n }\n\n getLinter(context: ExecutionContext, options: LinterOptions): Linter {\n const mergedOpts = this.optionsWithDefaults(options);\n const linterContext = this.mergeContext(mergedOpts, context);\n const linter: Linter = context.env.getLinter(linterContext);\n return linter;\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 componentsDirMap = context?.components\n ? this.getComponentsDirectory(context.components)\n : ComponentMap.create<string>([]);\n const linterContext: LinterContext = Object.assign(\n {},\n {\n rootDir: this.workspace?.path,\n quiet: false,\n extensionFormats: options.extensionFormats,\n fixTypes: options.fixTypes,\n fix: options.fix,\n componentsDirMap,\n },\n context\n );\n return linterContext;\n }\n\n private getComponentsDirectory(components: Component[]): ComponentMap<string> {\n return ComponentMap.as<string>(components, (component) =>\n this.workspace.componentDir(component.id, undefined, { relative: true })\n );\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 transform(env: Env, context: EnvContext): LinterTransformationMap | undefined {\n // Old env\n if (!env?.linter) return undefined;\n return {\n getLinter: () => env.linter()(context),\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,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA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,CAAC+B,WAAW,GAAG/B,MAAM,CAAC+B,WAAW,GAAG;IACzD,CAAC;EACH;AACF;AAACU,OAAA,CAAApD,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["_react","data","_interopRequireDefault","require","_lodash","_ink","_cliHighlight","_component","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","LinterService","constructor","linterConfig","workspace","run","context","options","mergedOpts","optionsWithDefaults","linterContext","mergeContext","linter","getLinter","results","lint","env","defaults","componentsDirMap","components","getComponentsDirectory","ComponentMap","create","assign","rootDir","path","quiet","extensionFormats","fixTypes","fix","as","component","componentDir","id","undefined","relative","render","descriptor","getDescriptor","createElement","Text","color","displayName","version","Newline","config","highlight","language","ignoreIllegals","transform","icon","displayConfig","exports"],"sources":["linter.service.tsx"],"sourcesContent":["import React from 'react';\nimport { defaults } from 'lodash';\nimport { EnvService, ExecutionContext, EnvDefinition, ServiceTransformationMap, EnvContext, Env } from '@teambit/envs';\nimport { Text, Newline } from 'ink';\nimport { Workspace } from '@teambit/workspace';\nimport highlight from 'cli-highlight';\nimport { Component, ComponentMap } from '@teambit/component';\nimport { Linter, LintResults } from './linter';\nimport { LinterContext, LinterOptions } from './linter-context';\nimport { LinterConfig } from './linter.main.runtime';\n\ntype LinterTransformationMap = ServiceTransformationMap & {\n getLinter: () => Linter;\n};\n\nexport class LinterService implements EnvService<LintResults> {\n name = 'linter';\n\n constructor(private linterConfig: LinterConfig, private workspace: Workspace) {}\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 = this.getLinter(context, options);\n\n const results = await linter.lint(linterContext);\n return results;\n }\n\n getLinter(context: ExecutionContext, options: LinterOptions): Linter {\n const mergedOpts = this.optionsWithDefaults(options);\n const linterContext = this.mergeContext(mergedOpts, context);\n const linter: Linter = context.env.getLinter(linterContext);\n return linter;\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 componentsDirMap = context?.components\n ? this.getComponentsDirectory(context.components)\n : ComponentMap.create<string>([]);\n const linterContext: LinterContext = Object.assign(\n {},\n {\n rootDir: this.workspace?.path,\n quiet: false,\n extensionFormats: options.extensionFormats,\n fixTypes: options.fixTypes,\n fix: options.fix,\n componentsDirMap,\n },\n context\n );\n return linterContext;\n }\n\n private getComponentsDirectory(components: Component[]): ComponentMap<string> {\n return ComponentMap.as<string>(components, (component) =>\n this.workspace.componentDir(component.id, undefined, { relative: true })\n );\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 transform(env: Env, context: EnvContext): LinterTransformationMap | undefined {\n // Old env\n if (!env?.linter) return undefined;\n return {\n getLinter: () => env.linter()(context),\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,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,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aAAa,CAAC,CAAC,GAAGjB,SAAS;MACjES,OAAO,EAAE/B,MAAM,CAAC+B,OAAO,GAAG/B,MAAM,CAAC+B,OAAO,CAAC,CAAC,GAAG,GAAG;MAChDD,WAAW,EAAE9B,MAAM,CAAC8B,WAAW,GAAG9B,MAAM,CAAC8B,WAAW,GAAG;IACzD,CAAC;EACH;AACF;AAACU,OAAA,CAAAnD,aAAA,GAAAA,aAAA"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_linter@1.0.107/dist/linter.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_linter@1.0.107/dist/linter.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_linter@1.0.109/dist/linter.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_linter@1.0.109/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.107",
3
+ "version": "1.0.109",
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.107"
9
+ "version": "1.0.109"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -14,31 +14,27 @@
14
14
  "graphql-tag": "2.12.1",
15
15
  "cli-highlight": "2.1.9",
16
16
  "ink": "3.2.0",
17
- "core-js": "^3.0.0",
18
- "@babel/runtime": "7.20.0",
19
17
  "@teambit/harmony": "0.4.6",
20
- "@teambit/cli": "0.0.839",
21
- "@teambit/component": "1.0.107",
22
- "@teambit/envs": "1.0.107",
23
- "@teambit/workspace": "1.0.107",
24
- "@teambit/builder": "1.0.107",
25
- "@teambit/isolator": "1.0.107",
26
- "@teambit/logger": "0.0.932"
18
+ "@teambit/cli": "0.0.841",
19
+ "@teambit/component": "1.0.109",
20
+ "@teambit/envs": "1.0.109",
21
+ "@teambit/workspace": "1.0.109",
22
+ "@teambit/builder": "1.0.109",
23
+ "@teambit/isolator": "1.0.109",
24
+ "@teambit/logger": "0.0.934"
27
25
  },
28
26
  "devDependencies": {
29
27
  "@types/lodash": "4.14.165",
30
- "@types/react": "^17.0.8",
31
28
  "@types/mocha": "9.1.0",
32
- "@types/node": "12.20.4",
33
- "@types/react-dom": "^17.0.5",
34
- "@types/jest": "^26.0.0",
35
- "@types/testing-library__jest-dom": "5.9.5",
36
- "@teambit/defender.content.linter-overview": "1.95.0"
29
+ "@types/jest": "^29.2.2",
30
+ "@types/testing-library__jest-dom": "^5.9.5",
31
+ "@teambit/defender.content.linter-overview": "1.95.0",
32
+ "@teambit/harmony.envs.core-aspect-env": "0.0.14"
37
33
  },
38
34
  "peerDependencies": {
39
- "@teambit/legacy": "1.0.624",
40
- "react": "^16.8.0 || ^17.0.0",
41
- "react-dom": "^16.8.0 || ^17.0.0"
35
+ "react": "^17.0.0 || ^18.0.0",
36
+ "@types/react": "^18.2.12",
37
+ "@teambit/legacy": "1.0.624"
42
38
  },
43
39
  "license": "Apache-2.0",
44
40
  "optionalDependencies": {},
@@ -52,7 +48,7 @@
52
48
  },
53
49
  "private": false,
54
50
  "engines": {
55
- "node": ">=12.22.0"
51
+ "node": ">=16.0.0"
56
52
  },
57
53
  "repository": {
58
54
  "type": "git",
@@ -61,12 +57,9 @@
61
57
  "keywords": [
62
58
  "bit",
63
59
  "bit-aspect",
60
+ "bit-core-aspect",
64
61
  "components",
65
62
  "collaboration",
66
- "web",
67
- "react",
68
- "react-components",
69
- "angular",
70
- "angular-components"
63
+ "web"
71
64
  ]
72
65
  }
package/tsconfig.json CHANGED
@@ -1,38 +1,33 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "lib": [
4
- "es2019",
5
- "DOM",
6
- "ES6",
7
- "DOM.Iterable",
8
- "ScriptHost"
4
+ "esnext",
5
+ "dom",
6
+ "dom.Iterable"
9
7
  ],
10
- "target": "es2015",
11
- "module": "CommonJS",
12
- "jsx": "react",
13
- "allowJs": true,
14
- "composite": true,
8
+ "target": "es2020",
9
+ "module": "es2020",
10
+ "jsx": "react-jsx",
15
11
  "declaration": true,
16
12
  "sourceMap": true,
17
- "skipLibCheck": true,
18
13
  "experimentalDecorators": true,
19
- "outDir": "dist",
14
+ "skipLibCheck": true,
20
15
  "moduleResolution": "node",
21
16
  "esModuleInterop": true,
22
- "rootDir": ".",
23
17
  "resolveJsonModule": true,
24
- "emitDeclarationOnly": true,
25
- "emitDecoratorMetadata": true,
26
- "allowSyntheticDefaultImports": true,
27
- "strictPropertyInitialization": false,
28
- "strict": true,
29
- "noImplicitAny": false,
30
- "preserveConstEnums": true
18
+ "allowJs": true,
19
+ "outDir": "dist",
20
+ "emitDeclarationOnly": true
31
21
  },
32
22
  "exclude": [
23
+ "artifacts",
24
+ "public",
33
25
  "dist",
26
+ "node_modules",
27
+ "package.json",
34
28
  "esm.mjs",
35
- "package.json"
29
+ "**/*.cjs",
30
+ "./dist"
36
31
  ],
37
32
  "include": [
38
33
  "**/*",
package/types/asset.d.ts CHANGED
@@ -5,12 +5,12 @@ declare module '*.png' {
5
5
  declare module '*.svg' {
6
6
  import type { FunctionComponent, SVGProps } from 'react';
7
7
 
8
- export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
8
+ export const ReactComponent: FunctionComponent<
9
+ SVGProps<SVGSVGElement> & { title?: string }
10
+ >;
9
11
  const src: string;
10
12
  export default src;
11
13
  }
12
-
13
- // @TODO Gilad
14
14
  declare module '*.jpg' {
15
15
  const value: any;
16
16
  export = value;
@@ -27,3 +27,15 @@ declare module '*.bmp' {
27
27
  const value: any;
28
28
  export = value;
29
29
  }
30
+ declare module '*.otf' {
31
+ const value: any;
32
+ export = value;
33
+ }
34
+ declare module '*.woff' {
35
+ const value: any;
36
+ export = value;
37
+ }
38
+ declare module '*.woff2' {
39
+ const value: any;
40
+ export = value;
41
+ }