@teambit/eslint 1.0.207 → 1.0.209
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 +16 -16
- package/dist/eslint.linter.js +1 -1
- package/dist/eslint.linter.js.map +1 -1
- package/dist/eslint.main.runtime.js +2 -0
- package/dist/eslint.main.runtime.js.map +1 -1
- package/dist/{preview-1711336720858.js → preview-1711509617758.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.209" 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={47935:(e,t,o)=>{var r={id:"teambit.defender/eslint@1.0.209",homepage:"https://bit.cloud/teambit/defender/eslint",exported:!0};function n(){const e=i(o(41594));return n=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,n.__bit_component=r,i.__bit_component=r;const p=()=>n().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},n().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/brands/logo-eslint.svg"}));p.__bit_component=r,t.Logo=p},41594:e=>{e.exports=React}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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 r={};return(()=>{o.r(r),o.d(r,{compositions:()=>l,compositions_metadata:()=>u,overview:()=>f});var e={};o.r(e),o.d(e,{default:()=>c});var t=o(47935);o(41594);const n=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var p=["components"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},s.apply(this,arguments)}var a={},d="wrapper";function c(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,r,n=function(e,t){if(null==e)return{};var o,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(e,p);return(0,n.mdx)(d,s({},a,o,{components:t,mdxType:"MDXLayout"}),(0,n.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}c.isMDXComponent=!0;const l=[t],f=[e],u={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),r})()));
|
package/artifacts/schema.json
CHANGED
|
@@ -666,7 +666,7 @@
|
|
|
666
666
|
"componentId": {
|
|
667
667
|
"scope": "teambit.defender",
|
|
668
668
|
"name": "eslint/config-mutator",
|
|
669
|
-
"version": "0.0.
|
|
669
|
+
"version": "0.0.100"
|
|
670
670
|
}
|
|
671
671
|
},
|
|
672
672
|
"isOptional": false,
|
|
@@ -704,7 +704,7 @@
|
|
|
704
704
|
"componentId": {
|
|
705
705
|
"scope": "teambit.defender",
|
|
706
706
|
"name": "eslint/config-mutator",
|
|
707
|
-
"version": "0.0.
|
|
707
|
+
"version": "0.0.100"
|
|
708
708
|
}
|
|
709
709
|
},
|
|
710
710
|
"modifiers": []
|
|
@@ -1045,7 +1045,7 @@
|
|
|
1045
1045
|
"componentId": {
|
|
1046
1046
|
"scope": "teambit.defender",
|
|
1047
1047
|
"name": "eslint/config-mutator",
|
|
1048
|
-
"version": "0.0.
|
|
1048
|
+
"version": "0.0.100"
|
|
1049
1049
|
}
|
|
1050
1050
|
},
|
|
1051
1051
|
"isOptional": false,
|
|
@@ -1083,7 +1083,7 @@
|
|
|
1083
1083
|
"componentId": {
|
|
1084
1084
|
"scope": "teambit.defender",
|
|
1085
1085
|
"name": "eslint/config-mutator",
|
|
1086
|
-
"version": "0.0.
|
|
1086
|
+
"version": "0.0.100"
|
|
1087
1087
|
}
|
|
1088
1088
|
},
|
|
1089
1089
|
"modifiers": []
|
|
@@ -1444,7 +1444,7 @@
|
|
|
1444
1444
|
"__schema": "FunctionLikeSchema",
|
|
1445
1445
|
"location": {
|
|
1446
1446
|
"filePath": "eslint.main.runtime.ts",
|
|
1447
|
-
"line":
|
|
1447
|
+
"line": 104,
|
|
1448
1448
|
"character": 1
|
|
1449
1449
|
},
|
|
1450
1450
|
"signature": "function runTransformersWithContext(config: EslintConfigMutator, transformers: EslintConfigTransformer[] | undefined, context: EslintConfigTransformContext): EslintConfigMutator",
|
|
@@ -1454,7 +1454,7 @@
|
|
|
1454
1454
|
"__schema": "ParameterSchema",
|
|
1455
1455
|
"location": {
|
|
1456
1456
|
"filePath": "eslint.main.runtime.ts",
|
|
1457
|
-
"line":
|
|
1457
|
+
"line": 105,
|
|
1458
1458
|
"character": 3
|
|
1459
1459
|
},
|
|
1460
1460
|
"name": "config",
|
|
@@ -1462,14 +1462,14 @@
|
|
|
1462
1462
|
"__schema": "TypeRefSchema",
|
|
1463
1463
|
"location": {
|
|
1464
1464
|
"filePath": "eslint.main.runtime.ts",
|
|
1465
|
-
"line":
|
|
1465
|
+
"line": 105,
|
|
1466
1466
|
"character": 11
|
|
1467
1467
|
},
|
|
1468
1468
|
"name": "EslintConfigMutator",
|
|
1469
1469
|
"componentId": {
|
|
1470
1470
|
"scope": "teambit.defender",
|
|
1471
1471
|
"name": "eslint/config-mutator",
|
|
1472
|
-
"version": "0.0.
|
|
1472
|
+
"version": "0.0.100"
|
|
1473
1473
|
}
|
|
1474
1474
|
},
|
|
1475
1475
|
"isOptional": false,
|
|
@@ -1479,7 +1479,7 @@
|
|
|
1479
1479
|
"__schema": "ParameterSchema",
|
|
1480
1480
|
"location": {
|
|
1481
1481
|
"filePath": "eslint.main.runtime.ts",
|
|
1482
|
-
"line":
|
|
1482
|
+
"line": 106,
|
|
1483
1483
|
"character": 3
|
|
1484
1484
|
},
|
|
1485
1485
|
"name": "transformers",
|
|
@@ -1487,14 +1487,14 @@
|
|
|
1487
1487
|
"__schema": "TypeArraySchema",
|
|
1488
1488
|
"location": {
|
|
1489
1489
|
"filePath": "eslint.main.runtime.ts",
|
|
1490
|
-
"line":
|
|
1490
|
+
"line": 106,
|
|
1491
1491
|
"character": 17
|
|
1492
1492
|
},
|
|
1493
1493
|
"type": {
|
|
1494
1494
|
"__schema": "TypeRefSchema",
|
|
1495
1495
|
"location": {
|
|
1496
1496
|
"filePath": "eslint.main.runtime.ts",
|
|
1497
|
-
"line":
|
|
1497
|
+
"line": 106,
|
|
1498
1498
|
"character": 17
|
|
1499
1499
|
},
|
|
1500
1500
|
"name": "EslintConfigTransformer"
|
|
@@ -1508,7 +1508,7 @@
|
|
|
1508
1508
|
"__schema": "ParameterSchema",
|
|
1509
1509
|
"location": {
|
|
1510
1510
|
"filePath": "eslint.main.runtime.ts",
|
|
1511
|
-
"line":
|
|
1511
|
+
"line": 107,
|
|
1512
1512
|
"character": 3
|
|
1513
1513
|
},
|
|
1514
1514
|
"name": "context",
|
|
@@ -1516,7 +1516,7 @@
|
|
|
1516
1516
|
"__schema": "TypeRefSchema",
|
|
1517
1517
|
"location": {
|
|
1518
1518
|
"filePath": "eslint.main.runtime.ts",
|
|
1519
|
-
"line":
|
|
1519
|
+
"line": 107,
|
|
1520
1520
|
"character": 12
|
|
1521
1521
|
},
|
|
1522
1522
|
"name": "EslintConfigTransformContext"
|
|
@@ -1529,14 +1529,14 @@
|
|
|
1529
1529
|
"__schema": "TypeRefSchema",
|
|
1530
1530
|
"location": {
|
|
1531
1531
|
"filePath": "eslint.main.runtime.ts",
|
|
1532
|
-
"line":
|
|
1532
|
+
"line": 104,
|
|
1533
1533
|
"character": 1
|
|
1534
1534
|
},
|
|
1535
1535
|
"name": "EslintConfigMutator",
|
|
1536
1536
|
"componentId": {
|
|
1537
1537
|
"scope": "teambit.defender",
|
|
1538
1538
|
"name": "eslint/config-mutator",
|
|
1539
|
-
"version": "0.0.
|
|
1539
|
+
"version": "0.0.100"
|
|
1540
1540
|
}
|
|
1541
1541
|
},
|
|
1542
1542
|
"modifiers": [
|
|
@@ -1637,7 +1637,7 @@
|
|
|
1637
1637
|
"componentId": {
|
|
1638
1638
|
"scope": "teambit.defender",
|
|
1639
1639
|
"name": "eslint",
|
|
1640
|
-
"version": "1.0.
|
|
1640
|
+
"version": "1.0.209"
|
|
1641
1641
|
},
|
|
1642
1642
|
"taggedModuleExports": []
|
|
1643
1643
|
}
|
package/dist/eslint.linter.js
CHANGED
|
@@ -76,7 +76,7 @@ class ESLintLinter {
|
|
|
76
76
|
this.options.config.overrideConfig.parserOptions.project = tsConfigPath;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
const resultsP = (0, _pMapSeries().default)(context.components, async component => {
|
|
79
|
+
const resultsP = (0, _pMapSeries().default)(context.componentsDirMap.components, async component => {
|
|
80
80
|
longProcessLogger.logProgress(`component: ${component.id.toString()}, # of files: ${component.filesystem.files.length}`);
|
|
81
81
|
const filesP = component.filesystem.files.map(async file => {
|
|
82
82
|
// TODO: now that we moved to lint files, maybe it's not required anymore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_eslint","_pMapSeries","_objectHash","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","ESLintLinter","constructor","logger","options","ESLint","displayConfig","JSON","stringify","lint","context","longProcessLogger","createLongProcessLogger","components","eslint","createEslint","config","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,\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.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;EA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9E;IACA,IAAIA,YAAY,EAAE,IAAIA,YAAY,CAAC9F,MAAM,CAACD,OAAO,CAAC;IAClD,OAAO,KAAI4C,gBAAS,EAAC5C,OAAO,CAAC;EAC/B;EAEAgG,OAAOA,CAAA,EAAG;IACR,IAAI,IAAI,CAAC/F,MAAM,EAAE,OAAO,IAAI,CAACA,MAAM,CAAC+F,OAAO;IAC3C,OAAOpD,gBAAS,CAACoD,OAAO;EAC1B;AACF;AAACC,OAAA,CAAApG,YAAA,GAAAA,YAAA;AAED,SAASgF,WAAWA,CAAC/D,OAAO,EAAU;EACpC,OAAOuB,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","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","ESLintLinter","constructor","logger","options","ESLint","displayConfig","JSON","stringify","lint","context","longProcessLogger","createLongProcessLogger","components","eslint","createEslint","config","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,\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,YAAA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;IACF,OAAO;MACLX,eAAe;MACfC,oBAAoB;MACpBC,sBAAsB;MACtBC,wBAAwB;MACxBC,iBAAiB;MACjBC,iBAAiB;MACjBE,6BAA6B;MAC7BC,kCAAkC;MAClCC,oCAAoC;MACpCC,sCAAsC;MACtCC;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;EACUpD,YAAYA,CAACX,OAA0B,EAAE+F,YAAkB,EAAa;IAC9E;IACA,IAAIA,YAAY,EAAE,IAAIA,YAAY,CAAC9F,MAAM,CAACD,OAAO,CAAC;IAClD,OAAO,KAAI4C,gBAAS,EAAC5C,OAAO,CAAC;EAC/B;EAEAgG,OAAOA,CAAA,EAAG;IACR,IAAI,IAAI,CAAC/F,MAAM,EAAE,OAAO,IAAI,CAACA,MAAM,CAAC+F,OAAO;IAC3C,OAAOpD,gBAAS,CAACoD,OAAO;EAC1B;AACF;AAACC,OAAA,CAAApG,YAAA,GAAAA,YAAA;AAED,SAASgF,WAAWA,CAAC/D,OAAO,EAAU;EACpC,OAAOuB,eAAI,CAAC4C,IAAI,CAACnE,OAAO,EAAE,cAAc,EAAE,QAAQ,CAAC;AACrD","ignoreList":[]}
|
|
@@ -81,6 +81,8 @@ function getOptions(options, context) {
|
|
|
81
81
|
overrideConfig: options.config,
|
|
82
82
|
extensions: context.extensionFormats,
|
|
83
83
|
useEslintrc: false,
|
|
84
|
+
// TODO: this should be probably be replaced with resolve-plugins-relative-to
|
|
85
|
+
// https://eslint.org/docs/latest/use/command-line-interface#--resolve-plugins-relative-to
|
|
84
86
|
cwd: options.pluginPath,
|
|
85
87
|
fix: !!context.fix,
|
|
86
88
|
fixTypes: context.fixTypes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_logger","_defenderEslint","_eslint","_eslint2","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","ESLintMain","constructor","logger","createLinter","context","options","transformers","ESLintModule","mergedOptions","getOptions","configMutator","EslintConfigMutator","transformerContext","fix","afterMutation","runTransformersWithContext","clone","ESLintLinter","raw","provider","loggerExt","createLogger","ESLintAspect","id","exports","MainRuntime","LoggerAspect","addRuntime","mergedConfig","overrideConfig","config","extensions","extensionFormats","useEslintrc","cwd","pluginPath","fixTypes","assign","Array","isArray","newConfig","reduce","acc","transformer"],"sources":["eslint.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\n// import { Linter as ESLinter, ESLint as ESLintLib } from 'eslint';\nimport { ESLint as ESLintLib } from 'eslint';\nimport { Linter, LinterContext, LinterMain } from '@teambit/linter';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { EslintConfigMutator } from '@teambit/defender.eslint.config-mutator';\nimport { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files';\nimport { ESLintAspect } from './eslint.aspect';\nimport { ESLintLinter } from './eslint.linter';\n\nexport type ESLintOptions = {\n /**\n * linter config for eslint.\n */\n // config: ESLinter.Config;\n config: ESLintLib.Options;\n\n /**\n * specify to path to resolve eslint plugins from.\n */\n pluginPath?: string;\n\n /**\n * decide the formatter for the CLI output.\n */\n formatter?: string;\n\n /**\n * file types to lint.\n */\n extensions?: string[];\n\n // TODO: improve type\n /**\n * typescript config for eslint.\n * If you pass this, bit will auto generate a temp config file in `node_modules/.cache` and pass it to eslint.\n * In case you have include/exclude props in the tsconfig, they will be changed to handle the fact that they are inside the node_modules/.cache folder.\n * a `../../` will be added to the beginning of the path.\n */\n tsConfig?: Record<string, any>;\n};\n\nexport type EslintConfigTransformContext = {\n fix: boolean;\n};\n\nexport type EslintConfigTransformer = (\n config: EslintConfigMutator,\n context: EslintConfigTransformContext\n) => EslintConfigMutator;\n\nexport class ESLintMain {\n constructor(private logger: Logger) {}\n\n /**\n * create a eslint linter instance.\n * @param options eslint options.\n * @param ESLintModule reference to an `eslint` module.\n */\n createLinter(\n context: LinterContext,\n options: ESLintOptions,\n transformers: EslintConfigTransformer[] = [],\n ESLintModule?: any\n ): Linter {\n const mergedOptions = getOptions(options, context);\n const configMutator = new EslintConfigMutator(mergedOptions);\n const transformerContext: EslintConfigTransformContext = { fix: !!context.fix };\n const afterMutation = runTransformersWithContext(configMutator.clone(), transformers, transformerContext);\n\n return new ESLintLinter(this.logger, afterMutation.raw, ESLintModule);\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [LoggerAspect];\n\n static async provider([loggerExt]: [LoggerMain, WorkspaceConfigFilesMain, LinterMain]): Promise<ESLintMain> {\n const logger = loggerExt.createLogger(ESLintAspect.id);\n return new ESLintMain(logger);\n }\n}\n\nESLintAspect.addRuntime(ESLintMain);\n\n/**\n * get options for eslint.\n */\nfunction getOptions(options: ESLintOptions, context: LinterContext): ESLintOptions {\n const mergedConfig: ESLintLib.Options = {\n // @ts-ignore - this is a bug in the @types/eslint types\n overrideConfig: options.config,\n extensions: context.extensionFormats,\n useEslintrc: false,\n cwd: options.pluginPath,\n fix: !!context.fix,\n fixTypes: context.fixTypes,\n };\n return Object.assign({}, options, { config: mergedConfig, extensions: context.extensionFormats });\n}\n\nexport function runTransformersWithContext(\n config: EslintConfigMutator,\n transformers: EslintConfigTransformer[] = [],\n context: EslintConfigTransformContext\n): EslintConfigMutator {\n if (!Array.isArray(transformers)) return config;\n const newConfig = transformers.reduce((acc, transformer) => {\n return transformer(acc, context);\n }, config);\n return newConfig;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,gBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,eAAA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YAAuC,GAAG,EAAE,EAC5CC,YAAkB,EACV;IACR,MAAMC,aAAa,GAAGC,UAAU,CAACJ,OAAO,EAAED,OAAO,CAAC;IAClD,MAAMM,aAAa,GAAG,KAAIC,qCAAmB,EAACH,aAAa,CAAC;IAC5D,MAAMI,kBAAgD,GAAG;MAAEC,GAAG,EAAE,CAAC,CAACT,OAAO,CAACS;IAAI,CAAC;IAC/E,MAAMC,aAAa,GAAGC,0BAA0B,CAACL,aAAa,CAACM,KAAK,CAAC,CAAC,EAAEV,YAAY,EAAEM,kBAAkB,CAAC;IAEzG,OAAO,KAAIK,uBAAY,EAAC,IAAI,CAACf,MAAM,EAAEY,aAAa,CAACI,GAAG,EAAEX,YAAY,CAAC;EACvE;EAMA,aAAaY,QAAQA,CAAC,CAACC,SAAS,CAAqD,EAAuB;IAC1G,MAAMlB,MAAM,GAAGkB,SAAS,CAACC,YAAY,CAACC,sBAAY,CAACC,EAAE,CAAC;IACtD,OAAO,IAAIvB,UAAU,CAACE,MAAM,CAAC;EAC/B;AACF;AAACsB,OAAA,CAAAxB,UAAA,GAAAA,UAAA;AAAArB,eAAA,CA9BYqB,UAAU,aAsBJyB,kBAAW;AAAA9C,eAAA,CAtBjBqB,UAAU,kBAwBC,CAAC0B,sBAAY,CAAC;AAQtCJ,sBAAY,CAACK,UAAU,CAAC3B,UAAU,CAAC;;AAEnC;AACA;AACA;AACA,SAASS,UAAUA,CAACJ,OAAsB,EAAED,OAAsB,EAAiB;EACjF,MAAMwB,YAA+B,GAAG;IACtC;IACAC,cAAc,EAAExB,OAAO,CAACyB,MAAM;IAC9BC,UAAU,EAAE3B,OAAO,CAAC4B,gBAAgB;IACpCC,WAAW,EAAE,KAAK;
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_logger","_defenderEslint","_eslint","_eslint2","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","ESLintMain","constructor","logger","createLinter","context","options","transformers","ESLintModule","mergedOptions","getOptions","configMutator","EslintConfigMutator","transformerContext","fix","afterMutation","runTransformersWithContext","clone","ESLintLinter","raw","provider","loggerExt","createLogger","ESLintAspect","id","exports","MainRuntime","LoggerAspect","addRuntime","mergedConfig","overrideConfig","config","extensions","extensionFormats","useEslintrc","cwd","pluginPath","fixTypes","assign","Array","isArray","newConfig","reduce","acc","transformer"],"sources":["eslint.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\n// import { Linter as ESLinter, ESLint as ESLintLib } from 'eslint';\nimport { ESLint as ESLintLib } from 'eslint';\nimport { Linter, LinterContext, LinterMain } from '@teambit/linter';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { EslintConfigMutator } from '@teambit/defender.eslint.config-mutator';\nimport { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files';\nimport { ESLintAspect } from './eslint.aspect';\nimport { ESLintLinter } from './eslint.linter';\n\nexport type ESLintOptions = {\n /**\n * linter config for eslint.\n */\n // config: ESLinter.Config;\n config: ESLintLib.Options;\n\n /**\n * specify to path to resolve eslint plugins from.\n */\n pluginPath?: string;\n\n /**\n * decide the formatter for the CLI output.\n */\n formatter?: string;\n\n /**\n * file types to lint.\n */\n extensions?: string[];\n\n // TODO: improve type\n /**\n * typescript config for eslint.\n * If you pass this, bit will auto generate a temp config file in `node_modules/.cache` and pass it to eslint.\n * In case you have include/exclude props in the tsconfig, they will be changed to handle the fact that they are inside the node_modules/.cache folder.\n * a `../../` will be added to the beginning of the path.\n */\n tsConfig?: Record<string, any>;\n};\n\nexport type EslintConfigTransformContext = {\n fix: boolean;\n};\n\nexport type EslintConfigTransformer = (\n config: EslintConfigMutator,\n context: EslintConfigTransformContext\n) => EslintConfigMutator;\n\nexport class ESLintMain {\n constructor(private logger: Logger) {}\n\n /**\n * create a eslint linter instance.\n * @param options eslint options.\n * @param ESLintModule reference to an `eslint` module.\n */\n createLinter(\n context: LinterContext,\n options: ESLintOptions,\n transformers: EslintConfigTransformer[] = [],\n ESLintModule?: any\n ): Linter {\n const mergedOptions = getOptions(options, context);\n const configMutator = new EslintConfigMutator(mergedOptions);\n const transformerContext: EslintConfigTransformContext = { fix: !!context.fix };\n const afterMutation = runTransformersWithContext(configMutator.clone(), transformers, transformerContext);\n\n return new ESLintLinter(this.logger, afterMutation.raw, ESLintModule);\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [LoggerAspect];\n\n static async provider([loggerExt]: [LoggerMain, WorkspaceConfigFilesMain, LinterMain]): Promise<ESLintMain> {\n const logger = loggerExt.createLogger(ESLintAspect.id);\n return new ESLintMain(logger);\n }\n}\n\nESLintAspect.addRuntime(ESLintMain);\n\n/**\n * get options for eslint.\n */\nfunction getOptions(options: ESLintOptions, context: LinterContext): ESLintOptions {\n const mergedConfig: ESLintLib.Options = {\n // @ts-ignore - this is a bug in the @types/eslint types\n overrideConfig: options.config,\n extensions: context.extensionFormats,\n useEslintrc: false,\n // TODO: this should be probably be replaced with resolve-plugins-relative-to\n // https://eslint.org/docs/latest/use/command-line-interface#--resolve-plugins-relative-to\n cwd: options.pluginPath,\n fix: !!context.fix,\n fixTypes: context.fixTypes,\n };\n return Object.assign({}, options, { config: mergedConfig, extensions: context.extensionFormats });\n}\n\nexport function runTransformersWithContext(\n config: EslintConfigMutator,\n transformers: EslintConfigTransformer[] = [],\n context: EslintConfigTransformContext\n): EslintConfigMutator {\n if (!Array.isArray(transformers)) return config;\n const newConfig = transformers.reduce((acc, transformer) => {\n return transformer(acc, context);\n }, config);\n return newConfig;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,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S,GAAG;IAClBuB,QAAQ,EAAEhC,OAAO,CAACgC;EACpB,CAAC;EACD,OAAOpD,MAAM,CAACqD,MAAM,CAAC,CAAC,CAAC,EAAEhC,OAAO,EAAE;IAAEyB,MAAM,EAAEF,YAAY;IAAEG,UAAU,EAAE3B,OAAO,CAAC4B;EAAiB,CAAC,CAAC;AACnG;AAEO,SAASjB,0BAA0BA,CACxCe,MAA2B,EAC3BxB,YAAuC,GAAG,EAAE,EAC5CF,OAAqC,EAChB;EACrB,IAAI,CAACkC,KAAK,CAACC,OAAO,CAACjC,YAAY,CAAC,EAAE,OAAOwB,MAAM;EAC/C,MAAMU,SAAS,GAAGlC,YAAY,CAACmC,MAAM,CAAC,CAACC,GAAG,EAAEC,WAAW,KAAK;IAC1D,OAAOA,WAAW,CAACD,GAAG,EAAEtC,OAAO,CAAC;EAClC,CAAC,EAAE0B,MAAM,CAAC;EACV,OAAOU,SAAS;AAClB","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_eslint@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_eslint@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_eslint@1.0.209/dist/eslint.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_eslint@1.0.209/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.209",
|
|
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.209"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"eslint": "8.56.0",
|
|
@@ -16,15 +16,15 @@
|
|
|
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.
|
|
19
|
+
"@teambit/component": "1.0.209",
|
|
20
|
+
"@teambit/linter": "1.0.209",
|
|
21
21
|
"@teambit/logger": "0.0.951",
|
|
22
22
|
"@teambit/cli": "0.0.858",
|
|
23
|
-
"@teambit/defender.eslint.config-mutator": "0.0.
|
|
24
|
-
"@teambit/workspace-config-files": "1.0.
|
|
23
|
+
"@teambit/defender.eslint.config-mutator": "0.0.100",
|
|
24
|
+
"@teambit/workspace-config-files": "1.0.209"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@types/eslint": "
|
|
27
|
+
"@types/eslint": "8.56.6",
|
|
28
28
|
"@types/fs-extra": "9.0.7",
|
|
29
29
|
"@types/lodash": "4.14.165",
|
|
30
30
|
"@types/object-hash": "1.3.4",
|