Skip to content

Commit 925755c

Browse files
committed
feat(eslint-config): defined the expected config
1 parent 7eec709 commit 925755c

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

src/scaffolder-test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ suite('scaffolder', () => {
2323
const projectRoot = any.string();
2424
const configPackageName = `${scope}/prettier-config`;
2525

26-
const {devDependencies} = await scaffold({config: {scope}, projectRoot});
26+
const {devDependencies, eslint} = await scaffold({config: {scope}, projectRoot});
2727

2828
assert.deepEqual(devDependencies, ['prettier', configPackageName]);
29+
assert.deepEqual(eslint, {configs: ['prettier']});
2930
assert.calledWith(
3031
configFile.write,
3132
{path: projectRoot, format: fileTypes.JSON, name: 'prettier', config: configPackageName}

src/scaffolder.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ export default async function ({config, projectRoot}) {
88

99
await write({path: projectRoot, format: fileTypes.JSON, name: 'prettier', config: configPackageName});
1010

11-
return {devDependencies: ['prettier', configPackageName]};
11+
return {
12+
eslint: {configs: ['prettier']},
13+
devDependencies: ['prettier', configPackageName]
14+
};
1215
}

test/integration/features/scaffolder.feature

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Feature: Scaffolder
55
When the project is scaffolded
66
Then the dependencies are defined
77
And the config file is created
8+
And the eslint config is defined
89

910
Scenario: no config provided
1011
Given no prettier config is defined

test/integration/features/step_definitions/common-steps.mjs

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {dirname, resolve} from 'node:path';
22
import {fileURLToPath} from 'node:url';
33

4+
import {fileExists} from '@form8ion/core';
45
import {After, Then, When} from '@cucumber/cucumber';
56
import {assert} from 'chai';
67
import stubbedFs from 'mock-fs';
@@ -27,4 +28,5 @@ When('the project is scaffolded', async function () {
2728

2829
Then('prettier is not configured', async function () {
2930
assert.deepEqual(this.scaffoldResult, {});
31+
assert.isFalse(await fileExists(`${this.scaffoldRoot}/.prettierrc.json`));
3032
});
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import {Given} from '@cucumber/cucumber';
1+
import {Given, Then} from '@cucumber/cucumber';
22
import any from '@travi/any';
3+
import {assert} from 'chai';
34

45
Given('a prettier config is defined', async function () {
56
this.scope = `@${any.word()}`
@@ -8,3 +9,7 @@ Given('a prettier config is defined', async function () {
89
Given('no prettier config is defined', async function () {
910
this.scope = undefined;
1011
});
12+
13+
Then('the eslint config is defined', async function () {
14+
assert.deepEqual(this.scaffoldResult.eslint.configs, ['prettier']);
15+
});

0 commit comments

Comments
 (0)