@teambit/eslint 1.0.309 → 1.0.310
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 +1 -1
- package/artifacts/preview/teambit_defender_eslint-preview.js +1 -1
- package/artifacts/schema.json +1 -1
- package/dist/eslint.linter.js +15 -4
- package/dist/eslint.linter.js.map +1 -1
- package/dist/{preview-1718767379753.js → preview-1718853656395.js} +2 -2
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<testsuites tests="0" failures="0" errors="0" skipped="0">
|
|
3
|
-
<testsuite name="teambit.defender/eslint@1.0.
|
|
3
|
+
<testsuite name="teambit.defender/eslint@1.0.310" tests="0" failures="0" errors="0" skipped="0"/>
|
|
4
4
|
</testsuites>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.defender/eslint-preview"]=t():e["teambit.defender/eslint-preview"]=t()}(self,(()=>(()=>{"use strict";var e={
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.defender/eslint-preview"]=t():e["teambit.defender/eslint-preview"]=t()}(self,(()=>(()=>{"use strict";var e={56355:(e,t,o)=>{var n={id:"teambit.defender/eslint@1.0.310",homepage:"https://bit.cloud/teambit/defender/eslint",exported:!0};function r(){const e=i(o(41594));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=n,i.__bit_component=n;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/brands/logo-eslint.svg"}));a.__bit_component=n,t.Logo=a},41594:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};o.r(n),o.d(n,{compositions:()=>u,compositions_metadata:()=>v,overview:()=>m});var r={};o.r(r),o.d(r,{default:()=>f});var i=o(56355);o(41594);const a=MdxJsReact,s=TeambitMdxUiMdxScopeContext;var d=["components"];function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)({}).hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},p.apply(null,arguments)}var c={},l="wrapper";function f(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;o[n]=e[n]}return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||{}.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,d);return(0,a.mdx)(l,p({},c,o,{components:t,mdxType:"MDXLayout"}),(0,a.mdx)(s.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}f.isMDXComponent=!0;const u=[i],m=[r],v={compositions:[{displayName:"Logo",identifier:"Logo"}]};return n})()));
|
package/artifacts/schema.json
CHANGED
package/dist/eslint.linter.js
CHANGED
|
@@ -100,7 +100,8 @@ class ESLintLinter {
|
|
|
100
100
|
totalFixableErrorCount,
|
|
101
101
|
totalFixableWarningCount,
|
|
102
102
|
totalWarningCount,
|
|
103
|
-
componentsResults
|
|
103
|
+
componentsResults,
|
|
104
|
+
isClean
|
|
104
105
|
} = this.computeComponentResultsWithTotals(results);
|
|
105
106
|
return {
|
|
106
107
|
component,
|
|
@@ -110,6 +111,7 @@ class ESLintLinter {
|
|
|
110
111
|
totalFixableErrorCount,
|
|
111
112
|
totalFixableWarningCount,
|
|
112
113
|
totalWarningCount,
|
|
114
|
+
isClean,
|
|
113
115
|
results: componentsResults
|
|
114
116
|
};
|
|
115
117
|
});
|
|
@@ -124,7 +126,8 @@ class ESLintLinter {
|
|
|
124
126
|
totalComponentsWithFatalErrorCount,
|
|
125
127
|
totalComponentsWithFixableErrorCount,
|
|
126
128
|
totalComponentsWithFixableWarningCount,
|
|
127
|
-
totalComponentsWithWarningCount
|
|
129
|
+
totalComponentsWithWarningCount,
|
|
130
|
+
isClean
|
|
128
131
|
} = this.computeManyComponentsTotals(results);
|
|
129
132
|
return {
|
|
130
133
|
totalErrorCount,
|
|
@@ -137,6 +140,7 @@ class ESLintLinter {
|
|
|
137
140
|
totalComponentsWithFixableErrorCount,
|
|
138
141
|
totalComponentsWithFixableWarningCount,
|
|
139
142
|
totalComponentsWithWarningCount,
|
|
143
|
+
isClean,
|
|
140
144
|
results,
|
|
141
145
|
errors: []
|
|
142
146
|
};
|
|
@@ -192,13 +196,15 @@ class ESLintLinter {
|
|
|
192
196
|
raw: result
|
|
193
197
|
};
|
|
194
198
|
});
|
|
199
|
+
const isClean = totalErrorCount === 0 && totalWarningCount === 0 && totalFatalErrorCount === 0;
|
|
195
200
|
return {
|
|
196
201
|
totalErrorCount,
|
|
197
202
|
totalFatalErrorCount,
|
|
198
203
|
totalFixableErrorCount,
|
|
199
204
|
totalFixableWarningCount,
|
|
200
205
|
totalWarningCount,
|
|
201
|
-
componentsResults
|
|
206
|
+
componentsResults,
|
|
207
|
+
isClean
|
|
202
208
|
};
|
|
203
209
|
}
|
|
204
210
|
computeManyComponentsTotals(componentsResults) {
|
|
@@ -212,15 +218,18 @@ class ESLintLinter {
|
|
|
212
218
|
let totalComponentsWithFixableErrorCount = 0;
|
|
213
219
|
let totalComponentsWithFixableWarningCount = 0;
|
|
214
220
|
let totalComponentsWithWarningCount = 0;
|
|
221
|
+
let isClean = true;
|
|
215
222
|
componentsResults.forEach(result => {
|
|
216
223
|
if (result.totalErrorCount) {
|
|
217
224
|
totalErrorCount += result.totalErrorCount;
|
|
218
225
|
totalComponentsWithErrorCount += 1;
|
|
226
|
+
isClean = false;
|
|
219
227
|
}
|
|
220
228
|
// @ts-ignore - missing from the @types/eslint lib
|
|
221
229
|
if (result.totalFatalErrorCount) {
|
|
222
230
|
totalFatalErrorCount += result.totalFatalErrorCount;
|
|
223
231
|
totalComponentsWithFatalErrorCount += 1;
|
|
232
|
+
isClean = false;
|
|
224
233
|
}
|
|
225
234
|
if (result.totalFixableErrorCount) {
|
|
226
235
|
totalFixableErrorCount += result.totalFixableErrorCount;
|
|
@@ -233,6 +242,7 @@ class ESLintLinter {
|
|
|
233
242
|
if (result.totalWarningCount) {
|
|
234
243
|
totalWarningCount += result.totalWarningCount;
|
|
235
244
|
totalComponentsWithWarningCount += 1;
|
|
245
|
+
isClean = false;
|
|
236
246
|
}
|
|
237
247
|
});
|
|
238
248
|
return {
|
|
@@ -246,7 +256,8 @@ class ESLintLinter {
|
|
|
246
256
|
totalComponentsWithFatalErrorCount,
|
|
247
257
|
totalComponentsWithFixableErrorCount,
|
|
248
258
|
totalComponentsWithFixableWarningCount,
|
|
249
|
-
totalComponentsWithWarningCount
|
|
259
|
+
totalComponentsWithWarningCount,
|
|
260
|
+
isClean
|
|
250
261
|
};
|
|
251
262
|
}
|
|
252
263
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_eslint","_pMapSeries","_objectHash","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ESLintLinter","constructor","logger","options","config","ESLint","displayConfig","JSON","stringify","lint","context","longProcessLogger","createLongProcessLogger","components","eslint","createEslint","tsConfig","rootDir","tsConfigPath","createTempTsConfigFile","componentsDirMap","envRuntime","id","overrideConfig","parserOptions","project","resultsP","mapSeries","component","logProgress","toString","filesystem","files","filesP","map","file","extensions","includes","extname","undefined","path","compact","Promise","all","lintResults","lintFiles","fix","ESLintLib","outputFixes","results","flatten","formatter","loadFormatter","output","format","totalErrorCount","totalFatalErrorCount","totalFixableErrorCount","totalFixableWarningCount","totalWarningCount","componentsResults","computeComponentResultsWithTotals","totalComponentsWithErrorCount","totalComponentsWithFatalErrorCount","totalComponentsWithFixableErrorCount","totalComponentsWithFixableWarningCount","totalComponentsWithWarningCount","computeManyComponentsTotals","errors","componentDirMap","envId","newTsConfig","compDirs","toArray","compDir","include","includedPath","exclude","excludedPath","cacheDir","getCacheDir","hash","objectHash","tempTsConfigPath","join","fs","existsSync","outputJSONSync","spaces","result","errorCount","fatalErrorCount","fixableErrorCount","fixableWarningCount","warningCount","filePath","messages","raw","ESLintModule","version","exports"],"sources":["eslint.linter.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport path from 'path';\nimport { flatten, compact } from 'lodash';\nimport { Linter, LinterContext, LintResults, ComponentLintResult } from '@teambit/linter';\nimport { ESLint as ESLintLib } from 'eslint';\nimport mapSeries from 'p-map-series';\nimport objectHash from 'object-hash';\nimport { ComponentMap } from '@teambit/component';\nimport { Logger } from '@teambit/logger';\nimport { ESLintOptions } from './eslint.main.runtime';\n\nexport class ESLintLinter implements Linter {\n constructor(\n private logger: Logger,\n\n private options: ESLintOptions = { config: {} },\n\n /**\n * reference to the eslint module.\n */\n private ESLint?: any\n ) {}\n\n id = 'eslint-linter';\n displayName = 'ESlint';\n\n displayConfig() {\n return JSON.stringify(this.options, null, 2);\n }\n\n async lint(context: LinterContext): Promise<LintResults> {\n const longProcessLogger = this.logger.createLongProcessLogger('linting components', context.components.length);\n const eslint = this.createEslint(this.options.config, this.ESLint);\n if (this.options.tsConfig && context.rootDir) {\n const tsConfigPath = this.createTempTsConfigFile(\n context.rootDir,\n context.componentsDirMap,\n context.envRuntime.id,\n this.options.tsConfig\n );\n if (this.options?.config?.overrideConfig?.parserOptions) {\n this.options.config.overrideConfig.parserOptions.project = tsConfigPath;\n }\n }\n const resultsP = mapSeries(context.componentsDirMap.components, async (component) => {\n longProcessLogger.logProgress(\n `component: ${component.id.toString()}, # of files: ${component.filesystem.files.length}`\n );\n const filesP = component.filesystem.files.map(async (file) => {\n // TODO: now that we moved to lint files, maybe it's not required anymore\n // The eslint api will not ignore extensions by default when using lintText, so we do it manually\n if (!this.options.extensions?.includes(file.extname)) return undefined;\n return file.path;\n });\n\n const files = compact(await Promise.all(filesP));\n const lintResults = await eslint.lintFiles(files);\n\n if (eslint && this.options.config.fix && lintResults) {\n await ESLintLib.outputFixes(lintResults);\n }\n\n const results: ESLintLib.LintResult[] = compact(flatten(lintResults));\n const formatter = await eslint.loadFormatter(this.options.formatter || 'stylish');\n const output = formatter.format(results);\n const {\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n componentsResults,\n } = this.computeComponentResultsWithTotals(results);\n\n return {\n component,\n output,\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n results: componentsResults,\n };\n });\n\n const results = (await resultsP) as any as ComponentLintResult[];\n const {\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n totalComponentsWithErrorCount,\n totalComponentsWithFatalErrorCount,\n totalComponentsWithFixableErrorCount,\n totalComponentsWithFixableWarningCount,\n totalComponentsWithWarningCount,\n } = this.computeManyComponentsTotals(results);\n\n return {\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n totalComponentsWithErrorCount,\n totalComponentsWithFatalErrorCount,\n totalComponentsWithFixableErrorCount,\n totalComponentsWithFixableWarningCount,\n totalComponentsWithWarningCount,\n results,\n errors: [],\n };\n }\n\n private createTempTsConfigFile(\n rootDir: string,\n componentDirMap: ComponentMap<string>,\n envId: string,\n tsConfig: Record<string, any>\n ): string {\n const newTsConfig = {\n ...tsConfig,\n };\n const compDirs: string[] = componentDirMap.toArray().map(([, compDir]) => compDir);\n if (tsConfig.include) {\n newTsConfig.include = flatten(\n tsConfig.include.map((includedPath) => {\n return compDirs.map((compDir) => `../../${compDir}/${includedPath}`);\n })\n );\n }\n if (tsConfig.exclude) {\n newTsConfig.exclude = flatten(\n tsConfig.exclude.map((excludedPath) => {\n return compDirs.map((compDir) => `../../${compDir}/${excludedPath}`);\n })\n );\n }\n const cacheDir = getCacheDir(rootDir);\n const hash = objectHash(newTsConfig);\n // We save the tsconfig with hash here to avoid creating unnecessary tsconfig files\n // this is very important as eslint will be able to cache the tsconfig file and will not need to create another program\n // this affects performance dramatically\n const tempTsConfigPath = path.join(cacheDir, `bit.tsconfig.eslint.${hash}.json`);\n if (!fs.existsSync(tempTsConfigPath)) {\n fs.outputJSONSync(tempTsConfigPath, newTsConfig, { spaces: 2 });\n }\n return tempTsConfigPath;\n }\n\n private computeComponentResultsWithTotals(results: ESLintLib.LintResult[]) {\n let totalErrorCount = 0;\n let totalFatalErrorCount = 0;\n let totalFixableErrorCount = 0;\n let totalFixableWarningCount = 0;\n let totalWarningCount = 0;\n const componentsResults = results.map((result) => {\n totalErrorCount += result.errorCount ?? 0;\n // @ts-ignore - missing from the @types/eslint lib\n totalFatalErrorCount += result.fatalErrorCount ?? 0;\n totalFixableErrorCount += result.fixableErrorCount ?? 0;\n totalFixableWarningCount += result.fixableWarningCount ?? 0;\n totalWarningCount += result.warningCount ?? 0;\n return {\n filePath: result.filePath,\n errorCount: result.errorCount,\n // @ts-ignore - missing from the @types/eslint lib\n fatalErrorCount: result.fatalErrorCount,\n fixableErrorCount: result.fixableErrorCount,\n fixableWarningCount: result.fixableWarningCount,\n warningCount: result.warningCount,\n messages: result.messages,\n raw: result,\n };\n });\n return {\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n componentsResults,\n };\n }\n\n private computeManyComponentsTotals(componentsResults: ComponentLintResult[]) {\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 componentsResults.forEach((result) => {\n if (result.totalErrorCount) {\n totalErrorCount += result.totalErrorCount;\n totalComponentsWithErrorCount += 1;\n }\n // @ts-ignore - missing from the @types/eslint lib\n if (result.totalFatalErrorCount) {\n totalFatalErrorCount += result.totalFatalErrorCount;\n totalComponentsWithFatalErrorCount += 1;\n }\n if (result.totalFixableErrorCount) {\n totalFixableErrorCount += result.totalFixableErrorCount;\n totalComponentsWithFixableErrorCount += 1;\n }\n if (result.totalFixableWarningCount) {\n totalFixableWarningCount += result.totalFixableWarningCount;\n totalComponentsWithFixableWarningCount += 1;\n }\n if (result.totalWarningCount) {\n totalWarningCount += result.totalWarningCount;\n totalComponentsWithWarningCount += 1;\n }\n });\n return {\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n componentsResults,\n totalComponentsWithErrorCount,\n totalComponentsWithFatalErrorCount,\n totalComponentsWithFixableErrorCount,\n totalComponentsWithFixableWarningCount,\n totalComponentsWithWarningCount,\n };\n }\n\n /**\n * Create the eslint instance by options that was already merged with context\n * @param options\n * @param ESLintModule\n * @returns\n */\n private createEslint(options: ESLintLib.Options, ESLintModule?: any): ESLintLib {\n // eslint-disable-next-line no-new\n if (ESLintModule) new ESLintModule.ESLint(options);\n return new ESLintLib(options);\n }\n\n version() {\n if (this.ESLint) return this.ESLint.version;\n return ESLintLib.version;\n }\n}\n\nfunction getCacheDir(rootDir): string {\n return path.join(rootDir, 'node_modules', '.cache');\n}\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,YAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,WAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,YAAA;EAAA,MAAAP,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAK,WAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqC,SAAAC,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,QAAAH,CAAA,EAAAI,CAAA,QAAAC,CAAA,GAAAC,MAAA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AOuB,eAAI,CAAC4C,IAAI,CAACnE,OAAO,EAAE,cAAc,EAAE,QAAQ,CAAC;AACrD","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_eslint","_pMapSeries","_objectHash","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ESLintLinter","constructor","logger","options","config","ESLint","displayConfig","JSON","stringify","lint","context","longProcessLogger","createLongProcessLogger","components","eslint","createEslint","tsConfig","rootDir","tsConfigPath","createTempTsConfigFile","componentsDirMap","envRuntime","id","overrideConfig","parserOptions","project","resultsP","mapSeries","component","logProgress","toString","filesystem","files","filesP","map","file","extensions","includes","extname","undefined","path","compact","Promise","all","lintResults","lintFiles","fix","ESLintLib","outputFixes","results","flatten","formatter","loadFormatter","output","format","totalErrorCount","totalFatalErrorCount","totalFixableErrorCount","totalFixableWarningCount","totalWarningCount","componentsResults","isClean","computeComponentResultsWithTotals","totalComponentsWithErrorCount","totalComponentsWithFatalErrorCount","totalComponentsWithFixableErrorCount","totalComponentsWithFixableWarningCount","totalComponentsWithWarningCount","computeManyComponentsTotals","errors","componentDirMap","envId","newTsConfig","compDirs","toArray","compDir","include","includedPath","exclude","excludedPath","cacheDir","getCacheDir","hash","objectHash","tempTsConfigPath","join","fs","existsSync","outputJSONSync","spaces","result","errorCount","fatalErrorCount","fixableErrorCount","fixableWarningCount","warningCount","filePath","messages","raw","ESLintModule","version","exports"],"sources":["eslint.linter.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport path from 'path';\nimport { flatten, compact } from 'lodash';\nimport { Linter, LinterContext, LintResults, ComponentLintResult } from '@teambit/linter';\nimport { ESLint as ESLintLib } from 'eslint';\nimport mapSeries from 'p-map-series';\nimport objectHash from 'object-hash';\nimport { ComponentMap } from '@teambit/component';\nimport { Logger } from '@teambit/logger';\nimport { ESLintOptions } from './eslint.main.runtime';\n\nexport class ESLintLinter implements Linter {\n constructor(\n private logger: Logger,\n\n private options: ESLintOptions = { config: {} },\n\n /**\n * reference to the eslint module.\n */\n private ESLint?: any\n ) {}\n\n id = 'eslint-linter';\n displayName = 'ESlint';\n\n displayConfig() {\n return JSON.stringify(this.options, null, 2);\n }\n\n async lint(context: LinterContext): Promise<LintResults> {\n const longProcessLogger = this.logger.createLongProcessLogger('linting components', context.components.length);\n const eslint = this.createEslint(this.options.config, this.ESLint);\n if (this.options.tsConfig && context.rootDir) {\n const tsConfigPath = this.createTempTsConfigFile(\n context.rootDir,\n context.componentsDirMap,\n context.envRuntime.id,\n this.options.tsConfig\n );\n if (this.options?.config?.overrideConfig?.parserOptions) {\n this.options.config.overrideConfig.parserOptions.project = tsConfigPath;\n }\n }\n const resultsP = mapSeries(context.componentsDirMap.components, async (component) => {\n longProcessLogger.logProgress(\n `component: ${component.id.toString()}, # of files: ${component.filesystem.files.length}`\n );\n const filesP = component.filesystem.files.map(async (file) => {\n // TODO: now that we moved to lint files, maybe it's not required anymore\n // The eslint api will not ignore extensions by default when using lintText, so we do it manually\n if (!this.options.extensions?.includes(file.extname)) return undefined;\n return file.path;\n });\n\n const files = compact(await Promise.all(filesP));\n const lintResults = await eslint.lintFiles(files);\n\n if (eslint && this.options.config.fix && lintResults) {\n await ESLintLib.outputFixes(lintResults);\n }\n\n const results: ESLintLib.LintResult[] = compact(flatten(lintResults));\n const formatter = await eslint.loadFormatter(this.options.formatter || 'stylish');\n const output = formatter.format(results);\n const {\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n componentsResults,\n isClean,\n } = this.computeComponentResultsWithTotals(results);\n\n return {\n component,\n output,\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n isClean,\n results: componentsResults,\n };\n });\n\n const results = (await resultsP) as any as ComponentLintResult[];\n const {\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n totalComponentsWithErrorCount,\n totalComponentsWithFatalErrorCount,\n totalComponentsWithFixableErrorCount,\n totalComponentsWithFixableWarningCount,\n totalComponentsWithWarningCount,\n isClean,\n } = this.computeManyComponentsTotals(results);\n\n return {\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n totalComponentsWithErrorCount,\n totalComponentsWithFatalErrorCount,\n totalComponentsWithFixableErrorCount,\n totalComponentsWithFixableWarningCount,\n totalComponentsWithWarningCount,\n isClean,\n results,\n errors: [],\n };\n }\n\n private createTempTsConfigFile(\n rootDir: string,\n componentDirMap: ComponentMap<string>,\n envId: string,\n tsConfig: Record<string, any>\n ): string {\n const newTsConfig = {\n ...tsConfig,\n };\n const compDirs: string[] = componentDirMap.toArray().map(([, compDir]) => compDir);\n if (tsConfig.include) {\n newTsConfig.include = flatten(\n tsConfig.include.map((includedPath) => {\n return compDirs.map((compDir) => `../../${compDir}/${includedPath}`);\n })\n );\n }\n if (tsConfig.exclude) {\n newTsConfig.exclude = flatten(\n tsConfig.exclude.map((excludedPath) => {\n return compDirs.map((compDir) => `../../${compDir}/${excludedPath}`);\n })\n );\n }\n const cacheDir = getCacheDir(rootDir);\n const hash = objectHash(newTsConfig);\n // We save the tsconfig with hash here to avoid creating unnecessary tsconfig files\n // this is very important as eslint will be able to cache the tsconfig file and will not need to create another program\n // this affects performance dramatically\n const tempTsConfigPath = path.join(cacheDir, `bit.tsconfig.eslint.${hash}.json`);\n if (!fs.existsSync(tempTsConfigPath)) {\n fs.outputJSONSync(tempTsConfigPath, newTsConfig, { spaces: 2 });\n }\n return tempTsConfigPath;\n }\n\n private computeComponentResultsWithTotals(results: ESLintLib.LintResult[]) {\n let totalErrorCount = 0;\n let totalFatalErrorCount = 0;\n let totalFixableErrorCount = 0;\n let totalFixableWarningCount = 0;\n let totalWarningCount = 0;\n const componentsResults = results.map((result) => {\n totalErrorCount += result.errorCount ?? 0;\n // @ts-ignore - missing from the @types/eslint lib\n totalFatalErrorCount += result.fatalErrorCount ?? 0;\n totalFixableErrorCount += result.fixableErrorCount ?? 0;\n totalFixableWarningCount += result.fixableWarningCount ?? 0;\n totalWarningCount += result.warningCount ?? 0;\n return {\n filePath: result.filePath,\n errorCount: result.errorCount,\n // @ts-ignore - missing from the @types/eslint lib\n fatalErrorCount: result.fatalErrorCount,\n fixableErrorCount: result.fixableErrorCount,\n fixableWarningCount: result.fixableWarningCount,\n warningCount: result.warningCount,\n messages: result.messages,\n raw: result,\n };\n });\n const isClean = totalErrorCount === 0 && totalWarningCount === 0 && totalFatalErrorCount === 0;\n\n return {\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n componentsResults,\n isClean,\n };\n }\n\n private computeManyComponentsTotals(componentsResults: ComponentLintResult[]) {\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 let isClean = true;\n\n componentsResults.forEach((result) => {\n if (result.totalErrorCount) {\n totalErrorCount += result.totalErrorCount;\n totalComponentsWithErrorCount += 1;\n isClean = false;\n }\n // @ts-ignore - missing from the @types/eslint lib\n if (result.totalFatalErrorCount) {\n totalFatalErrorCount += result.totalFatalErrorCount;\n totalComponentsWithFatalErrorCount += 1;\n isClean = false;\n }\n if (result.totalFixableErrorCount) {\n totalFixableErrorCount += result.totalFixableErrorCount;\n totalComponentsWithFixableErrorCount += 1;\n }\n if (result.totalFixableWarningCount) {\n totalFixableWarningCount += result.totalFixableWarningCount;\n totalComponentsWithFixableWarningCount += 1;\n }\n if (result.totalWarningCount) {\n totalWarningCount += result.totalWarningCount;\n totalComponentsWithWarningCount += 1;\n isClean = false;\n }\n });\n return {\n totalErrorCount,\n totalFatalErrorCount,\n totalFixableErrorCount,\n totalFixableWarningCount,\n totalWarningCount,\n componentsResults,\n totalComponentsWithErrorCount,\n totalComponentsWithFatalErrorCount,\n totalComponentsWithFixableErrorCount,\n totalComponentsWithFixableWarningCount,\n totalComponentsWithWarningCount,\n isClean,\n };\n }\n\n /**\n * Create the eslint instance by options that was already merged with context\n * @param options\n * @param ESLintModule\n * @returns\n */\n private createEslint(options: ESLintLib.Options, ESLintModule?: any): ESLintLib {\n // eslint-disable-next-line no-new\n if (ESLintModule) new ESLintModule.ESLint(options);\n return new ESLintLib(options);\n }\n\n version() {\n if (this.ESLint) return this.ESLint.version;\n return ESLintLib.version;\n }\n}\n\nfunction getCacheDir(rootDir): string {\n return path.join(rootDir, 'node_modules', '.cache');\n}\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,YAAA;EAAA,MAAAN,I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B,IAAI,CAAC;QACpCN,OAAO,GAAG,KAAK;MACjB;IACF,CAAC,CAAC;IACF,OAAO;MACLN,eAAe;MACfC,oBAAoB;MACpBC,sBAAsB;MACtBC,wBAAwB;MACxBC,iBAAiB;MACjBC,iBAAiB;MACjBG,6BAA6B;MAC7BC,kCAAkC;MAClCC,oCAAoC;MACpCC,sCAAsC;MACtCC,+BAA+B;MAC/BN;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;EACU9C,YAAYA,CAACZ,OAA0B,EAAEgG,YAAkB,EAAa;IAC9E;IACA,IAAIA,YAAY,EAAE,IAAIA,YAAY,CAAC9F,MAAM,CAACF,OAAO,CAAC;IAClD,OAAO,KAAI4C,gBAAS,EAAC5C,OAAO,CAAC;EAC/B;EAEAiG,OAAOA,CAAA,EAAG;IACR,IAAI,IAAI,CAAC/F,MAAM,EAAE,OAAO,IAAI,CAACA,MAAM,CAAC+F,OAAO;IAC3C,OAAOrD,gBAAS,CAACqD,OAAO;EAC1B;AACF;AAACC,OAAA,CAAArG,YAAA,GAAAA,YAAA;AAED,SAASiF,WAAWA,CAAChE,OAAO,EAAU;EACpC,OAAOuB,eAAI,CAAC6C,IAAI,CAACpE,OAAO,EAAE,cAAc,EAAE,QAAQ,CAAC;AACrD","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.defender_eslint@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.defender_eslint@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.defender_eslint@1.0.310/dist/eslint.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.defender_eslint@1.0.310/dist/eslint.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/eslint",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.310",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/defender/eslint",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.defender",
|
|
8
8
|
"name": "eslint",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.310"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"eslint": "8.56.0",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"p-map-series": "2.1.0",
|
|
17
17
|
"@babel/runtime": "7.23.2",
|
|
18
18
|
"@teambit/harmony": "0.4.6",
|
|
19
|
-
"@teambit/component": "1.0.
|
|
20
|
-
"@teambit/linter": "1.0.
|
|
21
|
-
"@teambit/logger": "0.0.
|
|
22
|
-
"@teambit/cli": "0.0.
|
|
19
|
+
"@teambit/component": "1.0.310",
|
|
20
|
+
"@teambit/linter": "1.0.310",
|
|
21
|
+
"@teambit/logger": "0.0.980",
|
|
22
|
+
"@teambit/cli": "0.0.887",
|
|
23
23
|
"@teambit/defender.eslint.config-mutator": "0.0.101",
|
|
24
|
-
"@teambit/workspace-config-files": "1.0.
|
|
24
|
+
"@teambit/workspace-config-files": "1.0.310"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/eslint": "8.56.6",
|