Skip to content

Commit 7712250

Browse files
committed
feat: support top-level await in config files
1 parent 1c34d92 commit 7712250

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

examples/cli-e2e/mocks/config.mock.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
persist: { outputPath: 'tmp/cli-config-out.json' },
77
categories: [],
88
plugins: [
9-
eslintPlugin({ config: '.eslintrc.json' }),
9+
await eslintPlugin({ eslintrc: '.eslintrc.json', patterns: '**/*.ts' }),
1010
lighthousePlugin({ config: '.lighthouserc.json' }),
1111
],
1212
};

examples/cli-e2e/mocks/config.mock.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
persist: { outputPath: 'tmp/cli-config-out.json' },
77
categories: [],
88
plugins: [
9-
eslintPlugin({ config: '.eslintrc.json' }),
9+
await eslintPlugin({ eslintrc: '.eslintrc.json', patterns: '**/*.ts' }),
1010
lighthousePlugin({ config: '.lighthouserc.json' }),
1111
],
1212
};

examples/cli-e2e/mocks/config.mock.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
persist: { outputPath: 'tmp/cli-config-out.json' },
77
categories: [],
88
plugins: [
9-
eslintPlugin({ config: '.eslintrc.json' }),
9+
await eslintPlugin({ eslintrc: '.eslintrc.json', patterns: '**/*.ts' }),
1010
lighthousePlugin({ config: '.lighthouserc.json' }),
1111
],
1212
};

examples/cli-e2e/tests/cli.spec.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ describe('cli', () => {
1111
it('should load .js config file', async () => {
1212
const argv = await cli(['--configPath', configFile('js'), '--verbose'])
1313
.argv;
14-
expect(argv.plugins[0]).toEqual(eslintPlugin({ config: '.eslintrc.json' }));
14+
expect(argv.plugins[0]).toEqual(
15+
await eslintPlugin({ eslintrc: '.eslintrc.json', patterns: '**/*.ts' }),
16+
);
1517
expect(argv.plugins[1]).toEqual(
1618
lighthousePlugin({ config: '.lighthouserc.json' }),
1719
);
@@ -20,7 +22,9 @@ describe('cli', () => {
2022
it('should load .mjs config file', async () => {
2123
const argv = await cli(['--configPath', configFile('mjs'), '--verbose'])
2224
.argv;
23-
expect(argv.plugins[0]).toEqual(eslintPlugin({ config: '.eslintrc.json' }));
25+
expect(argv.plugins[0]).toEqual(
26+
await eslintPlugin({ eslintrc: '.eslintrc.json', patterns: '**/*.ts' }),
27+
);
2428
expect(argv.plugins[1]).toEqual(
2529
lighthousePlugin({ config: '.lighthouserc.json' }),
2630
);
@@ -29,7 +33,9 @@ describe('cli', () => {
2933
it('should load .ts config file', async () => {
3034
const argv = await cli(['--configPath', configFile('ts'), '--verbose'])
3135
.argv;
32-
expect(argv.plugins[0]).toEqual(eslintPlugin({ config: '.eslintrc.json' }));
36+
expect(argv.plugins[0]).toEqual(
37+
await eslintPlugin({ eslintrc: '.eslintrc.json', patterns: '**/*.ts' }),
38+
);
3339
expect(argv.plugins[1]).toEqual(
3440
lighthousePlugin({ config: '.lighthouserc.json' }),
3541
);

tsconfig.base.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"emitDecoratorMetadata": true,
1111
"experimentalDecorators": true,
1212
"importHelpers": true,
13-
"target": "es2015",
13+
"target": "es2022",
1414
"module": "esnext",
1515
"lib": ["es2020", "dom"],
1616
"skipLibCheck": true,

0 commit comments

Comments
 (0)