create-airbnb-x-config 1.0.2 → 1.0.3
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/dist/index.js
CHANGED
|
@@ -66,6 +66,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
66
66
|
initial: constants_1.defaults.typescript,
|
|
67
67
|
active: 'Yes',
|
|
68
68
|
inactive: 'No',
|
|
69
|
+
onState: utils_1.onPromptState,
|
|
69
70
|
}, {
|
|
70
71
|
onCancel: utils_1.onCancel,
|
|
71
72
|
});
|
|
@@ -79,6 +80,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
79
80
|
initial: constants_1.defaults.prettier,
|
|
80
81
|
active: 'Yes',
|
|
81
82
|
inactive: 'No',
|
|
83
|
+
onState: utils_1.onPromptState,
|
|
82
84
|
}, {
|
|
83
85
|
onCancel: utils_1.onCancel,
|
|
84
86
|
});
|
|
@@ -112,6 +114,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
112
114
|
value: constants_1.languages.OTHER,
|
|
113
115
|
},
|
|
114
116
|
],
|
|
117
|
+
onState: utils_1.onPromptState,
|
|
115
118
|
}, {
|
|
116
119
|
onCancel: utils_1.onCancel,
|
|
117
120
|
});
|
|
@@ -157,6 +160,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
157
160
|
return (0, getArgs_1.getConfig)(opts);
|
|
158
161
|
},
|
|
159
162
|
hint: getArgs_1.configHelp,
|
|
163
|
+
onState: utils_1.onPromptState,
|
|
160
164
|
}, {
|
|
161
165
|
onCancel: utils_1.onCancel,
|
|
162
166
|
});
|
|
@@ -174,6 +178,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
174
178
|
initial: constants_1.defaults.skipInstall,
|
|
175
179
|
active: 'Yes',
|
|
176
180
|
inactive: 'No',
|
|
181
|
+
onState: utils_1.onPromptState,
|
|
177
182
|
}, {
|
|
178
183
|
onCancel: utils_1.onCancel,
|
|
179
184
|
});
|
|
@@ -8,5 +8,6 @@ export declare const jsConfig: (string | (string | string[])[])[];
|
|
|
8
8
|
export declare const reactConfig: Config;
|
|
9
9
|
export declare const nodeConfig: (string | string[])[];
|
|
10
10
|
export declare const typescriptConfig: Config;
|
|
11
|
+
export declare const prettierConfig: (string | (string | (string | string[])[])[])[];
|
|
11
12
|
export declare const defaultConfig: Config;
|
|
12
13
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultConfig = exports.typescriptConfig = exports.nodeConfig = exports.reactConfig = exports.jsConfig = exports.gitignoreCode = exports.imports = exports.startingComments = void 0;
|
|
3
|
+
exports.defaultConfig = exports.prettierConfig = exports.typescriptConfig = exports.nodeConfig = exports.reactConfig = exports.jsConfig = exports.gitignoreCode = exports.imports = exports.startingComments = void 0;
|
|
4
4
|
const constants_1 = require("../../constants");
|
|
5
5
|
const constants_2 = require("../../lib/templates/constants");
|
|
6
6
|
// STARTING COMMENTS
|
|
@@ -20,7 +20,10 @@ const imports = ({ configurations }) => [
|
|
|
20
20
|
"import js from '@eslint/js';",
|
|
21
21
|
"import { configs, plugins } from 'eslint-config-airbnb-extended';",
|
|
22
22
|
...(configurations.prettier
|
|
23
|
-
? [
|
|
23
|
+
? [
|
|
24
|
+
"import { rules as prettierConfigRules } from 'eslint-config-prettier';",
|
|
25
|
+
"import prettierPlugin from 'eslint-plugin-prettier';",
|
|
26
|
+
]
|
|
24
27
|
: []),
|
|
25
28
|
];
|
|
26
29
|
exports.imports = imports;
|
|
@@ -54,7 +57,7 @@ const reactConfig = ({ language }) => {
|
|
|
54
57
|
'plugins.react,',
|
|
55
58
|
'// React Hooks Plugin',
|
|
56
59
|
'plugins.reactHooks,',
|
|
57
|
-
'// React JSX
|
|
60
|
+
'// React JSX A11y Plugin',
|
|
58
61
|
'plugins.reactA11y,',
|
|
59
62
|
];
|
|
60
63
|
const nextArray = ['// Next Plugin', 'plugins.next,'];
|
|
@@ -88,7 +91,7 @@ const typescriptConfig = ({ language }) => {
|
|
|
88
91
|
return [
|
|
89
92
|
'const typescriptConfig = [',
|
|
90
93
|
[
|
|
91
|
-
'//
|
|
94
|
+
'// TypeScript ESLint Plugin',
|
|
92
95
|
'plugins.typescriptEslint,',
|
|
93
96
|
'// Airbnb Base TypeScript Config',
|
|
94
97
|
'...configs.base.typescript,',
|
|
@@ -99,13 +102,35 @@ const typescriptConfig = ({ language }) => {
|
|
|
99
102
|
];
|
|
100
103
|
};
|
|
101
104
|
exports.typescriptConfig = typescriptConfig;
|
|
105
|
+
// Prettier Config
|
|
106
|
+
exports.prettierConfig = [
|
|
107
|
+
'const prettierConfig = [',
|
|
108
|
+
[
|
|
109
|
+
'// Prettier Plugin',
|
|
110
|
+
'{',
|
|
111
|
+
["name: 'prettier/plugin/config',", 'plugins: {', ['prettier: prettierPlugin,'], '},'],
|
|
112
|
+
'},',
|
|
113
|
+
],
|
|
114
|
+
[
|
|
115
|
+
'// Prettier Config',
|
|
116
|
+
'{',
|
|
117
|
+
[
|
|
118
|
+
"name: 'prettier/config',",
|
|
119
|
+
'rules: {',
|
|
120
|
+
['...prettierConfigRules,', "'prettier/prettier': 'error',"],
|
|
121
|
+
'},',
|
|
122
|
+
],
|
|
123
|
+
'},',
|
|
124
|
+
],
|
|
125
|
+
'];',
|
|
126
|
+
];
|
|
102
127
|
// DEFAULT CONFIG
|
|
103
128
|
const defaultConfig = ({ language, languagePreference, configurations }) => {
|
|
104
129
|
const reactArray = ['// React Config', '...reactConfig,'];
|
|
105
130
|
const nextArray = ['// Next Config', '...nextConfig,'];
|
|
106
131
|
const typescriptArray = ['// TypeScript Config', '...typescriptConfig,'];
|
|
107
132
|
const nodeArray = ['// Node Config', '...nodeConfig,'];
|
|
108
|
-
const prettierArray = ['// Prettier Config', 'prettierConfig,'];
|
|
133
|
+
const prettierArray = ['// Prettier Config', '...prettierConfig,'];
|
|
109
134
|
return [
|
|
110
135
|
'export default [',
|
|
111
136
|
[
|
|
@@ -8,12 +8,13 @@ const configs_1 = require("../../lib/templates/configs");
|
|
|
8
8
|
const constants_2 = require("../../lib/templates/constants");
|
|
9
9
|
const contentFormatter_1 = __importDefault(require("../../lib/templates/contentFormatter"));
|
|
10
10
|
const getContent = (params) => {
|
|
11
|
-
const { language, languagePreference } = params;
|
|
11
|
+
const { language, languagePreference, configurations } = params;
|
|
12
12
|
const reactArray = [constants_1.languages.REACT, constants_1.languages.NEXT].includes(language)
|
|
13
13
|
? [...(0, configs_1.reactConfig)(params), '']
|
|
14
14
|
: [];
|
|
15
15
|
const typescriptArray = languagePreference === constants_2.languagePreferences.TYPESCRIPT ? [...(0, configs_1.typescriptConfig)(params), ''] : [];
|
|
16
16
|
const nodeArray = language === constants_1.languages.NODE ? [...configs_1.nodeConfig, ''] : [];
|
|
17
|
+
const prettierArray = configurations.prettier ? [...configs_1.prettierConfig, ''] : [];
|
|
17
18
|
const content = (0, contentFormatter_1.default)([
|
|
18
19
|
...configs_1.startingComments,
|
|
19
20
|
'',
|
|
@@ -26,6 +27,7 @@ const getContent = (params) => {
|
|
|
26
27
|
...reactArray,
|
|
27
28
|
...nodeArray,
|
|
28
29
|
...typescriptArray,
|
|
30
|
+
...prettierArray,
|
|
29
31
|
...(0, configs_1.defaultConfig)(params),
|
|
30
32
|
'',
|
|
31
33
|
]);
|
package/dist/package.json
CHANGED