Skip to content

Commit fab84df

Browse files
committed
feat: export lint API
1 parent de64188 commit fab84df

6 files changed

Lines changed: 31 additions & 4 deletions

File tree

packages/rstack/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
"types": "./dist/test.d.ts",
2424
"default": "./dist/test.js"
2525
},
26+
"./lint": {
27+
"types": "./dist/lint.d.ts",
28+
"default": "./dist/lint.js"
29+
},
2630
"./types": {
2731
"types": "./types/index.d.ts"
2832
},

packages/rstack/rslib.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default defineConfig({
1010
rslibConfig: './src/rslibConfig.ts',
1111
rslintConfig: './src/rslintConfig.ts',
1212
rstestConfig: './src/rstestConfig.ts',
13+
lint: './src/lint.ts',
1314
test: './src/test.ts',
1415
},
1516
define: {

packages/rstack/src/lint.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Re-export @rslint/core APIs so users can import lint APIs from `rstack/lint`.
3+
*
4+
* @example
5+
* ```ts
6+
* import { js, ts } from 'rstack/lint';
7+
* ```
8+
*/
9+
export * from '@rslint/core';
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { expect, test } from 'rstack/test';
2+
3+
const commonLintMethods = ['js', 'ts', 'Rslint'] as const;
4+
5+
test('should expose lint APIs from `rstack/lint`', async () => {
6+
const lint = await import('rstack/lint');
7+
8+
for (const method of commonLintMethods) {
9+
expect(lint).toHaveProperty(method);
10+
expect(typeof lint[method]).toBeTruthy();
11+
}
12+
});

packages/rstack/test/exports/test-subpath/index.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { expect, test } from 'rstack/test';
22

33
const commonTestMethods = ['test', 'it', 'describe', 'expect', 'beforeAll', 'afterAll'] as const;
44

5-
test('should expose common test APIs from rstack/test', async () => {
6-
const rstackTest = await import('rstack/test');
5+
test('should expose test APIs from `rstack/test`', async () => {
6+
const test = await import('rstack/test');
77

88
for (const method of commonTestMethods) {
9-
expect(rstackTest).toHaveProperty(method);
10-
expect(typeof rstackTest[method]).toBe('function');
9+
expect(test).toHaveProperty(method);
10+
expect(typeof test[method]).toBeTruthy();
1111
}
1212
});

packages/rstack/test/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"types": ["node", "rstack/test/globals"],
88
"paths": {
99
"rstack": ["../src/index.ts"],
10+
"rstack/lint": ["../src/lint.ts"],
1011
"rstack/test": ["../src/test.ts"],
1112
"#test-helpers": ["./helpers/index.ts"]
1213
}

0 commit comments

Comments
 (0)