@form8ion/eslint-config-extender 2.0.0-alpha.2 → 3.0.0
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 +34 -3
- package/example.js +51 -6
- package/package.json +14 -9
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
[![MIT license][license-badge]][license-link]
|
|
31
31
|
[![npm][npm-badge]][npm-link]
|
|
32
32
|
[![Try @form8ion/eslint-config-extender on RunKit][runkit-badge]][runkit-link]
|
|
33
|
+
![node][node-badge]
|
|
33
34
|
|
|
34
35
|
<!--consumer-badges end -->
|
|
35
36
|
|
|
@@ -44,7 +45,10 @@ $ npm install @form8ion/eslint-config-extender --save-prod
|
|
|
44
45
|
#### Import
|
|
45
46
|
|
|
46
47
|
```javascript
|
|
47
|
-
|
|
48
|
+
const {packageManagers} = require('@form8ion/javascript-core');
|
|
49
|
+
const {questionNames: projectQuestionNames} = require('@form8ion/project');
|
|
50
|
+
const {scaffold: javascriptScaffolder, questionNames: jsQuestionNames} = require('@form8ion/javascript');
|
|
51
|
+
const {scaffold, extendEslintConfig} = require('@form8ion/eslint-config-extender');
|
|
48
52
|
```
|
|
49
53
|
|
|
50
54
|
#### Execute
|
|
@@ -66,8 +70,33 @@ import {scaffold, extendEslintConfig} from '@form8ion/eslint-config-extender';
|
|
|
66
70
|
```javascript
|
|
67
71
|
(async () => {
|
|
68
72
|
await extendEslintConfig(
|
|
69
|
-
{
|
|
70
|
-
|
|
73
|
+
{
|
|
74
|
+
decisions: {
|
|
75
|
+
[projectQuestionNames.PROJECT_NAME]: 'eslint-config-foo',
|
|
76
|
+
[projectQuestionNames.DESCRIPTION]: 'a description of the project',
|
|
77
|
+
[projectQuestionNames.VISIBILITY]: 'Public',
|
|
78
|
+
[projectQuestionNames.LICENSE]: 'MIT',
|
|
79
|
+
[projectQuestionNames.COPYRIGHT_HOLDER]: 'John Smith',
|
|
80
|
+
[projectQuestionNames.COPYRIGHT_YEAR]: '2022',
|
|
81
|
+
[projectQuestionNames.GIT_REPO]: true,
|
|
82
|
+
[projectQuestionNames.REPO_HOST]: 'GitHub',
|
|
83
|
+
[projectQuestionNames.REPO_OWNER]: 'org-name',
|
|
84
|
+
[jsQuestionNames.AUTHOR_NAME]: 'John Smith',
|
|
85
|
+
[jsQuestionNames.AUTHOR_EMAIL]: 'john@smith.org',
|
|
86
|
+
[jsQuestionNames.AUTHOR_URL]: 'https://smith.org',
|
|
87
|
+
[jsQuestionNames.SCOPE]: 'org-name',
|
|
88
|
+
[jsQuestionNames.PACKAGE_MANAGER]: packageManagers.NPM,
|
|
89
|
+
[jsQuestionNames.NODE_VERSION_CATEGORY]: 'LTS',
|
|
90
|
+
[jsQuestionNames.CI_SERVICE]: 'Other'
|
|
91
|
+
},
|
|
92
|
+
vcsHosts: {
|
|
93
|
+
GitHub: {
|
|
94
|
+
scaffolder: options => options,
|
|
95
|
+
prompt: ({decisions}) => ({[projectQuestionNames.REPO_OWNER]: decisions[projectQuestionNames.REPO_OWNER]})
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
decisions => options => javascriptScaffolder({...options, decisions, unitTestFrameworks: {}})
|
|
71
100
|
);
|
|
72
101
|
})();
|
|
73
102
|
```
|
|
@@ -136,3 +165,5 @@ $ npm test
|
|
|
136
165
|
[github-actions-ci-link]: https://github.com/form8ion/eslint-config-extender/actions?query=workflow%3A%22Node.js+CI%22+branch%3Amaster
|
|
137
166
|
|
|
138
167
|
[github-actions-ci-badge]: https://github.com/form8ion/eslint-config-extender/workflows/Node.js%20CI/badge.svg
|
|
168
|
+
|
|
169
|
+
[node-badge]: https://img.shields.io/node/v/@form8ion/eslint-config-extender?logo=node.js
|
package/example.js
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
// #### Import
|
|
2
|
-
// remark-usage-ignore-next
|
|
2
|
+
// remark-usage-ignore-next 4
|
|
3
|
+
import {resolve} from 'path';
|
|
3
4
|
import stubbedFs from 'mock-fs';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
5
|
+
import td from 'testdouble';
|
|
6
|
+
import any from '@travi/any';
|
|
7
|
+
|
|
8
|
+
// remark-usage-ignore-next 12
|
|
9
|
+
const stubbedNodeModules = stubbedFs.load(resolve('node_modules'));
|
|
10
|
+
const error = new Error('Command failed with exit code 1: npm ls husky --json');
|
|
11
|
+
error.exitCode = 1;
|
|
12
|
+
error.stdout = JSON.stringify({});
|
|
13
|
+
error.command = 'npm ls husky --json';
|
|
14
|
+
const execa = td.replace('execa');
|
|
15
|
+
td.when(execa('. ~/.nvm/nvm.sh && nvm ls-remote --lts', {shell: true}))
|
|
16
|
+
.thenResolve({stdout: ['v16.5.4', ''].join('\n')});
|
|
17
|
+
td.when(execa('. ~/.nvm/nvm.sh && nvm install', {shell: true})).thenReturn({stdout: {pipe: () => undefined}});
|
|
18
|
+
td.when(execa('npm', ['ls', 'husky', '--json'])).thenReject(error);
|
|
19
|
+
td.when(execa('npm run generate:md && npm test', {shell: true})).thenReturn({stdout: {pipe: () => undefined}});
|
|
20
|
+
td.when(execa('npm', ['whoami'])).thenResolve({stdout: any.word()});
|
|
21
|
+
|
|
22
|
+
const {packageManagers} = require('@form8ion/javascript-core');
|
|
23
|
+
const {questionNames: projectQuestionNames} = require('@form8ion/project');
|
|
24
|
+
const {scaffold: javascriptScaffolder, questionNames: jsQuestionNames} = require('@form8ion/javascript');
|
|
25
|
+
const {scaffold, extendEslintConfig} = require('./lib/index.js');
|
|
6
26
|
|
|
7
27
|
// remark-usage-ignore-next
|
|
8
|
-
stubbedFs();
|
|
28
|
+
stubbedFs({node_modules: stubbedNodeModules});
|
|
9
29
|
|
|
10
30
|
// #### Execute
|
|
11
31
|
|
|
@@ -23,7 +43,32 @@ stubbedFs();
|
|
|
23
43
|
|
|
24
44
|
(async () => {
|
|
25
45
|
await extendEslintConfig(
|
|
26
|
-
{
|
|
27
|
-
|
|
46
|
+
{
|
|
47
|
+
decisions: {
|
|
48
|
+
[projectQuestionNames.PROJECT_NAME]: 'eslint-config-foo',
|
|
49
|
+
[projectQuestionNames.DESCRIPTION]: 'a description of the project',
|
|
50
|
+
[projectQuestionNames.VISIBILITY]: 'Public',
|
|
51
|
+
[projectQuestionNames.LICENSE]: 'MIT',
|
|
52
|
+
[projectQuestionNames.COPYRIGHT_HOLDER]: 'John Smith',
|
|
53
|
+
[projectQuestionNames.COPYRIGHT_YEAR]: '2022',
|
|
54
|
+
[projectQuestionNames.GIT_REPO]: true,
|
|
55
|
+
[projectQuestionNames.REPO_HOST]: 'GitHub',
|
|
56
|
+
[projectQuestionNames.REPO_OWNER]: 'org-name',
|
|
57
|
+
[jsQuestionNames.AUTHOR_NAME]: 'John Smith',
|
|
58
|
+
[jsQuestionNames.AUTHOR_EMAIL]: 'john@smith.org',
|
|
59
|
+
[jsQuestionNames.AUTHOR_URL]: 'https://smith.org',
|
|
60
|
+
[jsQuestionNames.SCOPE]: 'org-name',
|
|
61
|
+
[jsQuestionNames.PACKAGE_MANAGER]: packageManagers.NPM,
|
|
62
|
+
[jsQuestionNames.NODE_VERSION_CATEGORY]: 'LTS',
|
|
63
|
+
[jsQuestionNames.CI_SERVICE]: 'Other'
|
|
64
|
+
},
|
|
65
|
+
vcsHosts: {
|
|
66
|
+
GitHub: {
|
|
67
|
+
scaffolder: options => options,
|
|
68
|
+
prompt: ({decisions}) => ({[projectQuestionNames.REPO_OWNER]: decisions[projectQuestionNames.REPO_OWNER]})
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
decisions => options => javascriptScaffolder({...options, decisions, unitTestFrameworks: {}})
|
|
28
73
|
);
|
|
29
74
|
})();
|
package/package.json
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
"name": "@form8ion/eslint-config-extender",
|
|
3
3
|
"description": "shareable ESLint config scaffolder for extending another config",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "3.0.0",
|
|
6
6
|
"files": [
|
|
7
7
|
"example.js",
|
|
8
8
|
"lib/"
|
|
9
9
|
],
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": "^14.15 || ^16"
|
|
12
|
+
},
|
|
10
13
|
"publishConfig": {
|
|
11
14
|
"access": "public"
|
|
12
15
|
},
|
|
@@ -49,21 +52,22 @@
|
|
|
49
52
|
"test:unit": "cross-env NODE_ENV=test c8 run-s test:unit:base",
|
|
50
53
|
"test:unit:base": "DEBUG=any mocha 'src/**/*-test.js'",
|
|
51
54
|
"lint:peer": "npm ls >/dev/null",
|
|
52
|
-
"prepare": "husky install"
|
|
55
|
+
"prepare": "husky install",
|
|
56
|
+
"lint:engines": "ls-engines"
|
|
53
57
|
},
|
|
54
58
|
"devDependencies": {
|
|
55
59
|
"@babel/register": "7.17.7",
|
|
56
|
-
"@cucumber/cucumber": "8.2.
|
|
57
|
-
"@form8ion/babel-preset": "1.6.
|
|
58
|
-
"@form8ion/commitlint-config": "1.0.
|
|
59
|
-
"@form8ion/eslint-config": "5.0.
|
|
60
|
+
"@cucumber/cucumber": "8.2.1",
|
|
61
|
+
"@form8ion/babel-preset": "1.6.89",
|
|
62
|
+
"@form8ion/commitlint-config": "1.0.33",
|
|
63
|
+
"@form8ion/eslint-config": "5.0.3",
|
|
60
64
|
"@form8ion/eslint-config-cucumber": "1.4.1",
|
|
61
65
|
"@form8ion/eslint-config-mocha": "2.0.1",
|
|
62
66
|
"@form8ion/remark-lint-preset": "4.0.0",
|
|
63
67
|
"@travi/any": "2.0.20",
|
|
64
68
|
"@travi/github-scaffolder": "8.0.1",
|
|
65
69
|
"ban-sensitive-files": "1.9.18",
|
|
66
|
-
"c8": "7.11.
|
|
70
|
+
"c8": "7.11.3",
|
|
67
71
|
"chai": "4.3.6",
|
|
68
72
|
"cross-env": "7.0.3",
|
|
69
73
|
"cz-conventional-changelog": "3.3.0",
|
|
@@ -72,6 +76,7 @@
|
|
|
72
76
|
"husky": "8.0.1",
|
|
73
77
|
"js-yaml": "4.1.0",
|
|
74
78
|
"lockfile-lint": "4.7.4",
|
|
79
|
+
"ls-engines": "0.6.6",
|
|
75
80
|
"mocha": "10.0.0",
|
|
76
81
|
"mock-fs": "5.1.2",
|
|
77
82
|
"nock": "13.2.4",
|
|
@@ -81,7 +86,7 @@
|
|
|
81
86
|
"remark-toc": "8.0.1",
|
|
82
87
|
"remark-usage": "10.0.1",
|
|
83
88
|
"rimraf": "3.0.2",
|
|
84
|
-
"rollup": "2.
|
|
89
|
+
"rollup": "2.74.1",
|
|
85
90
|
"rollup-plugin-auto-external": "2.0.0",
|
|
86
91
|
"sinon": "14.0.0",
|
|
87
92
|
"testdouble": "3.16.5"
|
|
@@ -89,7 +94,7 @@
|
|
|
89
94
|
"dependencies": {
|
|
90
95
|
"@form8ion/javascript": "^4.0.0",
|
|
91
96
|
"@form8ion/javascript-core": "^5.0.0",
|
|
92
|
-
"@form8ion/project": "^
|
|
97
|
+
"@form8ion/project": "^13.1.0",
|
|
93
98
|
"deepmerge": "^4.2.2",
|
|
94
99
|
"write-yaml": "^1.0.0"
|
|
95
100
|
}
|