@form8ion/eslint-config-extender 12.0.0-beta.2 → 12.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -12
- package/example.js +21 -9
- package/lib/index.mjs +15 -14
- package/lib/index.mjs.map +1 -1
- package/package.json +21 -23
- package/src/language-handler-prompt.js +4 -3
- package/src/language-handler-prompt.test.js +5 -5
- package/src/scaffold.js +1 -1
package/README.md
CHANGED
|
@@ -47,13 +47,12 @@ $ npm install @form8ion/eslint-config-extender --save-prod
|
|
|
47
47
|
|
|
48
48
|
```javascript
|
|
49
49
|
import {promptConstants} from '@form8ion/project';
|
|
50
|
+
import {packageManagers} from '@form8ion/javascript-core';
|
|
50
51
|
```
|
|
51
52
|
|
|
52
53
|
```javascript
|
|
53
|
-
const {packageManagers} = await import('@form8ion/javascript-core');
|
|
54
|
-
const {questionNames: projectQuestionNames} = await import('@form8ion/project');
|
|
55
54
|
const javascriptPlugin = await import('@form8ion/javascript');
|
|
56
|
-
const {scaffold, extendEslintConfig} = await import('
|
|
55
|
+
const {scaffold, extendEslintConfig} = await import('@form8ion/eslint-config-extender');
|
|
57
56
|
```
|
|
58
57
|
|
|
59
58
|
#### Execute
|
|
@@ -107,16 +106,29 @@ const {scaffold, extendEslintConfig} = await import('./lib/index.mjs');
|
|
|
107
106
|
}),
|
|
108
107
|
{
|
|
109
108
|
prompt: ({id}) => {
|
|
109
|
+
const {questionNames: projectQuestionNames, ids} = promptConstants;
|
|
110
|
+
const baseDetailsPromptId = ids.BASE_DETAILS;
|
|
111
|
+
|
|
110
112
|
switch (id) {
|
|
111
|
-
case promptConstants.ids.BASE_DETAILS:
|
|
113
|
+
case promptConstants.ids.BASE_DETAILS: {
|
|
114
|
+
const {
|
|
115
|
+
PROJECT_NAME,
|
|
116
|
+
LICENSE,
|
|
117
|
+
VISIBILITY,
|
|
118
|
+
DESCRIPTION,
|
|
119
|
+
COPYRIGHT_HOLDER,
|
|
120
|
+
COPYRIGHT_YEAR
|
|
121
|
+
} = projectQuestionNames[baseDetailsPromptId];
|
|
122
|
+
|
|
112
123
|
return {
|
|
113
|
-
[
|
|
114
|
-
[
|
|
115
|
-
[
|
|
116
|
-
[
|
|
117
|
-
[
|
|
118
|
-
[
|
|
124
|
+
[PROJECT_NAME]: 'eslint-config-foo',
|
|
125
|
+
[DESCRIPTION]: 'a description of the project',
|
|
126
|
+
[VISIBILITY]: 'Public',
|
|
127
|
+
[LICENSE]: 'MIT',
|
|
128
|
+
[COPYRIGHT_HOLDER]: 'John Smith',
|
|
129
|
+
[COPYRIGHT_YEAR]: '2022'
|
|
119
130
|
};
|
|
131
|
+
}
|
|
120
132
|
case promptConstants.ids.GIT_REPOSITORY:
|
|
121
133
|
return {[projectQuestionNames.GIT_REPO]: true};
|
|
122
134
|
case promptConstants.ids.REPOSITORY_HOST:
|
|
@@ -179,11 +191,11 @@ $ npm test
|
|
|
179
191
|
|
|
180
192
|
[renovate-link]: https://renovatebot.com
|
|
181
193
|
|
|
182
|
-
[renovate-badge]: https://img.shields.io/badge/renovate-enabled-brightgreen.svg?logo=
|
|
194
|
+
[renovate-badge]: https://img.shields.io/badge/renovate-enabled-brightgreen.svg?logo=renovate
|
|
183
195
|
|
|
184
196
|
[coverage-link]: https://codecov.io/github/form8ion/eslint-config-extender
|
|
185
197
|
|
|
186
|
-
[coverage-badge]: https://img.shields.io/codecov/c/github/form8ion/eslint-config-extender?logo=codecov
|
|
198
|
+
[coverage-badge]: https://img.shields.io/codecov/c/github/form8ion/eslint-config-extender/master?logo=codecov
|
|
187
199
|
|
|
188
200
|
[license-link]: LICENSE
|
|
189
201
|
|
package/example.js
CHANGED
|
@@ -5,6 +5,7 @@ import stubbedFs from 'mock-fs';
|
|
|
5
5
|
import * as td from 'testdouble';
|
|
6
6
|
import any from '@travi/any';
|
|
7
7
|
import {promptConstants} from '@form8ion/project';
|
|
8
|
+
import {packageManagers} from '@form8ion/javascript-core';
|
|
8
9
|
|
|
9
10
|
// remark-usage-ignore-next 13
|
|
10
11
|
const stubbedNodeModules = stubbedFs.load(resolve('node_modules'));
|
|
@@ -21,8 +22,6 @@ td.when(execa('npm run generate:md && npm test', {shell: true})).thenReturn({std
|
|
|
21
22
|
td.when(execa('npm', ['whoami'])).thenResolve({stdout: any.word()});
|
|
22
23
|
td.when(execa('npm', ['--version'])).thenResolve({stdout: any.word()});
|
|
23
24
|
|
|
24
|
-
const {packageManagers} = await import('@form8ion/javascript-core');
|
|
25
|
-
const {questionNames: projectQuestionNames} = await import('@form8ion/project');
|
|
26
25
|
const javascriptPlugin = await import('@form8ion/javascript');
|
|
27
26
|
const {scaffold, extendEslintConfig} = await import('./lib/index.mjs');
|
|
28
27
|
|
|
@@ -77,16 +76,29 @@ stubbedFs({node_modules: stubbedNodeModules});
|
|
|
77
76
|
}),
|
|
78
77
|
{
|
|
79
78
|
prompt: ({id}) => {
|
|
79
|
+
const {questionNames: projectQuestionNames, ids} = promptConstants;
|
|
80
|
+
const baseDetailsPromptId = ids.BASE_DETAILS;
|
|
81
|
+
|
|
80
82
|
switch (id) {
|
|
81
|
-
case promptConstants.ids.BASE_DETAILS:
|
|
83
|
+
case promptConstants.ids.BASE_DETAILS: {
|
|
84
|
+
const {
|
|
85
|
+
PROJECT_NAME,
|
|
86
|
+
LICENSE,
|
|
87
|
+
VISIBILITY,
|
|
88
|
+
DESCRIPTION,
|
|
89
|
+
COPYRIGHT_HOLDER,
|
|
90
|
+
COPYRIGHT_YEAR
|
|
91
|
+
} = projectQuestionNames[baseDetailsPromptId];
|
|
92
|
+
|
|
82
93
|
return {
|
|
83
|
-
[
|
|
84
|
-
[
|
|
85
|
-
[
|
|
86
|
-
[
|
|
87
|
-
[
|
|
88
|
-
[
|
|
94
|
+
[PROJECT_NAME]: 'eslint-config-foo',
|
|
95
|
+
[DESCRIPTION]: 'a description of the project',
|
|
96
|
+
[VISIBILITY]: 'Public',
|
|
97
|
+
[LICENSE]: 'MIT',
|
|
98
|
+
[COPYRIGHT_HOLDER]: 'John Smith',
|
|
99
|
+
[COPYRIGHT_YEAR]: '2022'
|
|
89
100
|
};
|
|
101
|
+
}
|
|
90
102
|
case promptConstants.ids.GIT_REPOSITORY:
|
|
91
103
|
return {[projectQuestionNames.GIT_REPO]: true};
|
|
92
104
|
case promptConstants.ids.REPOSITORY_HOST:
|
package/lib/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import { promises } from 'node:fs';
|
|
|
2
2
|
import { fileTypes } from '@form8ion/core';
|
|
3
3
|
import { write } from '@form8ion/config-file';
|
|
4
4
|
import deepmerge from 'deepmerge';
|
|
5
|
-
import { questionNames
|
|
5
|
+
import { questionNames } from '@form8ion/javascript';
|
|
6
6
|
import { dialects } from '@form8ion/javascript-core';
|
|
7
|
-
import { promptConstants,
|
|
7
|
+
import { promptConstants, scaffold } from '@form8ion/project';
|
|
8
8
|
|
|
9
|
-
async function
|
|
9
|
+
async function scaffoldEslintConfig({projectRoot, scope, projectName}) {
|
|
10
10
|
const configShortName = projectName.substring('eslint-config-'.length);
|
|
11
11
|
|
|
12
12
|
await Promise.all([
|
|
@@ -49,9 +49,10 @@ const JAVASCRIPT_LANGUAGE_CHOICE = 'JavaScript';
|
|
|
49
49
|
function injectLanguageChoiceIntoPrompt(prompt) {
|
|
50
50
|
return promptOptions => {
|
|
51
51
|
const {id} = promptOptions;
|
|
52
|
+
const projectLanguagePromptId = promptConstants.ids.PROJECT_LANGUAGE;
|
|
52
53
|
|
|
53
|
-
if (
|
|
54
|
-
return {[questionNames.PROJECT_LANGUAGE]: JAVASCRIPT_LANGUAGE_CHOICE};
|
|
54
|
+
if (projectLanguagePromptId === id) {
|
|
55
|
+
return {[promptConstants.questionNames[projectLanguagePromptId].PROJECT_LANGUAGE]: JAVASCRIPT_LANGUAGE_CHOICE};
|
|
55
56
|
}
|
|
56
57
|
return prompt(promptOptions);
|
|
57
58
|
};
|
|
@@ -60,7 +61,7 @@ function injectLanguageChoiceIntoPrompt(prompt) {
|
|
|
60
61
|
function extendEslintConfig(options, javascriptPluginFactory, dependencies) {
|
|
61
62
|
const {decisions, ...otherOptions} = options;
|
|
62
63
|
|
|
63
|
-
return scaffold
|
|
64
|
+
return scaffold(
|
|
64
65
|
deepmerge(
|
|
65
66
|
otherOptions,
|
|
66
67
|
{
|
|
@@ -68,13 +69,13 @@ function extendEslintConfig(options, javascriptPluginFactory, dependencies) {
|
|
|
68
69
|
languages: {
|
|
69
70
|
[JAVASCRIPT_LANGUAGE_CHOICE]: javascriptPluginFactory({
|
|
70
71
|
...decisions,
|
|
71
|
-
[questionNames
|
|
72
|
-
[questionNames
|
|
73
|
-
[questionNames
|
|
74
|
-
[questionNames
|
|
75
|
-
[questionNames
|
|
76
|
-
[questionNames
|
|
77
|
-
[questionNames
|
|
72
|
+
[questionNames.PROJECT_TYPE]: 'Package',
|
|
73
|
+
[questionNames.PROJECT_TYPE_CHOICE]: PLUGIN_NAME,
|
|
74
|
+
[questionNames.UNIT_TESTS]: false,
|
|
75
|
+
[questionNames.INTEGRATION_TESTS]: false,
|
|
76
|
+
[questionNames.CONFIGURE_LINTING]: false,
|
|
77
|
+
[questionNames.DIALECT]: dialects.COMMON_JS,
|
|
78
|
+
[questionNames.SHOULD_BE_SCOPED]: true
|
|
78
79
|
})
|
|
79
80
|
}
|
|
80
81
|
}
|
|
@@ -87,5 +88,5 @@ function extendEslintConfig(options, javascriptPluginFactory, dependencies) {
|
|
|
87
88
|
);
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
export { PLUGIN_NAME, extendEslintConfig, scaffold };
|
|
91
|
+
export { PLUGIN_NAME, extendEslintConfig, scaffoldEslintConfig as scaffold };
|
|
91
92
|
//# sourceMappingURL=index.mjs.map
|
package/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/scaffold.js","../src/constants.js","../src/language-handler-prompt.js","../src/high-level.js"],"sourcesContent":["import {promises as fs} from 'node:fs';\nimport {fileTypes} from '@form8ion/core';\nimport {write} from '@form8ion/config-file';\n\nexport default async function ({projectRoot, scope, projectName}) {\n const configShortName = projectName.substring('eslint-config-'.length);\n\n await Promise.all([\n write({\n format: fileTypes.YAML,\n path: projectRoot,\n name: 'eslint',\n config: {root: true, extends: [`@${scope}`, '.']}\n }),\n fs.writeFile(\n `${projectRoot}/index.js`,\n `module.exports = {extends: '@form8ion/${configShortName}'};\\n`\n ),\n fs.writeFile(\n `${projectRoot}/example.js`,\n `module.exports = {\n extends: [\n '@${scope}',\n '@${scope}/${configShortName}'\n ]\n};\n`\n )\n ]);\n\n return {\n scripts: {'lint:js': 'eslint .'},\n dependencies: {javascript: {production: [`@form8ion/${projectName}`], development: [`@${scope}/eslint-config`]}},\n nextSteps: [\n {summary: 'Save the extended `@form8ion` eslint-config as an exact version'},\n {summary: 'Document saving this config using the dev flag'},\n {summary: 'Link to the extended `@form8ion` config in the README'}\n ]\n };\n}\n","export const PLUGIN_NAME = 'ESLint Config';\nexport const JAVASCRIPT_LANGUAGE_CHOICE = 'JavaScript';\n","import {promptConstants
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/scaffold.js","../src/constants.js","../src/language-handler-prompt.js","../src/high-level.js"],"sourcesContent":["import {promises as fs} from 'node:fs';\nimport {fileTypes} from '@form8ion/core';\nimport {write} from '@form8ion/config-file';\n\nexport default async function scaffoldEslintConfig({projectRoot, scope, projectName}) {\n const configShortName = projectName.substring('eslint-config-'.length);\n\n await Promise.all([\n write({\n format: fileTypes.YAML,\n path: projectRoot,\n name: 'eslint',\n config: {root: true, extends: [`@${scope}`, '.']}\n }),\n fs.writeFile(\n `${projectRoot}/index.js`,\n `module.exports = {extends: '@form8ion/${configShortName}'};\\n`\n ),\n fs.writeFile(\n `${projectRoot}/example.js`,\n `module.exports = {\n extends: [\n '@${scope}',\n '@${scope}/${configShortName}'\n ]\n};\n`\n )\n ]);\n\n return {\n scripts: {'lint:js': 'eslint .'},\n dependencies: {javascript: {production: [`@form8ion/${projectName}`], development: [`@${scope}/eslint-config`]}},\n nextSteps: [\n {summary: 'Save the extended `@form8ion` eslint-config as an exact version'},\n {summary: 'Document saving this config using the dev flag'},\n {summary: 'Link to the extended `@form8ion` config in the README'}\n ]\n };\n}\n","export const PLUGIN_NAME = 'ESLint Config';\nexport const JAVASCRIPT_LANGUAGE_CHOICE = 'JavaScript';\n","import {promptConstants} from '@form8ion/project';\nimport {JAVASCRIPT_LANGUAGE_CHOICE} from './constants.js';\n\nexport default function injectLanguageChoiceIntoPrompt(prompt) {\n return promptOptions => {\n const {id} = promptOptions;\n const projectLanguagePromptId = promptConstants.ids.PROJECT_LANGUAGE;\n\n if (projectLanguagePromptId === id) {\n return {[promptConstants.questionNames[projectLanguagePromptId].PROJECT_LANGUAGE]: JAVASCRIPT_LANGUAGE_CHOICE};\n }\n return prompt(promptOptions);\n };\n}\n","import deepmerge from 'deepmerge';\nimport {questionNames as jsQuestionNames} from '@form8ion/javascript';\nimport {dialects} from '@form8ion/javascript-core';\nimport {scaffold} from '@form8ion/project';\n\nimport {JAVASCRIPT_LANGUAGE_CHOICE, PLUGIN_NAME} from './constants.js';\nimport injectLanguageChoiceIntoPrompt from './language-handler-prompt.js';\n\nexport default function extendEslintConfig(options, javascriptPluginFactory, dependencies) {\n const {decisions, ...otherOptions} = options;\n\n return scaffold(\n deepmerge(\n otherOptions,\n {\n plugins: {\n languages: {\n [JAVASCRIPT_LANGUAGE_CHOICE]: javascriptPluginFactory({\n ...decisions,\n [jsQuestionNames.PROJECT_TYPE]: 'Package',\n [jsQuestionNames.PROJECT_TYPE_CHOICE]: PLUGIN_NAME,\n [jsQuestionNames.UNIT_TESTS]: false,\n [jsQuestionNames.INTEGRATION_TESTS]: false,\n [jsQuestionNames.CONFIGURE_LINTING]: false,\n [jsQuestionNames.DIALECT]: dialects.COMMON_JS,\n [jsQuestionNames.SHOULD_BE_SCOPED]: true\n })\n }\n }\n }\n ),\n {\n ...dependencies,\n prompt: injectLangu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D,cAAc,CAACA,aAAe,CAAC,gBAAgB,GAAG;AAClD,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ,MAAM,GAAG,YAAY;AACrB,MAAM,MAAM,EAAE,8BAA8B,CAAC,YAAY,CAAC,MAAM;AAChE;AACA,GAAG;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
"name": "@form8ion/eslint-config-extender",
|
|
3
3
|
"description": "shareable ESLint config scaffolder for extending another config",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "12.0.0-beta.
|
|
5
|
+
"version": "12.0.0-beta.4",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "^
|
|
8
|
+
"node": "^22.21.0 || >=24.12"
|
|
9
9
|
},
|
|
10
10
|
"author": "Matt Travi <npm@travi.org> (https://matt.travi.org)",
|
|
11
11
|
"repository": "form8ion/eslint-config-extender",
|
|
12
12
|
"bugs": "https://github.com/form8ion/eslint-config-extender/issues",
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://www.npmjs.com/package/@form8ion/eslint-config-extender",
|
|
14
14
|
"runkitExampleFilename": "./example.js",
|
|
15
15
|
"exports": "./lib/index.mjs",
|
|
16
16
|
"main": "lib/index.mjs",
|
|
@@ -18,33 +18,32 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"pretest": "run-s build",
|
|
20
20
|
"test": "npm-run-all --print-label --parallel lint:* --parallel test:*",
|
|
21
|
-
"lint:
|
|
21
|
+
"lint:engines": "ls-engines",
|
|
22
|
+
"lint:gherkin": "gplint --config .gplintrc.json",
|
|
22
23
|
"lint:js": "eslint . --cache",
|
|
24
|
+
"lint:js:fix": "run-s 'lint:js -- --fix'",
|
|
25
|
+
"lint:lockfile": "lockfile-lint",
|
|
23
26
|
"lint:md": "remark . --frail",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
27
|
+
"lint:peer": "npm ls >/dev/null",
|
|
28
|
+
"lint:publish": "publint --strict",
|
|
26
29
|
"lint:sensitive": "ban",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
30
|
+
"test:unit": "run-s 'test:unit:base -- --coverage'",
|
|
31
|
+
"test:unit:base": "NODE_ENV=test DEBUG=any vitest run src/",
|
|
29
32
|
"test:integration": "run-s 'test:integration:base -- --profile noWip'",
|
|
33
|
+
"pretest:integration:base": "run-s build",
|
|
30
34
|
"test:integration:base": "NODE_OPTIONS=--enable-source-maps DEBUG=any cucumber-js test/integration",
|
|
31
35
|
"test:integration:debug": "DEBUG=test:* run-s test:integration",
|
|
32
36
|
"test:integration:wip": "run-s 'test:integration:base -- --profile wip'",
|
|
33
37
|
"test:integration:wip:debug": "DEBUG=test run-s 'test:integration:wip'",
|
|
34
|
-
"test:integration:focus": "run-s 'test:integration:base -- --profile focus'",
|
|
35
|
-
"clean": "rimraf ./lib",
|
|
36
38
|
"prebuild": "run-s clean",
|
|
37
39
|
"build": "npm-run-all --print-label --parallel build:*",
|
|
38
40
|
"build:js": "rollup --config",
|
|
39
|
-
"
|
|
41
|
+
"clean": "rimraf ./lib",
|
|
42
|
+
"pregenerate:md": "run-s build",
|
|
43
|
+
"generate:md": "NODE_OPTIONS=--enable-source-maps remark . --output",
|
|
40
44
|
"prepack": "run-s build",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"lint:peer": "npm ls >/dev/null",
|
|
44
|
-
"prepare": "husky install",
|
|
45
|
-
"lint:engines": "ls-engines",
|
|
46
|
-
"lint:publish": "publint --strict",
|
|
47
|
-
"lint:js:fix": "run-s 'lint:js -- --fix'"
|
|
45
|
+
"prepare": "husky",
|
|
46
|
+
"watch": "run-s 'build:js -- --watch'"
|
|
48
47
|
},
|
|
49
48
|
"files": [
|
|
50
49
|
"example.js",
|
|
@@ -61,24 +60,23 @@
|
|
|
61
60
|
"@form8ion/core": "^4.7.1",
|
|
62
61
|
"@form8ion/javascript": "^15.0.0",
|
|
63
62
|
"@form8ion/javascript-core": "^12.0.0",
|
|
64
|
-
"@form8ion/project": "22.0.0-beta.
|
|
63
|
+
"@form8ion/project": "^22.0.0-beta.15",
|
|
65
64
|
"deepmerge": "^4.2.2"
|
|
66
65
|
},
|
|
67
66
|
"devDependencies": {
|
|
68
67
|
"@cucumber/cucumber": "12.8.2",
|
|
69
68
|
"@form8ion/commitlint-config": "2.0.13",
|
|
70
|
-
"@form8ion/eslint-config": "7.0.
|
|
69
|
+
"@form8ion/eslint-config": "7.1.0-beta.1",
|
|
71
70
|
"@form8ion/eslint-config-cucumber": "1.4.1",
|
|
72
71
|
"@form8ion/eslint-config-vitest": "1.1.0",
|
|
73
72
|
"@form8ion/remark-lint-preset": "6.0.7",
|
|
74
73
|
"@travi/any": "3.3.0",
|
|
74
|
+
"@vitest/coverage-v8": "4.1.5",
|
|
75
75
|
"ban-sensitive-files": "1.10.11",
|
|
76
|
-
"c8": "11.0.0",
|
|
77
76
|
"chai": "6.2.2",
|
|
78
|
-
"cross-env": "10.1.0",
|
|
79
77
|
"cz-conventional-changelog": "3.3.0",
|
|
80
78
|
"debug": "4.4.3",
|
|
81
|
-
"
|
|
79
|
+
"gplint": "2.5.2",
|
|
82
80
|
"husky": "9.1.7",
|
|
83
81
|
"js-yaml": "4.1.1",
|
|
84
82
|
"lockfile-lint": "5.0.0",
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {promptConstants
|
|
1
|
+
import {promptConstants} from '@form8ion/project';
|
|
2
2
|
import {JAVASCRIPT_LANGUAGE_CHOICE} from './constants.js';
|
|
3
3
|
|
|
4
4
|
export default function injectLanguageChoiceIntoPrompt(prompt) {
|
|
5
5
|
return promptOptions => {
|
|
6
6
|
const {id} = promptOptions;
|
|
7
|
+
const projectLanguagePromptId = promptConstants.ids.PROJECT_LANGUAGE;
|
|
7
8
|
|
|
8
|
-
if (
|
|
9
|
-
return {[
|
|
9
|
+
if (projectLanguagePromptId === id) {
|
|
10
|
+
return {[promptConstants.questionNames[projectLanguagePromptId].PROJECT_LANGUAGE]: JAVASCRIPT_LANGUAGE_CHOICE};
|
|
10
11
|
}
|
|
11
12
|
return prompt(promptOptions);
|
|
12
13
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {promptConstants
|
|
1
|
+
import {promptConstants} from '@form8ion/project';
|
|
2
2
|
|
|
3
3
|
import {describe, it, vi, expect} from 'vitest';
|
|
4
4
|
import {when} from 'vitest-when';
|
|
@@ -18,9 +18,9 @@ describe('language choice handler prompt', () => {
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
it('should define the language choice as JavaScript for the language handler prompt', async () => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const projectLanguagePromptId = promptConstants.ids.PROJECT_LANGUAGE;
|
|
22
|
+
|
|
23
|
+
expect(await injectLanguageChoiceIntoPrompt(() => undefined)({...any.simpleObject(), id: projectLanguagePromptId}))
|
|
24
|
+
.toEqual({[promptConstants.questionNames[projectLanguagePromptId].PROJECT_LANGUAGE]: JAVASCRIPT_LANGUAGE_CHOICE});
|
|
25
25
|
});
|
|
26
26
|
});
|
package/src/scaffold.js
CHANGED
|
@@ -2,7 +2,7 @@ import {promises as fs} from 'node:fs';
|
|
|
2
2
|
import {fileTypes} from '@form8ion/core';
|
|
3
3
|
import {write} from '@form8ion/config-file';
|
|
4
4
|
|
|
5
|
-
export default async function ({projectRoot, scope, projectName}) {
|
|
5
|
+
export default async function scaffoldEslintConfig({projectRoot, scope, projectName}) {
|
|
6
6
|
const configShortName = projectName.substring('eslint-config-'.length);
|
|
7
7
|
|
|
8
8
|
await Promise.all([
|