Skip to content

Commit 28bc74d

Browse files
committed
refactor: revert env vars
1 parent 944b141 commit 28bc74d

File tree

5 files changed

+7
-38
lines changed

5 files changed

+7
-38
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- name: Install dependencies
5050
run: npm ci
5151
- name: Lint affected projects
52-
run: ESLINT_FORMATTER_PROJECTS_DIR=packages npx nx affected:lint --parallel=3
52+
run: npx nx affected:lint --parallel=3
5353

5454
unit-test:
5555
strategy:

code-pushup.preset.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ export const eslintCoreConfigNx = async (
179179
})
180180
: await eslintPlugin(await eslintConfigFromAllNxProjects(), {
181181
artifacts: {
182-
generateArtifactsCommand:
183-
'ESLINT_FORMATTER_PROJECTS_DIR=packages NX_TUI=false npx nx run-many -t lint --include="packages/**"',
182+
generateArtifactsCommand: 'npx nx run-many -t lint-formatter',
184183
artifactsPaths: ['packages/**/.eslint/eslint-report.json'],
185184
},
186185
}),

nx.json

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
"dependsOn": ["eslint-formatter-multiple-formats:build"],
100100
"inputs": ["lint-eslint-inputs"],
101101
"executor": "@nx/eslint:lint",
102-
"outputs": ["{options.outputFile}"],
103102
"cache": true,
104103
"options": {
105104
"errorOnUnmatchedPattern": false,
@@ -110,28 +109,13 @@
110109
]
111110
}
112111
},
113-
"lint-report": {
114-
"inputs": ["default", "{workspaceRoot}/eslint.config.?(c)js"],
115-
"outputs": ["{projectRoot}/.eslint/eslint-report*.json"],
116-
"cache": true,
117-
"executor": "@nx/eslint:lint",
118-
"options": {
119-
"errorOnUnmatchedPattern": false,
120-
"maxWarnings": 0,
121-
"format": "json",
122-
"outputFile": "{projectRoot}/.eslint/eslint-report.json",
123-
"lintFilePatterns": [
124-
"{projectRoot}/**/*.ts",
125-
"{projectRoot}/package.json"
126-
]
127-
}
128-
},
129112
"lint-formatter": {
130113
"dependsOn": ["eslint-formatter-multiple-formats:build"],
131114
"inputs": ["lint-eslint-inputs"],
115+
"outputs": ["{projectRoot}/.eslint"],
132116
"executor": "nx:run-commands",
133117
"options": {
134-
"command": "nx run {projectName}:lint --format=./tools/eslint-formatter-multiple-formats/dist/index.js",
118+
"command": "nx run {projectName}:lint --format=./tools/eslint-formatter-multiple-formats/dist/src/index.js",
135119
"env": {
136120
"ESLINT_FORMATTER_CONFIG": "{\"outputDir\":\"{projectRoot}/.eslint\"}"
137121
}

tools/eslint-formatter-multiple-formats/src/lib/multiple-formats.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,15 @@ export default function multipleFormats(
6262

6363
const {
6464
outputDir = DEFAULT_OUTPUT_DIR,
65-
projectsDir,
66-
projectName = process.env['NX_TASK_TARGET_PROJECT'],
6765
filename,
6866
formats,
6967
terminal,
7068
verbose = false,
7169
} = config;
7270

73-
const filalOutputDir =
74-
typeof projectName === 'string' && typeof projectsDir === 'string'
75-
? path.join(projectsDir ?? '', projectName ?? '', outputDir)
76-
: outputDir;
77-
7871
try {
7972
persistEslintReports(formats, results, {
80-
outputDir: filalOutputDir,
73+
outputDir,
8174
filename,
8275
verbose,
8376
});

tools/eslint-formatter-multiple-formats/src/lib/utils.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,20 +216,13 @@ export function findConfigFromEnv(
216216
env: NodeJS.ProcessEnv,
217217
): FormatterConfig | null {
218218
const configString = env['ESLINT_FORMATTER_CONFIG'];
219-
const projectsDir = env['ESLINT_FORMATTER_PROJECTS_DIR'];
220219

221-
if (
222-
(!configString || configString.trim() === '') &&
223-
(!projectsDir || projectsDir.trim() === '')
224-
) {
220+
if (!configString || configString.trim() === '') {
225221
return null;
226222
}
227223

228224
try {
229-
return {
230-
...(JSON.parse(configString ?? '{}') as FormatterConfig),
231-
projectsDir: env['ESLINT_FORMATTER_PROJECTS_DIR'],
232-
};
225+
return JSON.parse(configString ?? '{}') as FormatterConfig;
233226
} catch (error) {
234227
console.error(
235228
'Error parsing ESLINT_FORMATTER_CONFIG environment variable:',

0 commit comments

Comments
 (0)