Skip to content

Commit ff6c610

Browse files
author
John Doe
committed
refactor: fix Nx update
1 parent 3fc54f6 commit ff6c610

File tree

5 files changed

+36
-10
lines changed

5 files changed

+36
-10
lines changed

eslint.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,18 @@ export default tseslint.config(
163163
],
164164
},
165165
},
166+
{
167+
// in bin files, imports with side effects are allowed
168+
files: ['**/bin/**/*.ts', '**/bin/**/*.js'],
169+
rules: {
170+
'import/no-unassigned-import': 'off',
171+
},
172+
},
173+
{
174+
// in *nx-plugin.ts files path imports cant be default export style (@TODO understand relation to swc)
175+
files: ['**/*nx-plugin.ts'],
176+
rules: {
177+
'unicorn/import-style': 'off',
178+
},
179+
},
166180
);

packages/plugin-eslint/src/lib/eslint-plugin.int.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,12 @@ describe('eslintPlugin', () => {
130130
groups: [{ slug: 'type-safety', title: 'Type safety', rules: [] }],
131131
},
132132
),
133-
).rejects.toThrow('Invalid input');
133+
).rejects.toThrowErrorMatchingInlineSnapshot(`
134+
[SchemaValidationError: Invalid ESLintPluginOptions
135+
✖ Custom group rules must contain at least 1 element
136+
→ at groups[0].rules
137+
]
138+
`);
134139
await expect(
135140
eslintPlugin(
136141
{
@@ -141,7 +146,12 @@ describe('eslintPlugin', () => {
141146
groups: [{ slug: 'type-safety', title: 'Type safety', rules: {} }],
142147
},
143148
),
144-
).rejects.toThrow('Invalid input');
149+
).rejects.toThrowErrorMatchingInlineSnapshot(`
150+
[SchemaValidationError: Invalid ESLintPluginOptions
151+
✖ Custom group rules must contain at least 1 element
152+
→ at groups[0].rules
153+
]
154+
`);
145155
});
146156

147157
it('should throw when invalid parameters provided', async () => {

tools/zod2md-jsdocs/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"main": "./src/index.js",
77
"dependencies": {
88
"typescript": "^5.5.4",
9-
"ts-patch": "^3.3.0"
9+
"ts-patch": "^3.3.0",
10+
"@nx/devkit": "21.6.9"
1011
},
1112
"files": [
1213
"src"

tools/zod2md-jsdocs/src/lib/transformers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { PluginConfig, TransformerExtras } from 'ts-patch';
22
import type * as ts from 'typescript';
3+
4+
/* eslint-disable-next-line no-duplicate-imports */
35
import tsInstance from 'typescript';
46

57
/**

tools/zod2md-jsdocs/src/nx-plugin.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import * as path from 'node:path';
44
const ZOD2MD_CONFIG_FILE = 'zod2md.config.ts';
55
const GENERATE_DOCS_TARGET_NAME = 'generate-docs';
66

7-
interface DocsTargetConfigParams {
7+
type DocsTargetConfigParams = {
88
config: string;
99
output: string;
10-
}
10+
};
1111

1212
function createDocsTargetConfig({
1313
config,
@@ -30,8 +30,8 @@ function createDocsTargetConfig({
3030

3131
const createNodesV2: CreateNodesV2 = [
3232
`**/${ZOD2MD_CONFIG_FILE}`,
33-
async configFilePaths => {
34-
return Promise.all(
33+
async configFilePaths =>
34+
Promise.all(
3535
configFilePaths.map(async configFilePath => {
3636
const projectRoot = path.dirname(configFilePath);
3737
const normalizedProjectRoot = projectRoot === '.' ? '' : projectRoot;
@@ -54,13 +54,12 @@ const createNodesV2: CreateNodesV2 = [
5454
},
5555
] as const;
5656
}),
57-
);
58-
},
57+
),
5958
];
6059

6160
const nxPlugin: NxPlugin = {
6261
name: 'zod2md-jsdocs-nx-plugin',
6362
createNodesV2,
6463
};
6564

66-
module.exports = nxPlugin;
65+
export default nxPlugin;

0 commit comments

Comments
 (0)