create-airbnb-x-config 2.2.0 → 2.3.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 +5 -146
- package/dist/constants/index.d.ts +0 -8
- package/dist/constants/index.js +1 -9
- package/dist/helpers/getArgs.d.ts +3 -12
- package/dist/helpers/getArgs.js +2 -57
- package/dist/helpers/getCommands.js +8 -21
- package/dist/helpers/getConfigUrl.js +4 -5
- package/dist/helpers/program.d.ts +1 -1
- package/dist/helpers/program.js +1 -6
- package/dist/index.js +14 -81
- package/dist/lib/templates/getContent.d.ts +1 -1
- package/dist/package.json +5 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,150 +1,9 @@
|
|
|
1
1
|
# `create-airbnb-x-config`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Run this command inside your project folder to launch the interactive setup:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npx create-airbnb-x-config
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
You’ll be guided through a series of questions to customize your setup. For example:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
✔ Would you like to use TypeScript? … No / Yes
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### Non-Interactive Setup
|
|
20
|
-
|
|
21
|
-
Prefer a faster setup? Use command-line options to skip the prompts:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npx create-airbnb-x-config --ts --react --use-pnpm
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Here’s a list of available options:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
Usage: create-airbnb-x-config [options]
|
|
31
|
-
|
|
32
|
-
Options:
|
|
33
|
-
-v, --version
|
|
34
|
-
|
|
35
|
-
Output the current version of create-airbnb-x-config.
|
|
36
|
-
|
|
37
|
-
--extended
|
|
38
|
-
|
|
39
|
-
Explicitly tell the CLI to use extended configurations.
|
|
40
|
-
|
|
41
|
-
--legacy
|
|
42
|
-
|
|
43
|
-
Explicitly tell the CLI to use legacy configurations.
|
|
44
|
-
|
|
45
|
-
--ts, --typescript
|
|
46
|
-
|
|
47
|
-
Generate configuration for a TypeScript project.
|
|
48
|
-
|
|
49
|
-
--js, --javascript
|
|
50
|
-
|
|
51
|
-
Generate configuration for a JavaScript project.
|
|
52
|
-
|
|
53
|
-
--prettier
|
|
54
|
-
|
|
55
|
-
Include Prettier specific linting rules.
|
|
56
|
-
|
|
57
|
-
--react
|
|
58
|
-
|
|
59
|
-
Include React specific linting rules.
|
|
60
|
-
|
|
61
|
-
--remix, --react-router
|
|
62
|
-
|
|
63
|
-
Include Remix/React Router specific linting rules.
|
|
64
|
-
|
|
65
|
-
--next
|
|
66
|
-
|
|
67
|
-
Include Next.js specific linting rules.
|
|
68
|
-
|
|
69
|
-
--node
|
|
70
|
-
|
|
71
|
-
Include Node.js specific linting rules.
|
|
72
|
-
|
|
73
|
-
--base-config
|
|
74
|
-
|
|
75
|
-
Include only the base Airbnb ESLint configuration.
|
|
76
|
-
|
|
77
|
-
--node-config
|
|
78
|
-
|
|
79
|
-
Include the Node specific ESLint configuration.
|
|
3
|
+
[](https://www.npmjs.com/package/create-airbnb-x-config)
|
|
4
|
+
[](https://www.npmjs.com/package/create-airbnb-x-config)
|
|
5
|
+
[](https://www.npmjs.com/package/create-airbnb-x-config)
|
|
80
6
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Include the React specific ESLint configuration.
|
|
84
|
-
|
|
85
|
-
--next-config
|
|
86
|
-
|
|
87
|
-
Include the Next.js specific ESLint configuration.
|
|
88
|
-
|
|
89
|
-
--remix-config, --react-router-config
|
|
90
|
-
|
|
91
|
-
Include the Remix/React Router specific ESLint configuration.
|
|
92
|
-
|
|
93
|
-
--strict-import-config
|
|
94
|
-
|
|
95
|
-
Include the strict Import ESLint configuration.
|
|
96
|
-
|
|
97
|
-
--strict-react-config
|
|
98
|
-
|
|
99
|
-
Include the strict React ESLint configuration.
|
|
100
|
-
|
|
101
|
-
--strict-typescript-config
|
|
102
|
-
|
|
103
|
-
Include the strict TypeScript ESLint configuration.
|
|
104
|
-
|
|
105
|
-
--legacy-base-config
|
|
106
|
-
|
|
107
|
-
Include the legacy Base ESLint configuration.
|
|
108
|
-
|
|
109
|
-
--legacy-react-config
|
|
110
|
-
|
|
111
|
-
Include the legacy React ESLint configuration.
|
|
112
|
-
|
|
113
|
-
--legacy-react-hooks-config
|
|
114
|
-
|
|
115
|
-
Include the legacy React Hooks ESLint configuration.
|
|
116
|
-
|
|
117
|
-
--use-npm
|
|
118
|
-
|
|
119
|
-
Explicitly tell the CLI to use npm.
|
|
120
|
-
|
|
121
|
-
--use-yarn
|
|
122
|
-
|
|
123
|
-
Explicitly tell the CLI to use Yarn.
|
|
124
|
-
|
|
125
|
-
--use-pnpm
|
|
126
|
-
|
|
127
|
-
Explicitly tell the CLI to use pnpm.
|
|
128
|
-
|
|
129
|
-
--use-bun
|
|
130
|
-
|
|
131
|
-
Explicitly tell the CLI to use Bun.
|
|
132
|
-
|
|
133
|
-
--create-eslint-file
|
|
134
|
-
|
|
135
|
-
Explicitly tell the CLI to create eslint.config.mjs file.
|
|
136
|
-
|
|
137
|
-
--skip-install
|
|
138
|
-
|
|
139
|
-
Explicitly tell the CLI to skip installing packages.
|
|
140
|
-
|
|
141
|
-
-h, --help
|
|
142
|
-
|
|
143
|
-
Display this help message.
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## Why use this?
|
|
147
|
-
|
|
148
|
-
Using `create-airbnb-x-config` simplifies the entire setup process. Instead of manually installing and configuring multiple ESLint plugins, this tool does it all for you.
|
|
7
|
+
The easiest way to get started with `eslint-config-airbnb-extended` is by using the CLI tool `create-airbnb-x-config`. It helps you set up ESLint quickly with all the right settings for your project.
|
|
149
8
|
|
|
150
|
-
|
|
9
|
+
> Check out the package docs here: https://eslint-airbnb-extended.nishargshah.dev/cli/guide
|
|
@@ -2,20 +2,12 @@ export declare const languages: {
|
|
|
2
2
|
readonly REACT: "react";
|
|
3
3
|
readonly NEXT: "next";
|
|
4
4
|
readonly NODE: "node";
|
|
5
|
-
readonly OTHER: "other";
|
|
6
5
|
};
|
|
7
6
|
export declare const strictConfigs: {
|
|
8
7
|
readonly IMPORT: "import";
|
|
9
8
|
readonly REACT: "react";
|
|
10
9
|
readonly TYPESCRIPT: "typescript";
|
|
11
10
|
};
|
|
12
|
-
export declare const configs: {
|
|
13
|
-
readonly BASE: "base";
|
|
14
|
-
readonly NODE: "node";
|
|
15
|
-
readonly REACT: "react";
|
|
16
|
-
readonly NEXT: "next";
|
|
17
|
-
readonly REACT_ROUTER: "reactRouter";
|
|
18
|
-
};
|
|
19
11
|
export declare const configTypes: {
|
|
20
12
|
readonly EXTENDED: "extended";
|
|
21
13
|
readonly LEGACY: "legacy";
|
package/dist/constants/index.js
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.legacyLanguages = exports.legacyConfigs = exports.packageManagers = exports.defaults = exports.configTypes = exports.
|
|
3
|
+
exports.legacyLanguages = exports.legacyConfigs = exports.packageManagers = exports.defaults = exports.configTypes = exports.strictConfigs = exports.languages = void 0;
|
|
4
4
|
exports.languages = {
|
|
5
5
|
REACT: 'react',
|
|
6
6
|
NEXT: 'next',
|
|
7
7
|
NODE: 'node',
|
|
8
|
-
OTHER: 'other',
|
|
9
8
|
};
|
|
10
9
|
exports.strictConfigs = {
|
|
11
10
|
IMPORT: 'import',
|
|
12
11
|
REACT: 'react',
|
|
13
12
|
TYPESCRIPT: 'typescript',
|
|
14
13
|
};
|
|
15
|
-
exports.configs = {
|
|
16
|
-
BASE: 'base',
|
|
17
|
-
NODE: 'node',
|
|
18
|
-
REACT: 'react',
|
|
19
|
-
NEXT: 'next',
|
|
20
|
-
REACT_ROUTER: 'reactRouter',
|
|
21
|
-
};
|
|
22
14
|
exports.configTypes = {
|
|
23
15
|
EXTENDED: 'extended',
|
|
24
16
|
LEGACY: 'legacy',
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { configTypes, languages, packageManagers, strictConfigs } from '../constants';
|
|
2
2
|
import type { ValueOf } from '../utils/types';
|
|
3
|
-
export declare const configHelp = "\n/**\n * Configuration Rules:\n * 1. Either Base or Node config should be included (choose one).\n * 2. React config can be used with either Next or Remix/React Router (choose one).\n * 3. Including all configs together is not recommended and may lead to conflicts.\n *\n * Summary:\n * - One from: Base | Node\n * - One from: React + (Next | Remix/React Router)\n * - Avoid selecting all configs at once.\n */";
|
|
4
|
-
type GetConfig = (opts: Partial<ProgramOpts>) => GetArgsOutput['config'];
|
|
5
|
-
export declare const getConfig: GetConfig;
|
|
6
3
|
export interface ProgramOpts {
|
|
7
4
|
extended: true;
|
|
8
5
|
legacy: true;
|
|
@@ -13,11 +10,6 @@ export interface ProgramOpts {
|
|
|
13
10
|
reactRouter: true;
|
|
14
11
|
next: true;
|
|
15
12
|
node: true;
|
|
16
|
-
baseConfig: true;
|
|
17
|
-
nodeConfig: true;
|
|
18
|
-
reactConfig: true;
|
|
19
|
-
nextConfig: true;
|
|
20
|
-
reactRouterConfig: true;
|
|
21
13
|
strictImportConfig: true;
|
|
22
14
|
strictReactConfig: true;
|
|
23
15
|
strictTypescriptConfig: true;
|
|
@@ -39,13 +31,12 @@ interface GetArgsLegacyConfig {
|
|
|
39
31
|
export interface GetArgsOutput {
|
|
40
32
|
configType: ValueOf<typeof configTypes> | null;
|
|
41
33
|
typescript: boolean | null;
|
|
42
|
-
prettier:
|
|
34
|
+
prettier: true | null;
|
|
43
35
|
strictConfig: ValueOf<typeof strictConfigs>[] | null;
|
|
44
36
|
language: ValueOf<typeof languages> | null;
|
|
45
|
-
config: ValueOf<typeof configs>[] | null;
|
|
46
37
|
legacyConfig: GetArgsLegacyConfig | null;
|
|
47
38
|
packageManager: ValueOf<typeof packageManagers> | null;
|
|
48
|
-
createESLintFile:
|
|
39
|
+
createESLintFile: true | null;
|
|
49
40
|
skipInstall: true | null;
|
|
50
41
|
}
|
|
51
42
|
type GetArgs = () => Promise<GetArgsOutput>;
|
package/dist/helpers/getArgs.js
CHANGED
|
@@ -12,7 +12,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getConfig = exports.configHelp = void 0;
|
|
16
15
|
const constants_1 = require("../constants");
|
|
17
16
|
const getPackageManager_1 = require("../helpers/getPackageManager");
|
|
18
17
|
const program_1 = __importDefault(require("../helpers/program"));
|
|
@@ -43,46 +42,8 @@ const getStrictConfig = (opts) => {
|
|
|
43
42
|
strictConfig.push(constants_1.strictConfigs.TYPESCRIPT);
|
|
44
43
|
return strictConfig.length > 0 ? strictConfig : null;
|
|
45
44
|
};
|
|
46
|
-
// Config Help
|
|
47
|
-
exports.configHelp = `
|
|
48
|
-
/**
|
|
49
|
-
* Configuration Rules:
|
|
50
|
-
* 1. Either Base or Node config should be included (choose one).
|
|
51
|
-
* 2. React config can be used with either Next or Remix/React Router (choose one).
|
|
52
|
-
* 3. Including all configs together is not recommended and may lead to conflicts.
|
|
53
|
-
*
|
|
54
|
-
* Summary:
|
|
55
|
-
* - One from: Base | Node
|
|
56
|
-
* - One from: React + (Next | Remix/React Router)
|
|
57
|
-
* - Avoid selecting all configs at once.
|
|
58
|
-
*/`;
|
|
59
|
-
const getConfig = (opts) => {
|
|
60
|
-
const { baseConfig, nodeConfig, reactConfig, nextConfig, reactRouterConfig } = opts;
|
|
61
|
-
const config = [];
|
|
62
|
-
if (baseConfig || nodeConfig) {
|
|
63
|
-
if (baseConfig)
|
|
64
|
-
config.push(constants_1.configs.BASE);
|
|
65
|
-
if (nodeConfig)
|
|
66
|
-
config.push(constants_1.configs.NODE);
|
|
67
|
-
return config;
|
|
68
|
-
}
|
|
69
|
-
if (reactConfig || nextConfig || reactRouterConfig) {
|
|
70
|
-
if (reactConfig)
|
|
71
|
-
config.push(constants_1.configs.REACT);
|
|
72
|
-
if (nextConfig)
|
|
73
|
-
config.push(constants_1.configs.NEXT);
|
|
74
|
-
else if (reactRouterConfig)
|
|
75
|
-
config.push(constants_1.configs.REACT_ROUTER);
|
|
76
|
-
return config;
|
|
77
|
-
}
|
|
78
|
-
return null;
|
|
79
|
-
};
|
|
80
|
-
exports.getConfig = getConfig;
|
|
81
45
|
const getLanguage = (opts) => {
|
|
82
46
|
const { react, reactRouter, next, node } = opts;
|
|
83
|
-
const config = (0, exports.getConfig)(opts);
|
|
84
|
-
if (config)
|
|
85
|
-
return constants_1.languages.OTHER;
|
|
86
47
|
if (react || reactRouter)
|
|
87
48
|
return constants_1.languages.REACT;
|
|
88
49
|
if (next)
|
|
@@ -111,21 +72,6 @@ const getPackageManagerFromOpts = (opts) => {
|
|
|
111
72
|
return constants_1.packageManagers.BUN;
|
|
112
73
|
return null;
|
|
113
74
|
};
|
|
114
|
-
const getCreateESLintFile = (opts) => {
|
|
115
|
-
const { createEslintFile } = opts;
|
|
116
|
-
const config = (0, exports.getConfig)(opts);
|
|
117
|
-
if (config)
|
|
118
|
-
return false;
|
|
119
|
-
if (createEslintFile)
|
|
120
|
-
return true;
|
|
121
|
-
return null;
|
|
122
|
-
};
|
|
123
|
-
const getSkipInstall = (opts) => {
|
|
124
|
-
const { skipInstall } = opts;
|
|
125
|
-
if (skipInstall)
|
|
126
|
-
return true;
|
|
127
|
-
return null;
|
|
128
|
-
};
|
|
129
75
|
const getArgs = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
130
76
|
var _a;
|
|
131
77
|
const opts = program_1.default.opts();
|
|
@@ -135,11 +81,10 @@ const getArgs = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
135
81
|
prettier: opts.prettier ? true : null,
|
|
136
82
|
strictConfig: getStrictConfig(opts),
|
|
137
83
|
language: getLanguage(opts),
|
|
138
|
-
config: (0, exports.getConfig)(opts),
|
|
139
84
|
legacyConfig: getLegacyConfig(opts),
|
|
140
85
|
packageManager: (_a = getPackageManagerFromOpts(opts)) !== null && _a !== void 0 ? _a : (yield (0, getPackageManager_1.getPackageManager)()),
|
|
141
|
-
createESLintFile:
|
|
142
|
-
skipInstall:
|
|
86
|
+
createESLintFile: opts.createEslintFile ? true : null,
|
|
87
|
+
skipInstall: opts.skipInstall ? true : null,
|
|
143
88
|
};
|
|
144
89
|
});
|
|
145
90
|
exports.default = getArgs;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const constants_1 = require("../constants");
|
|
4
4
|
const getCommands = (args) => {
|
|
5
|
-
const { configType, typescript, prettier, language,
|
|
5
|
+
const { configType, typescript, prettier, language, packageManager, legacyConfig } = args;
|
|
6
6
|
const pmInstallationCommand = {
|
|
7
7
|
[constants_1.packageManagers.NPM]: 'install',
|
|
8
8
|
[constants_1.packageManagers.YARN]: 'add',
|
|
@@ -26,27 +26,14 @@ const getCommands = (args) => {
|
|
|
26
26
|
}
|
|
27
27
|
if (configType === constants_1.configTypes.EXTENDED) {
|
|
28
28
|
commands.push('@stylistic/eslint-plugin@^3.1.0', 'eslint-plugin-import-x');
|
|
29
|
-
if (language === constants_1.languages.
|
|
30
|
-
|
|
31
|
-
commands.push('eslint-plugin-n');
|
|
32
|
-
}
|
|
33
|
-
if (config.includes(constants_1.configs.REACT) || config.includes(constants_1.configs.REACT_ROUTER)) {
|
|
34
|
-
commands.push('eslint-plugin-react', 'eslint-plugin-react-hooks', 'eslint-plugin-jsx-a11y');
|
|
35
|
-
}
|
|
36
|
-
if (config.includes(constants_1.configs.NEXT)) {
|
|
37
|
-
commands.push('@next/eslint-plugin-next');
|
|
38
|
-
}
|
|
29
|
+
if (language === constants_1.languages.REACT || language === constants_1.languages.NEXT) {
|
|
30
|
+
commands.push('eslint-plugin-react', 'eslint-plugin-react-hooks', 'eslint-plugin-jsx-a11y');
|
|
39
31
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
commands.push('@next/eslint-plugin-next');
|
|
46
|
-
}
|
|
47
|
-
if (language === constants_1.languages.NODE) {
|
|
48
|
-
commands.push('eslint-plugin-n');
|
|
49
|
-
}
|
|
32
|
+
if (language === constants_1.languages.NEXT) {
|
|
33
|
+
commands.push('@next/eslint-plugin-next');
|
|
34
|
+
}
|
|
35
|
+
if (language === constants_1.languages.NODE) {
|
|
36
|
+
commands.push('eslint-plugin-n');
|
|
50
37
|
}
|
|
51
38
|
}
|
|
52
39
|
if (configType === constants_1.configTypes.LEGACY) {
|
|
@@ -12,8 +12,6 @@ exports.baseGithubUrl = 'https://github.com/NishargShah/eslint-config-airbnb-ext
|
|
|
12
12
|
const getConfigUrl = (args) => {
|
|
13
13
|
const { configType, typescript, prettier, strictConfig, language, legacyConfig } = args;
|
|
14
14
|
const isLegacy = configType === constants_1.configTypes.LEGACY;
|
|
15
|
-
if (!isLegacy && language === constants_1.languages.OTHER)
|
|
16
|
-
return null;
|
|
17
15
|
const prettierText = prettier ? 'prettier' : null;
|
|
18
16
|
const tsOrJsText = typescript ? 'ts' : 'js';
|
|
19
17
|
const legacyLanguage = (() => {
|
|
@@ -21,16 +19,17 @@ const getConfigUrl = (args) => {
|
|
|
21
19
|
return null;
|
|
22
20
|
if (legacyConfig.base)
|
|
23
21
|
return constants_1.legacyLanguages.BASE;
|
|
24
|
-
if
|
|
25
|
-
return constants_1.legacyLanguages.REACT;
|
|
22
|
+
// NOTE: React Hooks should come first in the condition, because if someone selects "Yes", it must appear in the config otherwise, it won’t be reached.
|
|
26
23
|
if (legacyConfig.reactHooks)
|
|
27
24
|
return constants_1.legacyLanguages.REACT_HOOKS;
|
|
25
|
+
if (legacyConfig.react)
|
|
26
|
+
return constants_1.legacyLanguages.REACT;
|
|
28
27
|
return null;
|
|
29
28
|
})();
|
|
30
29
|
const strictOrDefaultText = (() => {
|
|
31
30
|
if (!strictConfig || strictConfig.length === 0)
|
|
32
31
|
return [constants_2.subFolders.DEFAULT];
|
|
33
|
-
const strictFolder = strictConfig.sort((a, b) => a.localeCompare(b)).join('-');
|
|
32
|
+
const strictFolder = [...strictConfig].sort((a, b) => a.localeCompare(b)).join('-');
|
|
34
33
|
return [constants_2.subFolders.STRICT, strictFolder];
|
|
35
34
|
})();
|
|
36
35
|
const path = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
/**
|
|
3
3
|
* Program Command
|
|
4
|
-
* @example: pnpm cli:start --extended --legacy --ts --js --prettier --react --remix --next --node --
|
|
4
|
+
* @example: pnpm cli:start --extended --legacy --ts --js --prettier --react --remix --next --node --strict-import-config --strict-react-config --strict-typescript-config --legacy-base-config --legacy-react-config --legacy-react-hooks-config --use-npm --use-yarn --use-pnpm --use-bun --create-eslint-file --skip-install
|
|
5
5
|
*/
|
|
6
6
|
declare const program: Command;
|
|
7
7
|
export default program;
|
package/dist/helpers/program.js
CHANGED
|
@@ -5,7 +5,7 @@ const getConfigUrl_1 = require("../helpers/getConfigUrl");
|
|
|
5
5
|
const package_json_1 = require("../package.json");
|
|
6
6
|
/**
|
|
7
7
|
* Program Command
|
|
8
|
-
* @example: pnpm cli:start --extended --legacy --ts --js --prettier --react --remix --next --node --
|
|
8
|
+
* @example: pnpm cli:start --extended --legacy --ts --js --prettier --react --remix --next --node --strict-import-config --strict-react-config --strict-typescript-config --legacy-base-config --legacy-react-config --legacy-react-hooks-config --use-npm --use-yarn --use-pnpm --use-bun --create-eslint-file --skip-install
|
|
9
9
|
*/
|
|
10
10
|
const program = new commander_1.Command()
|
|
11
11
|
.name(package_json_1.name)
|
|
@@ -20,11 +20,6 @@ const program = new commander_1.Command()
|
|
|
20
20
|
.option('--remix, --react-router', 'Include Remix/React Router specific linting rules.')
|
|
21
21
|
.option('--next', 'Include Next.js specific linting rules.')
|
|
22
22
|
.option('--node', 'Include Node.js specific linting rules.')
|
|
23
|
-
.option('--base-config', 'Include only the base Airbnb ESLint configuration.')
|
|
24
|
-
.option('--node-config', 'Include the Node specific ESLint configuration.')
|
|
25
|
-
.option('--react-config', 'Include the React specific ESLint configuration.')
|
|
26
|
-
.option('--next-config', 'Include the Next.js specific ESLint configuration.')
|
|
27
|
-
.option('--remix-config, --react-router-config', 'Include the Remix/React Router specific ESLint configuration.')
|
|
28
23
|
.option('--strict-import-config', 'Include the strict Import ESLint configuration.')
|
|
29
24
|
.option('--strict-react-config', 'Include the strict React ESLint configuration.')
|
|
30
25
|
.option('--strict-typescript-config', 'Include the strict TypeScript ESLint configuration.')
|
package/dist/index.js
CHANGED
|
@@ -50,7 +50,7 @@ const picocolors_1 = __importDefault(require("picocolors"));
|
|
|
50
50
|
const prompts_1 = __importDefault(require("prompts"));
|
|
51
51
|
const constants_1 = require("./constants");
|
|
52
52
|
const createEslintConfigFile_1 = __importDefault(require("./helpers/createEslintConfigFile"));
|
|
53
|
-
const getArgs_1 =
|
|
53
|
+
const getArgs_1 = __importDefault(require("./helpers/getArgs"));
|
|
54
54
|
const getCommands_1 = __importDefault(require("./helpers/getCommands"));
|
|
55
55
|
const getConfigUrl_1 = __importStar(require("./helpers/getConfigUrl"));
|
|
56
56
|
const installPackages_1 = __importDefault(require("./helpers/installPackages"));
|
|
@@ -79,7 +79,6 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
79
79
|
}
|
|
80
80
|
: {
|
|
81
81
|
language: null,
|
|
82
|
-
config: [],
|
|
83
82
|
}));
|
|
84
83
|
}
|
|
85
84
|
if (args.typescript === null) {
|
|
@@ -132,11 +131,6 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
132
131
|
description: picocolors_1.default.greenBright('You are using Node or any other frameworks of it'),
|
|
133
132
|
value: constants_1.languages.NODE,
|
|
134
133
|
},
|
|
135
|
-
{
|
|
136
|
-
title: 'Own Customization',
|
|
137
|
-
description: picocolors_1.default.redBright('You would like to customize by your own'),
|
|
138
|
-
value: constants_1.languages.OTHER,
|
|
139
|
-
},
|
|
140
134
|
],
|
|
141
135
|
onState: utils_1.onPromptState,
|
|
142
136
|
}, {
|
|
@@ -144,56 +138,6 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
144
138
|
});
|
|
145
139
|
args = Object.assign(Object.assign({}, args), { language });
|
|
146
140
|
}
|
|
147
|
-
if (!args.config) {
|
|
148
|
-
if (args.language === constants_1.languages.OTHER) {
|
|
149
|
-
const { config } = yield (0, prompts_1.default)({
|
|
150
|
-
type: 'multiselect',
|
|
151
|
-
name: 'config',
|
|
152
|
-
message: 'Select Config:',
|
|
153
|
-
min: 1,
|
|
154
|
-
choices: [
|
|
155
|
-
{
|
|
156
|
-
title: 'Base',
|
|
157
|
-
description: picocolors_1.default.yellowBright('Base config without React/JSX configurations'),
|
|
158
|
-
value: constants_1.configs.BASE,
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
title: 'Node',
|
|
162
|
-
description: picocolors_1.default.greenBright('Node config with Base config'),
|
|
163
|
-
value: constants_1.configs.NODE,
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
title: 'React',
|
|
167
|
-
description: picocolors_1.default.cyanBright('React config with base config'),
|
|
168
|
-
value: constants_1.configs.REACT,
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
title: 'Next',
|
|
172
|
-
description: picocolors_1.default.blackBright('Next.js config with base config'),
|
|
173
|
-
value: constants_1.configs.NEXT,
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
title: 'Remix (React Router)',
|
|
177
|
-
description: picocolors_1.default.redBright('Remix (React Router) config with base config'),
|
|
178
|
-
value: constants_1.configs.REACT_ROUTER,
|
|
179
|
-
},
|
|
180
|
-
],
|
|
181
|
-
format: (prev) => {
|
|
182
|
-
const values = prev;
|
|
183
|
-
const opts = Object.fromEntries(values.map((value) => [`${value}Config`, true]));
|
|
184
|
-
return (0, getArgs_1.getConfig)(opts);
|
|
185
|
-
},
|
|
186
|
-
hint: getArgs_1.configHelp,
|
|
187
|
-
onState: utils_1.onPromptState,
|
|
188
|
-
}, {
|
|
189
|
-
onCancel: utils_1.onCancel,
|
|
190
|
-
});
|
|
191
|
-
args = Object.assign(Object.assign({}, args), { config });
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
args = Object.assign(Object.assign({}, args), { config: [] });
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
141
|
if (!args.strictConfig) {
|
|
198
142
|
const { hasStrictConfig } = yield (0, prompts_1.default)({
|
|
199
143
|
type: 'toggle',
|
|
@@ -289,23 +233,18 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
289
233
|
}
|
|
290
234
|
}
|
|
291
235
|
if (args.createESLintFile === null) {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}, {
|
|
305
|
-
onCancel: utils_1.onCancel,
|
|
306
|
-
});
|
|
307
|
-
args = Object.assign(Object.assign({}, args), { createESLintFile });
|
|
308
|
-
}
|
|
236
|
+
const { createESLintFile } = yield (0, prompts_1.default)({
|
|
237
|
+
type: 'toggle',
|
|
238
|
+
name: 'createESLintFile',
|
|
239
|
+
message: `Should I create an ${picocolors_1.default.blue(getConfigUrl_1.eslintConfigName)} file for you?`,
|
|
240
|
+
initial: constants_1.defaults.createESLintFile,
|
|
241
|
+
active: 'Yes',
|
|
242
|
+
inactive: 'No',
|
|
243
|
+
onState: utils_1.onPromptState,
|
|
244
|
+
}, {
|
|
245
|
+
onCancel: utils_1.onCancel,
|
|
246
|
+
});
|
|
247
|
+
args = Object.assign(Object.assign({}, args), { createESLintFile });
|
|
309
248
|
}
|
|
310
249
|
if (args.skipInstall === null) {
|
|
311
250
|
const { skipInstall } = yield (0, prompts_1.default)({
|
|
@@ -344,13 +283,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
344
283
|
}
|
|
345
284
|
console.log();
|
|
346
285
|
console.log(picocolors_1.default.cyan(args.createESLintFile ? 'Created Config:' : 'Config:'));
|
|
347
|
-
|
|
348
|
-
console.log(picocolors_1.default.red('Customizing it to your needs requires considerable effort and is still a work in progress. In the meantime, please refer to the documentation and try setting up the configuration yourself using below link.'));
|
|
349
|
-
console.log(picocolors_1.default.blue('https://github.com/NishargShah/eslint-config-airbnb-extended/tree/master/packages/eslint-config-airbnb-extended'));
|
|
350
|
-
}
|
|
351
|
-
else {
|
|
352
|
-
console.log((_b = (0, getConfigUrl_1.default)(newArgs)) === null || _b === void 0 ? void 0 : _b.url);
|
|
353
|
-
}
|
|
286
|
+
console.log((_b = (0, getConfigUrl_1.default)(newArgs)) === null || _b === void 0 ? void 0 : _b.url);
|
|
354
287
|
console.log();
|
|
355
288
|
});
|
|
356
289
|
// eslint-disable-next-line unicorn/prefer-top-level-await
|
|
@@ -7,7 +7,7 @@ interface GetContentConfigurations {
|
|
|
7
7
|
}
|
|
8
8
|
export interface GetContentParams {
|
|
9
9
|
type: ValueOf<typeof configTypes>;
|
|
10
|
-
language:
|
|
10
|
+
language: ValueOf<typeof languages> | ValueOf<typeof legacyLanguages>;
|
|
11
11
|
languagePreference: ValueOf<typeof languagePreferences>;
|
|
12
12
|
configurations: GetContentConfigurations;
|
|
13
13
|
strictConfig: ValueOf<typeof strictConfigs>[];
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-airbnb-x-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Airbnb Extended Config CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"airbnb config cli x",
|
|
15
15
|
"airbnb config cli extended"
|
|
16
16
|
],
|
|
17
|
+
"homepage": "https://eslint-airbnb-extended.nishargshah.dev",
|
|
17
18
|
"bugs": {
|
|
18
19
|
"url": "https://github.com/NishargShah/eslint-config-airbnb-extended/issues"
|
|
19
20
|
},
|
|
@@ -54,5 +55,8 @@
|
|
|
54
55
|
"tsc-alias": "catalog:",
|
|
55
56
|
"tsx": "catalog:",
|
|
56
57
|
"typescript": "catalog:"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=16.0.0"
|
|
57
61
|
}
|
|
58
62
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-airbnb-x-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Airbnb Extended Config CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"airbnb config cli x",
|
|
15
15
|
"airbnb config cli extended"
|
|
16
16
|
],
|
|
17
|
+
"homepage": "https://eslint-airbnb-extended.nishargshah.dev",
|
|
17
18
|
"bugs": {
|
|
18
19
|
"url": "https://github.com/NishargShah/eslint-config-airbnb-extended/issues"
|
|
19
20
|
},
|
|
@@ -46,6 +47,9 @@
|
|
|
46
47
|
"tsx": "^4.20.5",
|
|
47
48
|
"typescript": "^5.9.2"
|
|
48
49
|
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=16.0.0"
|
|
52
|
+
},
|
|
49
53
|
"scripts": {
|
|
50
54
|
"prebuild": "rimraf ./dist",
|
|
51
55
|
"build": "tsc -b",
|